1(function () { 2 "use strict"; 3 4 document.documentElement.classList.add("gwh-js"); 5 6 document.querySelectorAll('a[aria-disabled="true"]').forEach(function (link) { 7 link.addEventListener("click", function (event) { 8 event.preventDefault(); 9 }); 10 }); 11 12 document.querySelectorAll("[data-gwh-header]").forEach(function (header) { 13 var toggle = header.querySelector(".gwh-nav-toggle"); 14 var navigation = header.querySelector(".gwh-primary-nav"); 15 16 if (!toggle || !navigation) { 17 return; 18 } 19 20 function closeMenu(returnFocus) { 21 header.classList.remove("is-open"); 22 toggle.setAttribute("aria-expanded", "false"); 23 toggle.setAttribute("aria-label", "Open navigation menu"); 24 25 if (returnFocus) { 26 toggle.focus(); 27 } 28 } 29 30 function openMenu() { 31 header.classList.add("is-open"); 32 toggle.setAttribute("aria-expanded", "true"); 33 toggle.setAttribute("aria-label", "Close navigation menu"); 34 } 35 36 toggle.addEventListener("click", function () { 37 if (header.classList.contains("is-open")) { 38 closeMenu(false); 39 } else { 40 openMenu(); 41 } 42 }); 43 44 navigation.addEventListener("click", function (event) { 45 if (event.target.closest("a")) { 46 closeMenu(false); 47 } 48 }); 49 50 document.addEventListener("click", function (event) { 51 if (header.classList.contains("is-open") && !header.contains(event.target)) { 52 closeMenu(false); 53 } 54 }); 55 56 document.addEventListener("keydown", function (event) { 57 if (event.key === "Escape" && header.classList.contains("is-open")) { 58 closeMenu(true); 59 } 60 }); 61 62 window.addEventListener("resize", function () { 63 if (window.innerWidth > 1180 && header.classList.contains("is-open")) { 64 closeMenu(false); 65 } 66 }); 67 }); 68})();
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.