at main 810 B view raw
1const delay = (ms) => new Promise((res) => setTimeout(res, ms)); 2 3function highlightElement(xpath, url) { 4 url2 = url.replace("index.html", ""); 5 if (!(window.location.pathname == url2)) { 6 window.location.pathname = url2; 7 console.info( 8 `Returned Early: ${window.location.pathname} does not equal ${url2}`, 9 ); 10 return; 11 } 12 const node = document.evaluate( 13 xpath, 14 document, 15 null, 16 XPathResult.FIRST_ORDERED_NODE_TYPE, 17 null, 18 ); 19 20 el = node.singleNodeValue; 21 const prevBorder = el.style.border; 22 const prevRadius = el.style.borderRadius; 23 el.style.border = "solid red"; 24 // el.style.borderRadius = "100%"; 25 el.scrollIntoView({ behavior: "smooth", block: "center" }); 26 // delay(5000); 27 // el.style.border = prevBorder; 28 // el.style.borderRadius = prevRadius; 29}