1// Scroll 2 3const header = document.querySelector('header'); 4const scrollThreshold = 150; 5 6function updateHeaderBackground() { 7 const isDesktop = window.innerWidth > 1000; 8 9 if (window.scrollY > scrollThreshold) { 10 header.classList.add('scrolled'); 11 12 // On desktop, add body padding to prevent layout shift when header becomes fixed 13 if (isDesktop) { 14 document.body.style.paddingTop = header.offsetHeight + 'px'; 15 } 16 } else { 17 header.classList.remove('scrolled'); 18 19 // Remove body padding when header is not fixed 20 if (isDesktop) { 21 document.body.style.paddingTop = '0'; 22 } 23 } 24} 25 26window.addEventListener('scroll', updateHeaderBackground); 27window.addEventListener('resize', function() { 28 // Reset body padding on resize and recalculate 29 const isDesktop = window.innerWidth > 1000; 30 if (!isDesktop) { 31 document.body.style.paddingTop = '0'; 32 } 33 updateHeaderBackground(); 34}); 35updateHeaderBackground(); 36 37const responsiveMenuToggle = document.querySelector(".navigation-button") 38const navigationCheckbox = document.getElementById("navigation-toggle") 39let navigationMenuOpen = false 40 41responsiveMenuToggle.addEventListener("click", toggleNavigationMenu) 42 43// Prevent body scroll when mobile menu is open 44navigationCheckbox.addEventListener("change", function() { 45 if (this.checked) { 46 // Save current scroll position 47 const scrollY = window.scrollY; 48 document.body.style.top = `-${scrollY}px`; 49 document.body.classList.add("mobile-menu-open"); 50 } else { 51 // Restore scroll position 52 const scrollY = document.body.style.top; 53 document.body.classList.remove("mobile-menu-open"); 54 document.body.style.top = ''; 55 window.scrollTo(0, parseInt(scrollY || '0') * -1); 56 } 57}) 58 59function toggleNavigationMenu(){ 60 navigationMenuOpen = !navigationMenuOpen 61} 62 63 64// Handling Mobile Menu Navigation 65 66function toggleSubMenu(parentMenu){ 67 const subMenu = parentMenu.querySelector("ul.sub-menu") 68 const link = parentMenu.querySelector("a") 69 if(!link.classList.contains("is-active")){ 70 subMenu.classList.add("is-visible") 71 link.classList.add("is-active") 72 } else { 73 subMenu.classList.add("fade-out") 74 link.classList.remove("is-active") 75 setTimeout(() => { 76 subMenu.classList.remove("fade-out") 77 subMenu.classList.remove("is-visible") 78 79 }, 200) 80 81 } 82 83} 84 85const mobileParentItems = document.querySelectorAll(".menu-item-has-children") 86mobileParentItems.forEach((item) => { 87 item.addEventListener("click", (e) => { 88 toggleSubMenu(e.target) 89 }) 90}) 91 92// Handle notifications 93 94document.addEventListener('DOMContentLoaded', function() { 95 const notification = document.getElementById('site-notification'); 96 if (!notification) return; 97 98 const notificationId = notification.dataset.notificationId; 99 const closeButton = notification.querySelector('.close-notification'); 100 const notificationLinks = notification.querySelectorAll('.notification-content a'); 101 102 const dismissedNotifications = JSON.parse(localStorage.getItem('dismissedNotifications') || '{}'); 103 104 if (dismissedNotifications[notificationId]) { 105 notification.classList.add('hidden'); 106 } 107 108 const dismissNotification = () => { 109 notification.classList.add('hidden'); 110 dismissedNotifications[notificationId] = true; 111 localStorage.setItem('dismissedNotifications', JSON.stringify(dismissedNotifications)); 112 }; 113 114 closeButton.addEventListener('click', dismissNotification); 115 116 // Handle link clicks within notification 117 notificationLinks.forEach(link => { 118 link.addEventListener('click', function(e) { 119 // Don't prevent default - let the link work normally 120 dismissNotification(); 121 }); 122 }); 123}); 124 125 126document.addEventListener('DOMContentLoaded', function() { 127 const branchDropdown = document.getElementById('branch-dropdown'); 128 const branchButton = document.getElementById('branch-button'); 129 130 if (branchDropdown && branchButton) { 131 // Toggle dropdown on button click 132 branchButton.addEventListener('click', function(e) { 133 e.preventDefault(); 134 e.stopPropagation(); 135 branchDropdown.classList.toggle('open'); 136 }); 137 138 // Close dropdown when clicking outside 139 document.addEventListener('click', function(e) { 140 if (!branchDropdown.contains(e.target)) { 141 branchDropdown.classList.remove('open'); 142 } 143 }); 144 145 // Close dropdown on ESC key press 146 document.addEventListener('keydown', function(e) { 147 if (e.key === 'Escape') { 148 branchDropdown.classList.remove('open'); 149 } 150 }); 151 152 // Close dropdown when clicking on dropdown items 153 const dropdownItems = branchDropdown.querySelectorAll('.branch-dropdown-item');
154 dropdownItems.forEach(item => { 155 item.addEventListener('click', function() { 156 branchDropdown.classList.remove('open'); 157 }); 158 }); 159 } 160}); 161 162// Search form functionality 163 164/* document.addEventListener('DOMContentLoaded', function() { 165 const searchToggle = document.getElementById('search-toggle'); 166 const searchOverlay = document.getElementById('search-overlay'); 167 const searchClose = document.getElementById('search-close'); 168 const searchInput = document.querySelector('.search-input'); 169 170 searchToggle.addEventListener('click', function() { 171 searchOverlay.classList.add('active'); 172 searchInput.focus(); 173 }); 174 175 searchClose.addEventListener('click', function() { 176 searchOverlay.classList.remove('active'); 177 }); 178 179 // Close overlay on ESC key press 180 document.addEventListener('keydown', function(e) { 181 if (e.key === 'Escape') { 182 searchOverlay.classList.remove('active'); 183 } 184 }); 185}); */
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.