1jQuery(function($) { 2 3 // Theme specific scripts 4 var Brisk = { 5 // Anchored + Shrinking header 6 header: function(header) { 7 $(header).waypoint('sticky'); 8 $('body:not(.wsite-native-mobile-editor, .wsite-checkout-page)').waypoint(function() { 9 $(header).toggleClass('minimize'); 10 }, { offset: -5 }); 11 }, 12 // Mobile Accordion 13 accordion: function(menu) { 14 $(menu).each(function(){ 15 var submenu = $(this); 16 submenu.addClass("accordion"); 17 submenu.prepend(submenu.prev("a")); 18 submenu.prepend('<span></span>'); 19 submenu.children('span').click(function(){ 20 submenu.toggleClass('open'); 21 }); 22 }); 23 }, 24 // Mobile Cart 25 cartRefresh: function() { 26 $("#mobile-cart span").text($("#wsite-nav-cart-num").text()); 27 $("#mobile-cart").addClass("highlight"); 28 setTimeout(function(){ 29 $("#mobile-cart").attr("href", $("#wsite-com-minicart-checkout-button").attr("href")).removeClass("highlight"); 30 }, 600); 31 }, 32 cartInit: function() { 33 if ($("#wsite-nav-cart-a").length) { 34 $("#header").append('<a id="mobile-cart" href="#"><span>0</span></a>').addClass("commerce"); 35 Brisk.cartRefresh(); 36 $("#wsite-nav-cart-a").on('DOMSubtreeModified propertychange', function() { 37 Brisk.cartRefresh(); 38 }); 39 } 40 }, 41 // Storefront sidebar dropdown 42 storeSidebar: function(){ 43 var sidebar = $('.wsite-com-sidebar'), 44 categories = $("#wsite-com-hierarchy"); 45 46 sidebar.click(function(){ 47 sidebar.hasClass('sidebar-expanded') ? null : sidebar.addClass('sidebar-expanded'); 48 }); 49 50 categories.prepend('<a id="close" href="#">CLOSE</a>'); 51 $('#close').click(function(e){ 52 e.preventDefault(); 53 setTimeout(function() {sidebar.removeClass('sidebar-expanded');}, 50); 54 }); 55 }, 56 // Form Styling 57 formstyle: function(){ 58 // Sublabels into placeholders 59 $(".wsite-form-sublabel").each(function(){ 60 var sublabel = $(this).text(); 61 $(this).prev('input').attr("placeholder", sublabel); 62 }); 63 }, 64 // Side Swiping Galleries 65 swipeGallery: function(){ 66 setTimeout(function(){ 67 var touchGallery = document.getElementsByClassName("fancybox-wrap")[0]; 68 var mc = new Hammer(touchGallery); 69 mc.on("panleft panright", function(ev) { 70 if (ev.type == "panleft") { 71 $("a.fancybox-next").trigger("click"); 72 } 73 else if (ev.type == "panright") { 74 $("a.fancybox-prev").trigger("click"); 75 } 76 Brisk.swipeGallery(); 77 }); 78 }, 500); 79 }, 80 swipeInit: function(){ 81 if ('ontouchstart' in window) { 82 $("body").on( "click", "a.w-fancybox", function(){ 83 Brisk.swipeGallery(); 84 }); 85 } 86 }, 87 interval: function(condition, action, duration, limit) { 88 var counter = 0; 89 var looper = setInterval(function(){ 90 if (counter >= limit || Brisk.checkElement(condition)) { 91 clearInterval(looper); 92 } else { 93 action(); 94 counter++; 95 } 96 }, duration); 97 }, 98 checkElement: function(selector) { 99 return $(selector).length; 100 }, 101 moveMinicart: function() { 102 var move = $("#wsite-mini-cart").detach(); 103 $("#header-wrap").append(move); 104 }, 105 moveLogin: function() { 106 var login = $('#member-login').clone(true); 107 $("#mobile-nav .wsite-menu-default > li:last-child").after(login); 108 } 109 } 110 111 $(document).ready(function() { 112 $('body').addClass("postload"); 113 $(".hamburger").click(function(){ 114 $("body").toggleClass("menu-open"); 115 116 // $currentScrollPos = $(document).scrollTop(); 117 // if ($("body").hasClass("menu-open")) { 118 // $('body').css({ 119 // 'position': 'fixed' 120 // }); 121 // $('#mobile-nav').css({ 122 // 'height': '100vh' 123 // }); 124 // localStorage.cachedScrollPos = $currentScrollPos; 125 // } 126 // else { 127 // $('body').css({ 128 // 'position': 'relative' 129 // }); 130 // $('#mobile-nav').css({ 131 // 'height': '0' 132 // }); 133 // $('body').scrollTop(localStorage.cachedScrollPos); 134 // } 135 }); 136
137 // Timeout for benefit of iframe editor 138 setTimeout(function(){ 139 Brisk.accordion('#mobile-nav .wsite-menu-item-wrap .wsite-menu-wrap'); 140 Brisk.header('body:not(.wsite-native-mobile-editor, .wsite-checkout-page) #header-wrap'); 141 }, 600); 142 Brisk.formstyle(); 143 Brisk.swipeInit(); 144 Brisk.storeSidebar(); 145 Brisk.interval("#mobile-nav #member-login", Brisk.moveLogin, 500, 10); 146 Brisk.interval("#header #mobile-cart", Brisk.cartInit, 500, 10); 147 }); 148 149});
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.