1;(() => { 2 function loadPartial(elementId, partialPath) { 3 const container = document.getElementById(elementId) 4 if (!container) return 5 6 fetch(partialPath) 7 .then((response) => { 8 if (!response.ok) throw new Error("Failed to load partial: " + partialPath) 9 return response.text() 10 }) 11 .then((html) => { 12 container.innerHTML = html 13 14 if (elementId === "header-container") { 15 initMobileMenu(container) 16 document.dispatchEvent(new CustomEvent("partials:headerLoaded")) 17 } 18 }) 19 .catch(() => {}) 20 } 21 22 function initMobileMenu(root) { 23 const toggleBtn = root.querySelector(".mobile-menu-toggle") 24 const overlay = document.querySelector(".mobile-menu-overlay") 25 const closeBtn = overlay?.querySelector(".mobile-menu-close") 26 const body = document.body 27 28 if (!toggleBtn || !overlay) return 29 30 function setOpen(isOpen) { 31 overlay.classList.toggle("active", isOpen) 32 overlay.classList.toggle("is-open", isOpen) 33 overlay.hidden = !isOpen 34 35 body.classList.toggle("menu-open", isOpen) 36 body.classList.toggle("no-scroll", isOpen) 37 38 toggleBtn.setAttribute("aria-expanded", String(isOpen)) 39 } 40 41 setOpen(false) 42 43 toggleBtn.addEventListener("click", (e) => { 44 e.preventDefault() 45 const isOpen = !overlay.hidden || overlay.classList.contains("active") || overlay.classList.contains("is-open") 46 setOpen(!isOpen) 47 }) 48 49 if (closeBtn) { 50 closeBtn.addEventListener("click", (e) => { 51 e.preventDefault() 52 setOpen(false) 53 }) 54 } 55 56 overlay.addEventListener("click", (e) => { 57 if (e.target === overlay) setOpen(false) 58 }) 59 60 document.addEventListener("keydown", (e) => { 61 if (e.key === "Escape") { 62 const isOpen = !overlay.hidden || overlay.classList.contains("active") || overlay.classList.contains("is-open") 63 if (isOpen) setOpen(false) 64 } 65 }) 66 } 67 68 function loadAllPartials() { 69 loadPartial("header-container", "/partials/header.html") 70 loadPartial("footer-container", "/partials/footer.html") 71 } 72 73 if (document.readyState === "loading") { 74 document.addEventListener("DOMContentLoaded", loadAllPartials) 75 } else { 76 loadAllPartials() 77 } 78})()
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.