Skip to content

Commit

Permalink
Merge branch 'release-2025-12-04'
Browse files Browse the repository at this point in the history
  • Loading branch information
ejunga committed Dec 4, 2025
2 parents 40001f4 + 2f96b86 commit 47f0a42
Showing 1 changed file with 57 additions and 12 deletions.
69 changes: 57 additions & 12 deletions tdx-enhanced.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// ==UserScript==
// @name tdx-enhanced
// @namespace purdue-it
// @version 2025-11-18-00
// @version 2025-12-04-00
// @description enhanced tdx coloring & formatting. follows system color scheme.
// @author Purdue STEM IT - it@purdue.edu
// @match https://service.purdue.edu/TDWorkManagement*
Expand All @@ -19,6 +19,8 @@
// @run-at document-end
// ==/UserScript==



(function() {
'use strict';

Expand Down Expand Up @@ -707,6 +709,11 @@
}
})

//force contrastive colors in descriptions with inline styles
document.querySelectorAll("div.moreToggle *:not(a), div.lessToggle *:not(a), div.wrap-text *:not(a)").forEach(textBlock=>{
textBlock.style.color = "var(--txt-1)"
})

let desktopLayout = settings('get','layout')
let desktop = document.querySelector("#divContent")
if (desktop && desktopLayout) {
Expand Down Expand Up @@ -1167,11 +1174,25 @@
}
}

function ckeinjectCustomCss(event) {
// var editor = event.editor
try {
if (!(event.document.$.getElementById("tdxuserscript-style"))) {
var style = event.document.$.createElement('style');
style.id = "tdxuserscript-style"
style.innerHTML = customStyles
event.document.$.getElementsByTagName('head')[0].appendChild(style);
event.document.$.querySelectorAll("div, span").forEach((element) => {
element.style.color = "var(--txt-1)"
})
}
} catch(error) {}
}

//setup observer to watch report/table changes/refreshes
let observer = new MutationObserver((mutations) => {
mutations.forEach((mutation) => {
let t = mutation.target
//console.error("Mutation:",t)
if (t.querySelector("div > table")) {
//let table = t.firstElementChild.querySelector("table")
//console.log("Matched table",t)
Expand All @@ -1185,6 +1206,11 @@
parseTicket(t.querySelectorAll(".feed-reply"))
}

//force contrastive colors in comments/replies with inline styles
document.querySelectorAll("div.feed-item-text *:not(a)").forEach(textBlock=>{
textBlock.style.color = "var(--txt-1)"
})

//parse dashboard widgets
if (t.id=="tdx-workmgmt-container-collection") {
parseOtherElements()
Expand All @@ -1194,29 +1220,35 @@
if (t.classList.contains("tdx-right-side-panel")) {
parseOtherElements()
}

let module = t.querySelector("div > .tdx-dashboard__widget-container")
if (module) {
updateHeading(t)
}

try {
for (const instance in CKEDITOR.instances) {
ckeinjectCustomCss(CKEDITOR.instances[instance]);
}
} catch (error) {}

//search whole document, frames may reset when reopened
let frames = document.querySelectorAll("iframe:not(.customEmbed)")
if (frames) {
[...frames].forEach(frame=>{
injectOtherStyles(frame)
});
}
// let frames = document.querySelectorAll("iframe:not(.customEmbed)")
// if (frames) {
// [...frames].forEach(frame=>{
// injectOtherStyles(frame)
// });
// }
});
});

if (true) {
console.log("Observing...")
observer.observe(document.body, {
characterDataOldValue: true,
characterDataOldValue: false,
subtree: true,
childList: true,
characterData: true
characterData: false
});
}

Expand Down Expand Up @@ -1288,7 +1320,7 @@
style.setProperty("--filter-invert",filters.invert)
style.setProperty("--filter-saturate",filters.saturate)
style.setProperty("--filter-sepia",filters.sepia)
}
}

/*
function toggleColorMode() {
Expand Down Expand Up @@ -1330,6 +1362,12 @@

}

try {
CKEDITOR.on('instanceReady', function(event) {
ckeinjectCustomCss(event)
})
} catch (error) {}

async function injectToolbar() {
let iconBar = document.querySelector("#globalSearchBar")

Expand Down Expand Up @@ -1784,6 +1822,8 @@
--light-txt-hue: 0deg;
--light-shadow-1: rgba(50, 50, 50, 0.1);
--light-shadow-2: rgba(50, 50, 50, 0.06);
--body-text-color: var(--txt-0);
}
@media (prefers-color-scheme: light) {
Expand Down Expand Up @@ -3794,6 +3834,11 @@ body .tdworkmgmt.table>tbody>tr:not(.tdx-grid__group-header):not(.TDGridHeader):
background-color: var(--bg-4);
}
html .cke_editable {
background-color: var(--bg-4) important!;
color: var(--txt-1) important!;
}
.cke_wysiwyg_div, .cke_wysiwyg_frame {
background: var(--bg-0) !important;
}
Expand Down

0 comments on commit 47f0a42

Please sign in to comment.