diff --git a/tdx-enhanced.js b/tdx-enhanced.js index ce75b17..fdbf41b 100644 --- a/tdx-enhanced.js +++ b/tdx-enhanced.js @@ -1,7 +1,7 @@ // ==UserScript== // @name tdx-enhanced // @namespace ecn -// @version 2024-05-13-02 +// @version 2024-05-13-03 // @description enhanced tdx coloring & formatting. follows system color scheme. // @author Purdue STEM IT - it@purdue.edu // @match https://service.purdue.edu/TDNext/* @@ -333,19 +333,22 @@ } //highlight modified/age red - if ('LastModifiedDate' in item) { - let modDate = item.LastModifiedDate - const ageThreshold = 336 + let modifiedDates = ['LastModifiedDate','ModifiedDate'] + for (const dType of modifiedDates) { + if (dType in item) { + let modDate = item[dType] + const ageThreshold = 336 - let date = moment(modDate.txt) - let duration = moment.duration(moment().diff(date)) - let hours = duration.asHours() + let date = moment(modDate.txt) + let duration = moment.duration(moment().diff(date)) + let hours = duration.asHours() - let alpha = hours / ageThreshold + let alpha = hours / ageThreshold - let cell = modDate.cell - cell.style.background = `rgba(255,0,0,${alpha}` - cell.classList.add(alpha > 0.5 ? "light" : "dark") + let cell = modDate.cell + cell.style.background = `rgba(255,0,0,${alpha}` + cell.classList.add(alpha > 0.5 ? "light" : "dark") + } } //find user replies & last modified by internal @@ -748,7 +751,7 @@ } .light { - color: var(--txt-1) !important; + color: #fff; } .dark {