1$(document).ready(function() { 2 3 // Handler for the hamburger menu toggle 4 $('.mobile-header__menu-toggle').on('click keydown', function(event) { 5 if (event.type === "click" || event.which === 13 || event.which === 32) { 6 event.preventDefault(); 7 8 // Close search if it is open and toggle padding 9 var $searchBanner = $(this).closest('.mobile-header').find('.global-search'); 10 if ($searchBanner.css('display') === 'flex') { 11 $searchBanner.hide(); 12 $('.mobile-header').removeClass('padding-when-active'); 13 } 14 15 // Toggle the menu visibility 16 $('#mobile-menu').toggleClass('is-visible'); 17 $(this).find('.hamburger').toggleClass('fa-bars fa-times'); 18 19 event.stopPropagation(); 20 } 21 }); 22 23 // Close the menu if the escape key is pressed 24 $(document).keydown(function(e) { 25 if (e.key === "Escape" && $('#mobile-menu').hasClass('is-visible')) { 26 $('#mobile-menu').removeClass('is-visible'); 27 $('.mobile-header__menu-toggle').find('.fa-icon').addClass('fa-bars').removeClass('fa-times'); 28 } 29 }); 30 31 32 // Close the menu if search icon is clicked 33 $('.mobile-header__search-toggle').on('click keypress', function(event) { 34 if (event.type === "click" || event.key === "Enter" || event.key === " ") { 35 $('#mobile-menu').removeClass('is-visible'); 36 $('.mobile-header__menu-toggle').find('.fa-icon').addClass('fa-bars').removeClass('fa-times'); 37 } 38 }); 39 40 41 function updateActiveMenu() { 42 var currentPath = window.location.pathname; 43 var isHomepage = currentPath === "/"; 44 45 if (isHomepage) { 46 $('#mobile-menu li').removeClass('active'); 47 return; // Exit the function early since no items should be active 48 } 49 50 // Update active states for other pages 51 $('#mobile-menu a').each(function() { 52 var linkPath = new URL($(this).attr('href'), window.location.origin).pathname; 53 $(this).parent('li').removeClass('active'); 54 if (linkPath === currentPath) { 55 $(this).parents('li').addClass('active'); 56 } 57 }); 58 } 59 60 // Call updateActiveMenu on page load and menu interaction 61 updateActiveMenu(); 62 63 // Add to menu item click to refresh the active status 64 $('#mobile-menu a').on('click', function() { 65 updateActiveMenu(); 66 }); 67 68 // Toggle for main menu chevrons and logged-in menu items 69 $('#mobile-menu').on('click keypress', '.toggle-mainmenu', function(event) { 70 if (event.type === "click" || event.key === "Enter" || event.key === " ") { 71 event.stopPropagation(); 72 event.preventDefault(); 73 74 var $currentSubmenu = $(this).closest('li').find('.mobile-sub-menu').first(); 75 $('#mobile-menu .mobile-sub-menu').not($currentSubmenu).slideUp().prev('.menu-item-container').find('.toggle-mainmenu i').removeClass('fa-chevron-up').addClass('fa-chevron-down'); 76 $('#mobile-menu .mobile-sub-menu').not($currentSubmenu).prev('.menu-item-container').find('.toggle-submenu i').removeClass('fa-minus').addClass('fa-plus'); 77 78 $currentSubmenu.slideToggle(); 79 $(this).find('i').toggleClass('fa-chevron-down fa-chevron-up'); 80 } 81 }); 82 83 // Toggle for nested submenu plus and minus within any menu 84 $('#mobile-menu').on('click keypress', '.toggle-submenu', function(event) { 85 if (event.type === "click" || event.key === "Enter" || event.key === " ") { 86 event.stopPropagation(); 87 event.preventDefault(); 88 89 var $parentLi = $(this).closest('li'); 90 var $submenu = $parentLi.find('.mobile-sub-menu').first(); 91 92 $parentLi.siblings().find('.mobile-sub-menu').slideUp(); 93 $parentLi.siblings().find('.toggle-submenu i').removeClass('fa-minus').addClass('fa-plus'); 94 95 $submenu.slideToggle(); 96 $(this).find('i').toggleClass('fa-plus fa-minus'); 97 } 98 }); 99}); 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114
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.