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 $('label.hamburger').on('click', function() { 70 $('body').toggleClass('nav-open'); 71 }); 72 73 // Pad header on mobile 74 75 setTimeout(function(){ 76 if($(window).width() < 992) { 77 $(".banner-wrap").css({"padding-top" : $(".header-wrap > .nav-wrap").height() + "px"}); 78 } 79 }, 800); 80 81 // Copy login and search to mobile nav 82 var login = $("#member-login").clone(true), 83 search = $("#wsite-header-search-form").clone(true) 84 $("#navmobile .wsite-menu-default").append(login).append(search); 85 86 87 // Menu text alignment 88 if($('.search').is(':empty') || $('.search').css('display') == 'none') { 89 $('.menu').css('text-align', 'center'); 90 } 91 92 // Store category dropdown 93 $('.wsite-com-sidebar').expandableSidebar('sidebar-expanded'); 94 95 // Search filters dropdown 96 $('#wsite-search-sidebar').expandableSidebar('sidebar-expanded'); 97 98 // Init fancybox swipe on mobile 99 if('ontouchstart' in window) { 100 $('body').on('click', 'a.w-fancybox', function() { 101 base._initSwipeGallery(); 102 }); 103 } 104 105 // Init sticky footer 106 if($(window).width() > 992) { 107 base._stickyFooter(); 108 } 109 }, 110 111 _initSwipeGallery: function() { 112 var base = this; 113 114 setTimeout(function(){ 115 var touchGallery = document.getElementsByClassName('fancybox-wrap')[0]; 116 var mc = new Hammer(touchGallery); 117 mc.on("panleft panright", function(ev) { 118 if (ev.type == "panleft") { 119 $("a.fancybox-next").trigger("click"); 120 } else if (ev.type == "panright") { 121 $("a.fancybox-prev").trigger("click"); 122 } 123 base._initSwipeGallery(); 124 }); 125 }, 500); 126 } 127 } 128 129 $(document).ready(function(){ 130 haberdasherController.init(); 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.