Files
ServiceHubPlus/script.js
T
2021-10-07 21:09:45 -04:00

33 lines
1.2 KiB
JavaScript

"use strict";
/*
TODO: insert a reset button into search form
TODO: style menubar and keep it sticky on the window
TODO: style/move the location scan to float with the RO
TODO: implement facebook-style notifications
*/
// Warranty Highlight
const isWarranty = document.getElementById("chkWarrantee");
isWarranty.addEventListener("change", updateBackground);
updateBackground();
function updateBackground() {
isWarranty.nextElementSibling.style.backgroundColor = isWarranty.checked
? "red"
: "transparent";
isWarranty.nextElementSibling.style.color = isWarranty.checked
? "white"
: "black";
}
// Notification system
// https://portal.trgrepair.com/task_manager.asp?rnd=0.9996227368620352
const notifCountStr = document.getElementById("lblTask").innerText;
const notifCount = parseInt(notifCountStr.split(" ")[2]); // Total task count
const notifCountNew = parseInt(notifCountStr.split(" ")[5].slice(1)); // New task count
// Insert notification button
const insertButton = document.getElementById("exitBtn");
insertButton.innerHTML = `<div id='newBtn'><a href='#' id='notification-button'><span class='material-icons-outlined notification-icon'>notifications</span></a><span id='notification-badge'>${notifCountNew}</span></div>`;