From 6e60b947a5489c04ae0d2138765702145474888b Mon Sep 17 00:00:00 2001 From: "Martin, Alexander Scott" Date: Mon, 3 Feb 2025 16:23:35 -0500 Subject: [PATCH] create function for highlight bubbles --- tdx-enhanced.js | 32 +++++++++++++++++++++----------- 1 file changed, 21 insertions(+), 11 deletions(-) diff --git a/tdx-enhanced.js b/tdx-enhanced.js index c9a88e7..98d6854 100644 --- a/tdx-enhanced.js +++ b/tdx-enhanced.js @@ -399,9 +399,26 @@ } updateHeading(t.parentElement,numItems,totalItems) + } - console.log("Items:",items) - } + function createHighlightBubble(element,bgColor,txtColor) { + + //should the bubble carry links over? + //let copy = element.cloneNode(true) + + //create new element to highlight + let newSpan = document.createElement("span") + newSpan.innerText = element.innerText //item["2285"].txt + newSpan.style.backgroundColor = bgColor + newSpan.style.color = txtColor + newSpan.classList.add("qHighlight") + + //if we use the copy method + //newSpan.appendChild(copy) + + //replace cell with new span + element.replaceChildren(newSpan) + return newSpan } //modify/color the cells @@ -414,15 +431,7 @@ if (qTxt in colorsByQueue) { let q = colorsByQueue[qTxt] - //create new element to highlight - let newSpan = document.createElement("span") - newSpan.innerText = item["2285"].txt - newSpan.style.backgroundColor = q.bg - newSpan.style.color = q.txt - newSpan.classList.add("qHighlight") - - //replace cell with new span - qCell.replaceChildren(newSpan) + createHighlightBubble(qCell,q.bg,q.txt) } } @@ -1482,6 +1491,7 @@ .qHighlight { padding: 4px; border-radius: 8px; + white-space: nowrap; } .select2-container-active .select2-choice, .select2-container-multi.select2-container-active .select2-choices {