From 7a7444269c766bbe578a63c6331bbb172781aa25 Mon Sep 17 00:00:00 2001 From: Elijah Junga Date: Thu, 24 Oct 2024 16:44:32 -0400 Subject: [PATCH] Prepend Ticket Number to page title --- tdx-enhanced.js | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/tdx-enhanced.js b/tdx-enhanced.js index d9b3c2d..1d92287 100644 --- a/tdx-enhanced.js +++ b/tdx-enhanced.js @@ -1,7 +1,7 @@ // ==UserScript== // @name tdx-enhanced-student // @namespace ecn -// @version 2024-09-03-01 +// @version 2024-10-24-dev01 // @description enhanced tdx coloring & formatting. follows system color scheme. // @author Purdue STEM IT - it@purdue.edu // @match https://service.purdue.edu/TDNext/* @@ -115,13 +115,14 @@ function left_append_ticket_number() { try { - let form1 = document.querySelector("#Form1"); - let ticketID = form1.attributes["action"].value.slice(-6); + const queryString = window.location.search; + const urlParams = new URLSearchParams(queryString); + const ticketID = urlParams.get('TicketID'); let title = document.querySelector("title"); title.innerText = ticketID + ' ' + title.innerText; } catch (error) { console.warn(error); - console.warn("Was unable to append the ticketID for this page to the title\nThis page may not point to a ticket, or the Form1 element may be missing"); + console.warn("Was unable to append the ticketID for this page to the title\nThis page may not point to a ticket"); } } @@ -1068,6 +1069,7 @@ parseTicket() checkPath() applyStudentFormatting() + left_append_ticket_number() addEventListener("storage", (event) => { //console.log("Storage event:",event)