1var at = document.documentElement.getAttribute("data-layout"); 2if ((at = "vertical")) { 3 4 // ---------------------------------------- 5 // Active 2 file at same time 6 // ---------------------------------------- 7 8 var currentURL = 9 window.location != window.parent.location 10 ? document.referrer 11 : document.location.href; 12 13 var link = document.getElementById("get-url"); 14 15 if (currentURL.includes("/main/index.html")) { 16 link.setAttribute("href", "../main/index.html"); 17 } else if (currentURL.includes("/index.html")) { 18 link.setAttribute("href", "./index.html"); 19 } else { 20 link.setAttribute("href", "./"); 21 } 22 23 function findMatchingElement() { 24 var currentUrl = window.location.href; 25 var anchors = document.querySelectorAll("#sidebarnav a"); 26 for (var i = 0; i < anchors.length; i++) { 27 if (anchors[i].href === currentUrl) { 28 return anchors[i]; 29 } 30 } 31 32 return null; // Return null if no matching element is found 33 } 34 var elements = findMatchingElement(); 35 36 // Do something with the matching element 37 if (elements) { 38 elements.classList.add("active"); 39 } 40 41 document 42 .querySelectorAll("ul#sidebarnav ul li a.active") 43 .forEach(function (link) { 44 link.closest("ul").classList.add("in"); 45 link.closest("ul").parentElement.classList.add("selected"); 46 }); 47 48 document.querySelectorAll("#sidebarnav li").forEach(function (li) { 49 const isActive = li.classList.contains("selected"); 50 if (isActive) { 51 const anchor = li.querySelector("a"); 52 if (anchor) { 53 anchor.classList.add("active"); 54 } 55 } 56 }); 57 document.querySelectorAll("#sidebarnav a").forEach(function (link) { 58 link.addEventListener("click", function (e) { 59 const isActive = this.classList.contains("active"); 60 const parentUl = this.closest("ul"); 61 if (!isActive) { 62 // hide any open menus and remove all other classes 63 parentUl.querySelectorAll("ul").forEach(function (submenu) { 64 submenu.classList.remove("in"); 65 }); 66 parentUl.querySelectorAll("a").forEach(function (navLink) { 67 navLink.classList.remove("active"); 68 }); 69 70 // open our new menu and add the open class 71 const submenu = this.nextElementSibling; 72 if (submenu) { 73 submenu.classList.add("in"); 74 } 75 76 this.classList.add("active"); 77 } else { 78 this.classList.remove("active"); 79 parentUl.classList.remove("active"); 80 const submenu = this.nextElementSibling; 81 if (submenu) { 82 submenu.classList.remove("in"); 83 } 84 } 85 }); 86 }); 87} 88if ((at = "horizontal")) { 89 function findMatchingElement() { 90 var currentUrl = window.location.href; 91 var anchors = document.querySelectorAll("#sidebarnavh ul#sidebarnav a"); 92 for (var i = 0; i < anchors.length; i++) { 93 if (anchors[i].href === currentUrl) { 94 return anchors[i]; 95 } 96 } 97 98 return null; // Return null if no matching element is found 99 } 100 var elements = findMatchingElement(); 101 102 if (elements) { 103 elements.classList.add("active"); 104 } 105 document 106 .querySelectorAll("#sidebarnavh ul#sidebarnav a.active") 107 .forEach(function (link) { 108 link.closest("a").parentElement.classList.add("selected"); 109 link.closest("ul").parentElement.classList.add("selected"); 110 }); 111}
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.