1$(function () { 2 let width = $(window).width(); 3 let height = $(window).height(); 4 5 function _setActiveItem() { 6 let path = decodeURIComponent(window.location.pathname.replace(/\/$/, "")); 7 8 $(".navigation-bar-item").each(function () { 9 let href = $(this).attr("href"); 10 11 if (href && path === href) { 12 $(this).addClass("active"); 13 14 $(this).parents(".navigation-bar-dropdown").find(".navigation-bar-dropdown-toggle").addClass("active"); 15 } 16 }); 17 } 18 19 function _closeAll() { 20 $("body").removeClass("navigation-bar-expanded"); 21 $(".navigation-bar-toggle").removeClass("active"); 22 $(".navigation-bar-dropdown, .navigation-bar-footer").removeClass("open"); 23 } 24 25 $(".navigation-bar-dropdown-toggle").on("mouseenter", () => { 26 $(".navigation-bar-input").focus(); 27 }); 28 29 // DROPDOWN TOGGLE 30 $(".navigation-bar-dropdown-toggle").on("click", function (e) { 31 var dropdownExpandsOnHover = $(this).parent().hasClass("dropdown-expand-on-hover"); 32 var onDesktop = $(window).width() >= 992; 33 var dropdownExpandsOnClick = !(dropdownExpandsOnHover && onDesktop); 34 var hrefContainsUrl = $(this).is('[href*="/"]'); 35 36 e.stopPropagation(); 37 38 if (dropdownExpandsOnClick) { 39 e.preventDefault(); 40 $(".navigation-bar-dropdown").not($(this).parents(".navigation-bar-dropdown")).removeClass("open"); 41 42 $(this).closest(".navigation-bar-dropdown").toggleClass("open"); 43 44 if (!$(this).closest(".navigation-bar-footer").length) { 45 $(".navigation-bar-toggle").removeClass("active"); 46 $(".navigation-bar-footer").removeClass("open"); 47 48 // if first dropdown item 49 if (!$(this).closest(".navigation-bar-dropdown-menu").length) { 50 if ($(this).closest(".navigation-bar-dropdown").hasClass("open")) { 51 $("body").addClass("navigation-bar-expanded"); 52 } else { 53 $("body").removeClass("navigation-bar-expanded"); 54 } 55 } else { 56 $("body").addClass("navigation-bar-expanded"); 57 } 58 } 59 } else if (dropdownExpandsOnHover && !hrefContainsUrl) { 60 // make href not clickable when it contains no url 61 e.preventDefault(); 62 } 63 64 if (onDesktop) { 65 $(".navigation-bar-input").focus(); 66 } 67 }); 68 69 $(".navigation-bar-dropdown-close").on("click", function (e) { 70 e.preventDefault(); 71 $(this).closest(".navigation-bar-dropdown").removeClass("open"); 72 }); 73 74 $(".account-menu-close").on("click", function (e) { 75 _closeAll(); 76 }); 77 78 // HAMBURGER MENU TOGGLE 79 $(".navigation-bar-toggle").on("click", function (e) { 80 e.preventDefault(); 81 e.stopPropagation(); 82 $(".navigation-bar-dropdown").removeClass("open"); 83 84 if ($(".navigation-bar-footer").hasClass("open")) { 85 $(this).removeClass("active"); 86 $(".navigation-bar-footer").removeClass("open"); 87 $("body").removeClass("navigation-bar-expanded"); 88 } else { 89 $(this).addClass("active"); 90 $(".navigation-bar-footer").addClass("open"); 91 $("body").addClass("navigation-bar-expanded"); 92 } 93 }); 94 95 $(".navigation-bar-footer .navigation-bar-container, .navigation-bar-dropdown-body, .hamburger-header").on( 96 "click", 97 function (e) { 98 e.stopPropagation(); 99 } 100 ); 101 102 $(".dropdown-search-visible").on("click", function (e) { 103 if ($(window).width() >= 992) { 104 e.preventDefault(); 105 _closeAll(); 106 } 107 }); 108 109 $(document).on("click", function () { 110 _closeAll(); 111 }); 112 113 $(window).on("resize", function () { 114 if ($(window).width() != width || $(window).height() != height) { 115 width = $(window).width(); 116 height = $(window).height(); 117 } 118 }); 119 120 $(".hamburger-close").on("click", function () { 121 _closeAll(); 122 }); 123 124 // CLOSE DROPDOWN WHEN CLICKED IN NAVIGATION-BAR-FOOTER 125 $(".navigation-bar-footer") 126 .on("click", function () { 127 _closeAll(); 128 }) 129 .children() 130 .on("click", function (event) {
131 if (!$(event.target).closest(".navigation-bar-dropdown-menu").length) { 132 // if navigation-bar-item with no href is clicked then prevent closing dropdown 133 if ($(event.target).closest(".navigation-bar-item").length && !$(event.target).attr("href")) { 134 return; 135 } 136 _closeAll(); 137 } 138 }); 139 140 _setActiveItem(); 141});
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.