diff --git a/tdx-enhanced.js b/tdx-enhanced.js index 04919ce..feee009 100644 --- a/tdx-enhanced.js +++ b/tdx-enhanced.js @@ -1,7 +1,7 @@ // ==UserScript== // @name tdx-enhanced // @namespace purdue-it -// @version 2025-05-29-558 +// @version 2025-05-29-570 // @description enhanced tdx coloring & formatting. follows system color scheme. // @author Purdue STEM IT - it@purdue.edu // @match https://service.purdue.edu/TDWorkManagement* @@ -84,7 +84,7 @@ /* BEGIN FUNCTIONS */ - function updateHeading(mutation,numItems,totalItems) { + function updateHeading(mutation) { let headings = mutation.querySelectorAll(".tdx-control-bar__title") for (const heading of headings) { @@ -105,7 +105,7 @@ let title = document.createElement("h4") title.classList = heading.classList title.innerText = embedData.name - let moduleBody = heading.parentNode.parentNode.querySelector(".ModuleContent") + let moduleBody = heading.parentNode.parentNode.parentNode.querySelector(".tdx-widget") let embed = document.createElement("iframe") embed.classList = "customEmbed" embed.src = embedData.url @@ -376,9 +376,10 @@ //apply sticky columns let stickyColumns = settings('get','stickyColumns') if (stickyColumns) { - [...document.querySelectorAll(".desktop-column")].forEach(column=>{ + [...document.querySelectorAll(".tdx-dashboard__column")].forEach(column=>{ column.style.position = "sticky" - column.style.top = "45px" + column.style.alignSelf = "flex-start" + column.style.top = "4px" }); } } @@ -393,9 +394,6 @@ let table = element.querySelector("table") let items = []; - var numItems = null - var totalItems = null - if (table) { let headers = []; //console.log("Table",table); @@ -437,25 +435,9 @@ //being coloring parseItem(item) }) - - //update panel heading above table - numItems = items.length - //totalItems = null - - /* - let pagination = t.querySelector(".pull-right .bootstrap-pagination-label") - if (pagination) { - let pTxt = pagination.innerText - pTxt = pTxt.split(" ")[0] - totalItems = pTxt - } - */ - - - //console.log("Items:",items) } - updateHeading(element,numItems,totalItems) + //updateHeading(element) } function createHighlightBubble(element,bgColor,txtColor) { @@ -775,7 +757,6 @@ //attempt color coded tables on non-desktop pages let tables = frame.querySelectorAll("table"); [...tables].forEach(table=>{ - console.log("Table in frame:",table,table.parentElement) parseTable(table.parentElement) }) @@ -813,10 +794,16 @@ parseTicket(t.querySelectorAll(".feed-reply")) } + //parse dashboard widgets if (t.id=="tdx-workmgmt-container-collection") { 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") if (frames) { @@ -1000,11 +987,6 @@