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 // Interval loop 17 $.fn.intervalLoop = function(condition, action, duration, limit) { 18 var counter = 0; 19 var looper = setInterval(function(){ 20 if (counter >= limit || $.fn.checkIfElementExists(condition)) { 21 clearInterval(looper); 22 } else { 23 action(); 24 counter++; 25 } 26 }, duration); 27 } 28 29 // Check if element exists 30 $.fn.checkIfElementExists = function(selector) { 31 return $(selector).length; 32 } 33 34 var parisController = { 35 36 init: function(opts) { 37 var base = this; 38 39 // Add classes to elements 40 base._addClasses(); 41 42 setTimeout(function(){ 43 base._checkCartItems(); 44 base._attachEvents(); 45 }, 1000); 46 }, 47 48 _addClasses: function() { 49 var base = this; 50 51 // Add fade in class to nav + logo 52 $('body').addClass('fade-in-nav'); 53 54 $('.header-page').addClass('fade-in'); 55
56 // Add class to nav items with subnav 57 $('.wsite-menu-default').find('li.wsite-menu-item-wrap').each(function(){ 58 var $me = $(this); 59 60 if($me.children('.wsite-menu-wrap').length > 0) { 61 62 $me.addClass('has-submenu'); 63 $('<span class="icon-caret"></span>').insertAfter($me.children('a.wsite-menu-item')); 64 } 65 }); 66 67 // Add class to subnav items with subnav 68 $('.wsite-menu').find('li.wsite-menu-subitem-wrap').each(function(){ 69 var $me = $(this); 70 71 if($me.children('.wsite-menu-wrap').length > 0) { 72 73 $me.addClass('has-submenu'); 74 $('<span class="icon-caret"></span>').insertAfter($me.children('a.wsite-menu-subitem')); 75 } 76 }); 77 78 // Keep subnav open if submenu item is active 79 $('li.wsite-menu-subitem-wrap.wsite-nav-current').parents('.wsite-menu-wrap').addClass('open'); 80 81 // Add placeholder text to inputs 82 $('.wsite-form-sublabel').each(function(){ 83 var sublabel = $(this).text(); 84 $(this).prev('.wsite-form-input').attr('placeholder', sublabel); 85 }); 86 87 // Add fullwidth class to gallery thumbs if less than 6 88 $('.imageGallery').each(function(){ 89 if ($(this).children('div').length <= 6) { 90 $(this).children('div').addClass('fullwidth-mobile'); 91 } 92 }); 93 94 // Initialize sticky nav 95 var stickynav = $('body:not(.wsite-checkout-page):not(.wsite-native-mobile-editor) .paris-header')[0]; 96 var sticky = new Waypoint.Sticky({ 97 element: stickynav 98 }); 99 100 $(window).resize(function() { 101 sticky.destroy(); 102 sticky = new Waypoint.Sticky({ 103 element: stickynav 104 }); 105 }); 106 }, 107 108 _checkCartItems: function() { 109 var base = this; 110 111 if($('#wsite-mini-cart').find('li.wsite-product-item').length > 0) { 112 $('body').addClass('cart-full'); 113 } else { 114 $('body').removeClass('cart-full'); 115 } 116 }, 117 118 _moveLogin: function() { 119 var loginDetach = $('#member-login').detach(); 120 $('.mobile-nav > .wsite-menu-default > li:last-child').after(loginDetach); 121 }, 122 123 _attachEvents: function() { 124 var base = this; 125 126 $('.hamburger').on('click', function(e) { 127 e.preventDefault(); 128 if(!$('body').hasClass('nav-open')) { 129 $('body').addClass('nav-open'); 130 } else { 131 $('body').removeClass('nav-open'); 132 } 133 }); 134 135 // Move cart + login 136 if ($(window).width() <= 992) { 137 $.fn.intervalLoop('.mobile-nav #member-login', base._moveLogin, 800, 5); 138 } 139 140 // Subnav toggle 141 $('li.has-submenu span.icon-caret').on('click', function() { 142 var $me = $(this); 143 144 if($me.siblings('.wsite-menu-wrap').hasClass('open')) { 145 $me.siblings('.wsite-menu-wrap').removeClass('open'); 146 } else { 147 $me.siblings('.wsite-menu-wrap').addClass('open'); 148 } 149 }); 150 151 // Scroll on header page 152 $('#contentArrow').on('click', function() { 153 $('html, body').animate({ 154 scrollTop: $('.main-wrap').offset().top - $('.paris-header').outerHeight() 155 }, 500); 156 }); 157 158 // Store category dropdown 159 $('.wsite-com-sidebar').expandableSidebar('sidebar-expanded'); 160 161 // Search filters dropdown 162 $('#wsite-search-sidebar').expandableSidebar('sidebar-expanded'); 163 164 // Init fancybox swipe on mobile 165 if ('ontouchstart' in window) { 166 $('body').on('click', 'a.w-fancybox', function() { 167 base._initSwipeGallery(); 168 }); 169 } 170 }, 171 172 _initSwipeGallery: function() { 173 var base = this; 174 175 setTimeout(function(){ 176 var touchGallery = document.getElementsByClassName('fancybox-wrap')[0]; 177 var mc = new Hammer(touchGallery); 178 mc.on("panleft panright", function(ev) { 179 if (ev.type == "panleft") { 180 $("a.fancybox-next").trigger("click"); 181 } else if (ev.type == "panright") { 182 $("a.fancybox-prev").trigger("click"); 183 } 184 base._initSwipeGallery(); 185 }); 186 }, 500); 187 } 188 } 189 190 191 $(document).ready(function(){ 192 parisController.init(); 193 }); 194});
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.