1jQuery(function($) { 2 3 // Mobile sidebars 4 $.fn.expandableSidebar = function(expandedClass) { 5 var $me = this; 6 7 $me.on('click', function() { 8 if(!$me.hasClass(expandedClass)) { 9 $me.addClass(expandedClass); 10 } else { 11 $me.removeClass(expandedClass); 12 } 13 }); 14 } 15 16 var haberdasherController = { 17 init: function(opts) { 18 var base = this; 19 20 // Add classes to elements 21 base._attachEvents(); 22 23 setTimeout(function(){ 24 base._addClasses(); 25 base._checkCartItems(); 26 }, 1000); 27 }, 28 29 _addClasses: function() { 30 var base = this; 31 32 // Add placeholder text to inputs 33 $('.wsite-form-sublabel').each(function(){ 34 var sublabel = $(this).text(); 35 $(this).prev('.wsite-form-input').attr('placeholder', sublabel); 36 }); 37 38 // Add fullwidth class to gallery thumbs if less than 6 39 $('.imageGallery').each(function(){ 40 if ($(this).children('div').length <= 6) { 41 $(this).children('div').addClass('fullwidth-mobile'); 42 } 43 }); 44 }, 45 46 _stickyFooter: function() { 47 var stickyFooterMargin = $('#footer-wrap').height(); 48 49 $('.wrapper').css('margin-bottom', -stickyFooterMargin); 50 $('#footer-wrap, .sticky-footer-push').css('height', stickyFooterMargin); 51 }, 52 53 _checkCartItems: function() { 54 var base = this; 55 56 if($('#wsite-mini-cart').find('li.wsite-product-item').length > 0) { 57 $('#wsite-mini-cart').addClass('full'); 58 base.cartHasItems = true; 59 } else { 60 $('#wsite-mini-cart').removeClass('full'); 61 base.cartHasItems = false; 62 } 63 }, 64 65 _attachEvents: function() { 66 var base = this; 67 68 69 $('.hamburger').on('click', function(e) { 70 e.preventDefault(); 71 $('body').toggleClass('nav-open'); 72 }); 73 74 // Pad header on mobile 75 76 setTimeout(function(){ 77 if($(window).width() < 992) { 78 $(".banner-wrap").css({"padding-top" : $(".header-wrap > .nav-wrap").height() + "px"}); 79 } 80 }, 800); 81 82 // Copy login and search to mobile nav 83 var login = $("#member-login").clone(true), 84 search = $("#wsite-header-search-form").clone(true) 85 $("#navmobile .wsite-menu-default").append(login).append(search); 86 87 88 // Menu text alignment 89 if($('.search').is(':empty') || $('.search').css('display') == 'none') { 90 $('.menu').css('text-align', 'center'); 91 } 92 93 // Store category dropdown 94 $('.wsite-com-sidebar').expandableSidebar('sidebar-expanded'); 95 96 // Search filters dropdown 97 $('#wsite-search-sidebar').expandableSidebar('sidebar-expanded'); 98 99 // Init fancybox swipe on mobile 100 if('ontouchstart' in window) { 101 $('body').on('click', 'a.w-fancybox', function() { 102 base._initSwipeGallery(); 103 }); 104 } 105 106 // Init sticky footer 107 if($(window).width() > 992) { 108 base._stickyFooter(); 109 } 110 }, 111 112 _initSwipeGallery: function() { 113 var base = this; 114 115 setTimeout(function(){ 116 var touchGallery = document.getElementsByClassName('fancybox-wrap')[0]; 117 var mc = new Hammer(touchGallery); 118 mc.on("panleft panright", function(ev) { 119 if (ev.type == "panleft") { 120 $("a.fancybox-next").trigger("click"); 121 } else if (ev.type == "panright") { 122 $("a.fancybox-prev").trigger("click"); 123 } 124 base._initSwipeGallery(); 125 }); 126 }, 500); 127 } 128 } 129 130 $(document).ready(function(){ 131 haberdasherController.init(); 132 }); 133});
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.