1$(document).ready(function () { 2 addSearchbarHandlers(); 3 addNavHeaderHandlers(); 4}); 5 6function addNavHeaderHandlers() { 7 var categoryLink = $('.sub-nav-multi__link'); 8 9 categoryLink.click(function (event) { 10 var category = $(this).data('category'); 11 closePrevious(category); 12 navItemAction(category); 13 }); 14} 15 16function addSearchbarHandlers() { 17 var searchContainer = $('.l-header__search_container'); 18 var searchTrigger = $('.l-header-search__trigger'); 19 20 searchTrigger.click(function (event) { 21 if (searchContainer.hasClass('active')) { 22 searchContainer.removeClass('active'); 23 24 searchContainer.animate({ height: 0 }, { 25 duration: 500, 26 complete: function () { 27 searchContainer.css('overflow', 'hidden'); 28 } 29 }); 30 31 searchContainer.css('overflow', 'hidden'); 32 33 return; 34 } 35 36 searchContainer.addClass('active'); 37 searchContainer.animate({ height: 70 }, { 38 duration: 500, 39 complete: function () { 40 searchContainer.css('overflow', 'visible'); 41 } 42 }); 43 $('#product-search').focus(); 44 }); 45} 46 47let displayRemainingCategories = (parent) => { 48 document.querySelectorAll(`#menuHoverProd-${parent} .hidden`).forEach(el => { 49 el.classList.remove("hidden"); 50 }); 51 document.querySelector(`#menuHoverProd-${parent} .view-all`).style.display = 'none'; 52} 53 54let closePrevious = (category) => { 55 const previouslyClicked = getPreviouslyClicked(); 56 if (previouslyClicked != category) { 57 setPreviouslyClicked(category); 58 navItemAction(previouslyClicked); 59 } else { 60 clearPreviouslyClicked(); 61 } 62} 63 64let navItemAction = (category) => { 65 let subNav = $('.sub-sub-nav-multi__items[data-parent="' + category + '"]'); 66 67 if (subNav.hasClass('active')) { 68 subNav.removeClass('active'); 69 $(this).removeClass('active'); 70 subNav.animate({ height: 0 }, 500); 71 72 return; 73 } 74 subNav.addClass('active'); 75 $(this).addClass('active'); 76 // get the height of the subnav 77 let height = 0; 78 subNav.children().each(function () { 79 height += $(this).outerHeight(); 80 }); 81 82 subNav.animate({ height: height }, 500); 83} 84 85let setPreviouslyClicked = (category) => { 86 let linkWrapper = $('.category-id-47 .sub-nav-multi--full-width'); 87 linkWrapper.attr("data-previous", category) 88} 89let getPreviouslyClicked = () => { 90 let linkWrapper = $('.category-id-47 .sub-nav-multi--full-width'); 91 return linkWrapper.attr("data-previous"); 92} 93let clearPreviouslyClicked = () => { 94 let linkWrapper = $('.category-id-47 .sub-nav-multi--full-width'); 95 if (linkWrapper.attr("data-previous")) { 96 linkWrapper.removeAttr("data-previous"); 97 } 98} 99 100let setAddToCartState = () => {
101 let checkOptions = areAllOptionsChecked(); 102 if (checkOptions) { 103 $('#quick-order-addtocart').css({ display: "inline-block" }); 104 $('.quickorder-alert').css({ display: "none" }); 105 } else { 106 $('#quick-order-addtocart').css({ display: "none" }); 107 } 108} 109 110function areAllOptionsChecked() { 111 var checked = true; 112 $('.quickorder-options').each(function (i, obj) { 113 if ($(obj).val() == $($(obj).find('option')[0]).val()) { 114 checked = false; 115 } 116 }); 117 if ($('.quickorder-options').length = 0) { 118 checked = false; 119 } 120 return checked; 121} 122 123function quickorderInputListener() { 124 $('#quickorder-body').on('change', function () { 125 setTimeout(function () { 126 if ($('.quickorder-options').length >= 1) { 127 $('#quick-order-addtocart').css({ display: "none" }); 128 $('.quickorder-alert').css({ display: "flex" }); 129 } 130 }, 300) 131 }); 132}
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.