1<script> 2 3 var dateTimeKey = "dt"; 4 var lnk = []; //get menu links 5 var hashInUrl = getHashFromUrl(); 6 7 var currentPage = window.location.href 8 .split('#')[0] // Remove the hash and everything after it 9 .replace(/\d+/g, '*'); // Replace all numbers with `*` 10 11 // console.log(currentPage); 12 // console.log(localStorage.getItem(currentPage)); 13 14 document.querySelectorAll('#main-menu a').forEach(function(anchor) { 15 var href = anchor.getAttribute('href'); 16 if (!lnk.includes(href)) { // Add link only if it's not already in the array 17 lnk.push(href); 18 } 19 anchor.onclick = function() { 20 selectSection(anchor.getAttribute('href')); 21 anchor.setAttribute("style", "color: #db261e;"); 22 }; 23 24 if(lnk.length == 1 && !localStorage.getItem(currentPage)){ 25 anchor.setAttribute("style", "color: #db261e;"); 26 } 27 }); 28 29 //hide all elements 30 hideAllSection(); 31 32 if(hasElapsedMinutes(1)) 33 { 34 localStorage.removeItem(currentPage + dateTimeKey); 35 localStorage.removeItem(currentPage); 36 } 37 38 // Retrieve the saved section for this page or default to the first section 39 var selectedSection = localStorage.getItem(currentPage) || lnk[0]; 40 41 //show first by default 42 showSection(selectedSection); 43 44 resetAllLinksColor(selectedSection); 45 46 47 if(hashInUrl != null) 48 { 49 selectSection(hashInUrl); 50 } 51 52 function showSection(id){ 53 document.querySelectorAll(id).forEach(function(div) { 54 div.style.display = ''; 55 }); 56 } 57 58 function hideAllSection() 59 { 60 for (let i = 0; i < lnk.length; i++) { 61 document.querySelectorAll(lnk[i]).forEach(function(div) { 62 div.style.display = 'none'; 63 }); 64 } 65 } 66 67 function resetAllLinksColor() 68 { 69 document.querySelectorAll('#main-menu a').forEach(function(anchor) { 70 var href = anchor.getAttribute('href'); 71 72 if(href == selectedSection){ 73 anchor.setAttribute("style", "color: #db261e;"); 74 } 75 else{ 76 anchor.setAttribute("style", "color: '';"); 77 } 78 79 }); 80 } 81 82 function hasElapsedMinutes(minutes) 83 { 84 const saved = localStorage.getItem(currentPage + dateTimeKey); 85 if (!saved) return true; // If nothing is saved, treat as expired 86 87 const savedDate = new Date(saved); 88 const now = new Date(); 89 90 const elapsedMs = now - savedDate; 91 const thresholdMs = minutes * 60 * 1000; 92 93 return elapsedMs > thresholdMs; 94 } 95 96 function selectSection(name) 97 { 98 selectedSection = name; 99 hideAllSection(); 100 showSection(name); 101 resetAllLinksColor(); 102 103 // Save the selected section using the URL (before #) as the key 104 localStorage.setItem(currentPage, name); 105 106 var now = new Date(); 107 localStorage.setItem(currentPage + dateTimeKey, now.toISOString()); 108 } 109 110 function getHashFromUrl(url = window.location.href) 111 { 112 try { 113 const parsedUrl = new URL(url); 114 const rawHash = parsedUrl.hash; 115 116 if (!rawHash || rawHash.startsWith('#/')) { 117 return null; 118 } 119 120 return rawHash; 121 } catch (e) { 122 console.error("Invalid URL:", e); 123 return null; 124 } 125 } 126 127</script>
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.