1jQuery( function($) { 2 "use strict"; 3 4/* Set VH (iPhone hack) */ 5 function setVH() { 6 var vh = 0.01*window.innerHeight, 7 vhVal = vh + 'px'; 8 document.documentElement.style.setProperty('--vh', vhVal); 9 } 10 11 setVH(); 12 13/* Menu overlay */ 14 var removeMenuOverlay = function() { 15 $('.mini-cart-overlay').removeClass('active'); 16 $('.mini-cart-overlay').removeClass('active-overlay'); 17 18 $( '.menu-overlay' ).removeClass( 'on' ); 19 $( '.search-bar' ).removeClass( 'on' ); 20 $( '.mini-cart-panel' ).removeClass( 'active' ); 21 22 $( '.menu-overlay .sub-menu' ).removeClass( 'active' ); 23 $( 'html' ).css( 'overflow', 'auto' ); 24 } 25 26 $( '.site-header' ).on( 'click', '.menu-bttn', function(e) { 27 e.preventDefault(); 28 29 $('.mini-cart-overlay').addClass( 'active-overlay' ); 30 $( '.menu-overlay' ).addClass( 'on' ); 31 $( 'html' ).css( 'overflow', 'hidden' ); 32 33 } ); 34 35 $( '.menu-overlay' ).on( 'click', '.close-menu-bttn', function(e) { 36 e.preventDefault(); 37 removeMenuOverlay(); 38 } ); 39/* Search bar */ 40 $( '.site-header' ).on( 'click', '.search-bttn', function() { 41 $( '.site-header' ).find( '.search-bar' ).addClass( 'on' ); 42 $('.mini-cart-overlay').addClass( 'active' ); 43 } ); 44 45 $( '.search-bar' ).on( 'click', '.close-bttn', function(e) { 46 e.preventDefault(); 47 removeMenuOverlay(); 48 } ); 49// Remove menu overlay on hitting the Esc key 50 $(document).on( 'keyup', function(e) { 51 if ( ( 27 === e.keyCode ) ) { 52 removeMenuOverlay(); 53 } 54 }); 55// Remove menu overlay on hitting the outside 56 $( '.mini-cart-overlay' ).on( 'click', function(e) { 57 removeMenuOverlay(); 58 }); 59/* Subpages menu */ 60 $( '.subpage-nav' ).on( 'click', '.subpages-trigger', function(e) { 61 if ( 'none' !== $(this).find( '.subpages-menu-bttn' ).css( 'display' ) ) { 62 e.preventDefault(); 63 e.stopImmediatePropagation(); 64 65 $(this).find( '.subpages-menu-bttn' ).toggleClass( 'on' ); 66 $(this).next( 'nav' ).slideToggle(200).toggleClass( 'active' ); 67 } 68 } ); 69/* Sticky header bar on scroll */ 70 var previousScroll = 0; 71 72 $(window).on( 'scroll', function () { 73 var currentScroll = $(this).scrollTop(); 74 75 if ( currentScroll > 50 ) { 76 if ( currentScroll > previousScroll ) { 77 // Scrolling Down 78 if ( currentScroll > 50 ) { 79 // if ( currentScroll > 0 ) { 80 $( '.site-header' ).addClass( 'fixed' ); 81 $( '.site-header' ).removeClass( 'show' ); 82 } 83 84 } else { 85 // Scrolling Up 86 $( '.site-header' ).addClass( 'show' ); 87 $( '.site-header' ).addClass( 'trans' ); 88 } 89 90 } else { 91 $( '.site-header' ).removeClass( 'trans' ); 92 } 93 94 if ( 0 === currentScroll ) { 95 $( '.site-header' ).removeClass( 'fixed' ); 96 } 97 98 previousScroll = currentScroll; 99 }); 100 101/* Accordion */ 102 $.fn.mwaAccordion = function() { 103 var accordion = $(this), 104 icons = $(this).find( '.icon' ), 105 iconClr = icons.attr( 'data-clr' ), 106 iconClrHover = icons.attr( 'data-clr-hover' ); 107 108 accordion.on( 'click', '.tab', function(el) { 109 $(this).toggleClass('open'); 110 $(this).next( '.content' ).slideToggle(200); 111 $(this).find( '.icon' ).toggleClass( iconClr ).toggleClass( iconClrHover ); 112 } ); 113 } 114 115 $( '.mwa-accordion' ).mwaAccordion(); 116 $( '.mwa-accordion:not(.mwa-accordion--first-closed) .panel:first-child .tab' ).addClass('open'); 117 $( '.mwa-accordion:not(.mwa-accordion--first-closed) .panel:first-child .content' ).show(); 118 119/* Tabs */ 120 $.fn.mwaTabs = function() { 121 var tabs = $(this); 122 123 tabs.on( 'click', '.label', function() { 124 tabs.find( '.label' ).removeClass( 'active' ); 125 $(this).toggleClass( 'active' ); 126 var ord = $(this).attr( 'tab-header' ); 127 var panel = tabs.find( '.panel[ tab-content = '+ord+' ]' ); 128 tabs.find( '.panel' ).slideUp(); 129 panel.slideToggle(); 130 } ); 131 } 132 133 $( '.mwa-tabs' ).each( function(i, el) { 134 $(el).mwaTabs(); 135 } ); 136 137/* Before-After */ 138 $.fn.mwaBeforeAfter = function() { 139 var bf = $(this); 140 var bfLabels = bf.find( '.before-label, .after-label' ); 141 var bfBttn = bf.find( '.before-after-bttn' ); 142 143 bfLabels.css( 'max-width', 0.5*bf.width() ); 144 145 bf.find( '.before-after-range' ).on( 'input change', function(e) { 146 var sliderPos = e.target.value; 147 148 bf.find( '.content-before' ).css( 'width', sliderPos+'%' ); 149 bfBttn.css( 'left', 'calc('+sliderPos+'% - '+0.5*bfBttn.width()+'px)' ); 150 }); 151 152 $(window).on('resize', function(e) { 153 bfLabels.css( 'max-width', 0.5*bf.width() ); 154 }); 155 } 156 157 $( '.mwa-before-after' ).each( function(i, el) { 158 $(el).mwaBeforeAfter(); 159 } ); 160 161/* Add custom spinner to GF forms */ 162 $( 'body' ).on( 'click', '.gform_wrapper .gform_footer .gform_button', function() { 163 $(this).closest('.gform_footer').addClass( 'processing' ); 164 } ); 165} );
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.