1const path = window.location.pathname; 2const langCode = path.split("/").filter(Boolean)[0]; 3 4window.onload = function () { 5 const menuBtn = document.querySelector(".menu-button"); 6 const navList = document.querySelector(".nav-items"); 7 const navLinks = document.querySelectorAll(".nav-item a"); 8 const iconMenu = document.querySelector(".icon-menu"); 9 const iconClose = document.querySelector(".icon-close"); 10 11 // set language based on url 12 localStorage.setItem("language", langCode); 13 14 // Function to toggle menu 15 function toggleMenu() { 16 const isExpanded = menuBtn.getAttribute("aria-expanded") === "true"; 17 18 menuBtn.setAttribute("aria-expanded", !isExpanded); 19 navList.classList.toggle("opened"); 20 21 // Change icons 22 iconMenu.style.display = isExpanded ? "block" : "none"; 23 iconClose.style.display = isExpanded ? "none" : "block"; 24 25 navList.querySelectorAll(".nav-link").forEach((link) => { 26 link.setAttribute("tabindex", isExpanded ? "-1" : "0"); 27 }); 28 } 29 30 // Handle menu button click 31 menuBtn.addEventListener("click", toggleMenu); 32 33 // Close after clicking a link 34 navLinks.forEach((link) => { 35 link.addEventListener("click", () => { 36 if (navList.classList.contains("opened")) { 37 toggleMenu(); 38 } 39 }); 40 }); 41 42 // Set selected language in localStorage 43 const langSelect = document.getElementById("lang-select"); 44 langSelect.addEventListener("change", () => { 45 localStorage.setItem("language", langSelect.value.replace("/", "")); 46 }); 47};
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.