diff --git a/tdx-enhanced.js b/tdx-enhanced.js index ba1991d..338d666 100644 --- a/tdx-enhanced.js +++ b/tdx-enhanced.js @@ -686,7 +686,6 @@ } } } - function parseOtherElements() { let path = document.location.pathname; @@ -713,14 +712,13 @@ document.querySelectorAll("div.moreToggle *:not(a), div.lessToggle *:not(a), div.wrap-text *:not(a)").forEach(textBlock=>{ textBlock.style.color = "var(--txt-1)" }) - document.querySelectorAll("#ToggleAIAgentAssist").forEach(AIAgentButton=>{ + document.querySelectorAll("#ToggleAIAgentAssist, .tdx-view-ticket-summary").forEach(AIAgentButton=>{ let selected = settings('get','aiBehavior'); - console.log("AI Behavior selected:",selected.value) if (selected == "aiDisable") { AIAgentButton.style.display = "none" } }) - + let desktopLayout = settings('get','layout') let desktop = document.querySelector("#divContent") if (desktop && desktopLayout) { @@ -915,6 +913,35 @@ } } + let age = ['Age'] + for (const dType of age) { + if (dType in item) { + let Age = item[dType] + const ageThreshold = 30 + + let days = Age.txt.slice(0,-1) + + if (days > 30){ + days = days - 30 + let alpha = days / ageThreshold + alpha = alpha > 1 ? 1 : alpha + let cell = Age.cell + console.log(alpha) + handleHighlight("age",alpha,cell) + cell.classList.add(alpha > 0.5 ? "light" : "dark") + } + } + } + + // let Status = ['Status'] + // for (const dType of Status) { + // if (dType in item) { + // let CurrentStatus = item[dType] + // let cell = CurrentStatus.cell + // handleHighlight("status",CurrentStatus.txt,cell) + // } + // } + //find user replies & last modified by internal if ('Requestor' in item && 'Modified By' in item && 'Prim Resp' in item) { let fromUser = item["Requestor"] @@ -1141,6 +1168,14 @@ if (type=="dateModified") { element.style.backgroundColor = `rgba(255,0,0,${txt}`; } + // if (type=="status"){ + // if (txt=="In Process") { + // element.style.backgroundColor = "red" + // } + // } + if (type=="age") { + element.style.backgroundColor = `rgba(255,0,0,${txt}`; + } } } @@ -1227,6 +1262,22 @@ if (t.classList.contains("tdx-right-side-panel")) { parseOtherElements() } + if (t.classList.contains("sr-alert-region")){ // magic class + document.querySelectorAll("#divFieldSuggestionsResponsible, #divFieldSuggestionsPriority, #divFieldSuggestionsForm").forEach(AIAgentButton=>{ + let selected = settings('get','aiBehavior'); + if (selected == "aiDisable") { + AIAgentButton.style.display = "none" + } + }) + } + if (t.classList.contains("cke_button_label")){ + document.querySelectorAll(".cke_button__revisetext").forEach(AIAgentButton=>{ + let selected = settings('get','aiBehavior'); + if (selected == "aiDisable") { + AIAgentButton.style.display = "none" + } + }) + } let module = t.querySelector("div > .tdx-dashboard__widget-container") if (module) {