diff --git a/topdesk-highlight-summary.user.js b/topdesk-highlight-summary.user.js index 776fc22..68d92f5 100644 --- a/topdesk-highlight-summary.user.js +++ b/topdesk-highlight-summary.user.js @@ -1,7 +1,7 @@ // ==UserScript== // @name TOPdesk - Highlight Summary // @namespace http://tampermonkey.net/ -// @version 1.2 +// @version 1.3 // @description Highlight the summary section in a box with rounded corners and white background // @author Magnus Børnes (magnborn@ntnu.no) // @match https://hjelp.ntnu.no/* @@ -16,10 +16,10 @@ // Function to highlight the summary function highlightSummary() { - // Find all div elements with specific class or attribute - const divs = document.querySelectorAll('div[guielement="crt-content-label"]'); + // Find the first div element with an ID ending in "_Y7" + const div = document.querySelector('div[id$="_Y7"]'); - divs.forEach(div => { + if (div) { // Get the inner HTML of the div let html = div.innerHTML; @@ -46,11 +46,11 @@ // Update the div's inner HTML div.innerHTML = html; } - }); + } } - // Run the function to highlight the summary after the DOM is fully loaded - document.addEventListener('DOMContentLoaded', () => { + // Run the function to highlight the summary after the page has fully loaded + window.addEventListener('load', () => { highlightSummary(); // Debounce function to limit the frequency of highlightSummary calls