const delay = (ms) => new Promise((res) => setTimeout(res, ms)); function highlightElement(xpath, url) { url2 = url.replace("index.html", ""); if (!(window.location.pathname == url2)) { window.location.pathname = url2; console.info( `Returned Early: ${window.location.pathname} does not equal ${url2}`, ); return; } const node = document.evaluate( xpath, document, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null, ); el = node.singleNodeValue; const prevBorder = el.style.border; const prevRadius = el.style.borderRadius; el.style.border = "solid red"; // el.style.borderRadius = "100%"; el.scrollIntoView({ behavior: "smooth", block: "center" }); // delay(5000); // el.style.border = prevBorder; // el.style.borderRadius = prevRadius; }