Skip to content

Commit

Permalink
Merge branch 'fix-colors' into beta
Browse files Browse the repository at this point in the history
  • Loading branch information
ejunga committed Dec 3, 2025
2 parents c6b2e5d + 7840543 commit 31c55af
Showing 1 changed file with 55 additions and 15 deletions.
70 changes: 55 additions & 15 deletions tdx-enhanced.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,33 @@
if (t.classList.contains("tdx-right-side-panel")) {
parseOtherElements()
}

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

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

//search whole document, frames may reset when reopened
// 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 +1318,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 +1360,13 @@

}

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

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

Expand Down Expand Up @@ -1784,6 +1821,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 +3833,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 Expand Up @@ -3989,10 +4033,6 @@ div.profile-image.red-bg, div.profile-image.green-bg, div.profile-image.red-bg,
color: var(--col-400) !important;
}
.wrap-text *:not(a), .moreToggle *:not(a), .lessToggle *:not(a) {
color: var(--txt-1) !important;
}
.tdx-view-ticket-summary #divSummaryHeading a {
color: var(--col-400);
}
Expand Down

0 comments on commit 31c55af

Please sign in to comment.