1{ 2 jQuery(function ($) { 3 // Original search form handling for standard header 4 const searchForm = document.querySelector(".site-header-additional-search-form"); 5 const searchButton = document.querySelector(".site-header-additional-search-btn"); 6 7 if (searchForm && searchButton) { 8 searchButton.addEventListener("mouseover", () => { 9 searchForm.classList.add("open"); 10 searchForm.querySelector('input').focus() 11 }); 12 13 document.addEventListener("click", (event) => { 14 if (!searchForm.contains(event.target) && !searchButton.contains(event.target)) { 15 searchForm.classList.remove("open"); 16 } 17 }); 18 19 searchForm.addEventListener("submit", () => { 20 searchForm.classList.remove("open"); 21 }); 22 } 23 24 // Regular menu toggle (for mobile menu) 25 $('.site-header-toggler:not(.mega-menu-toggler)').click(function () { 26 $("body").toggleClass("menu-open") 27 }); 28 29 // Mega menu handling - Simplified! 30 const megaMenu = document.getElementById("mega-menu"); 31 const megaMenuTogglers = document.querySelectorAll(".mega-menu-toggler"); 32 const closeMenu = document.querySelector(".mega-menu-close"); 33 34 if (megaMenu) { 35 // Handle all mega menu toggle buttons (including search) 36 megaMenuTogglers.forEach(toggler => { 37 toggler.addEventListener("click", function() { 38 megaMenu.classList.add("active"); 39 document.body.classList.add("menu-open"); 40 41 // If this is the search button, focus the search input in the mega menu 42 if (toggler.querySelector(".icon-search-new")) { 43 setTimeout(() => { 44 const megaMenuSearchInput = megaMenu.querySelector("input[type='search']"); 45 if (megaMenuSearchInput) megaMenuSearchInput.focus(); 46 }, 100); 47 } 48 }); 49 }); 50 51 // Close button 52 if (closeMenu) { 53 closeMenu.addEventListener("click", function() { 54 megaMenu.classList.remove("active"); 55 document.body.classList.remove("menu-open"); 56 }); 57 } 58 59 // Close when clicking outside 60 document.addEventListener("click", function(e) { 61 if (megaMenu.classList.contains("active") && 62 !megaMenu.contains(e.target) && 63 !Array.from(megaMenuTogglers).some(t => t.contains(e.target))) { 64 megaMenu.classList.remove("active"); 65 document.body.classList.remove("menu-open"); 66 } 67 }); 68 } 69 }); 70}
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.