1jQuery(function($) { 2 3 checkSize(); 4 $(window).resize(checkSize); 5 6 //Function to the css rule 7 function checkSize(){ 8 if ($(".mobile-indicator").is(':visible')){ 9 $(".header-1 #google_translate_element").remove(); 10 11 if($('.floating-arrow').hasClass("expanded")){ 12 $('.floating-arrow').removeClass("expanded"); 13 var floater_height = $('.floater').innerHeight(); 14 $('.floater').css("bottom","-"+floater_height+"px"); 15 } 16 17 } 18 else { 19 var floater_height = $('.floater').innerHeight(); 20 $('.floater').css("bottom", 0); 21 $('.floating-arrow').addClass("expanded"); 22 } 23 } 24 25 $(function(){ 26 $('label.hamburger').click(function(){ 27 if(!$("body").hasClass("nav-open")){ 28 var mobilenav_height = $('.birdseye-header').outerHeight(); 29 $('.mobile-nav').css("top", mobilenav_height+"px"); 30 $('.mobile-nav').css("max-height", "calc(100vh - "+mobilenav_height+"px)"); 31 } else { 32 $('.mobile-nav').css("max-height", "0"); 33 } 34 }); 35 }); 36 37 $(function() { 38 if ($('body').hasClass('g-translate-off')){ 39 $('#google_translate_element').remove(); 40 } 41 42 if ( $('.header-social').children().length <= 0 ) { 43 $(".header-social").remove(); 44 } 45 46 if ( $('.header-search').children().length <= 0 ) { 47 $(".header-search").remove(); 48 } 49 }); 50 51 52 $(function(){ 53 $('.header-search').click(function(){ 54 $('.search-popup').css("display", "block"); 55 }); 56 57 $('.search-close span').click(function(){ 58 $('.search-popup').css("display", "none"); 59 }); 60 }); 61 62 $(function(){ 63 $('.floating-arrow').click(function(){ 64 65 if($(this).hasClass("expanded")){ 66 var floater_height = $('.floater').innerHeight(); 67 $('.floater').css("bottom","-"+floater_height+"px"); 68 $(this).removeClass("expanded"); 69 return false; 70 } 71 else{ 72 var floater_height = $('.floater').innerHeight(); 73 $('.floater').css("bottom", 0); 74 $(this).addClass("expanded"); 75 return false; 76 } 77 }); 78 }); 79 80 // Fixed nav 81 $.fn.checkHeaderPositioning = function(scrollEl, scrollClass) { 82 var $me = $(this); 83 var header_height = $(".nav-wrap").innerHeight(); 84 85 if (!$me.length) { 86 return; 87 } 88 89 if($(scrollEl).scrollTop() >= 45 ) { 90 $me.addClass(scrollClass); 91 } else if($(scrollEl).scrollTop() <= 44 ) { 92 $me.removeClass(scrollClass); 93 } 94 }; 95 96 // Mobile sidebars 97 $.fn.expandableSidebar = function(expandedClass) { 98 var $me = this; 99 100 $me.on('click', function() { 101 if(!$me.hasClass(expandedClass)) { 102 $me.addClass(expandedClass); 103 } else { 104 $me.removeClass(expandedClass); 105 } 106 }); 107 } 108 109 // Interval loop 110 $.fn.intervalLoop = function(condition, action, duration, limit) { 111 var counter = 0; 112 var looper = setInterval(function(){ 113 if (counter >= limit || $.fn.checkIfElementExists(condition)) { 114 clearInterval(looper); 115 } else { 116 action(); 117 counter++; 118 } 119 }, duration); 120 } 121 122 // Check if element exists 123 $.fn.checkIfElementExists = function(selector) { 124 return $(selector).length; 125 } 126 127 var birdseyeController = { 128 init: function(opts) { 129 var base = this; 130 131 $('body').checkHeaderPositioning(window, 'affix'); 132 133 // Add classes to elements 134 base._addClasses(); 135 136 if(!$('body').hasClass('wsite-editor') && $('#wsite-nav-cart-a').length) { 137 $('#wsite-nav-cart-a').html($('#wsite-nav-cart-a').html().replace(/[()]/g, '')); 138 } 139 140 setTimeout(function(){ 141 base._checkCartItems(); 142 base._attachEvents(); 143 if($('#wsite-nav-cart-a').length) { 144 $('#wsite-nav-cart-a').html($('#wsite-nav-cart-a').html().replace(/[()]/g, '')); 145 } 146 }, 1000); 147 }, 148 149 _addClasses: function() { 150 var base = this; 151 152 // Add fade in class to nav + logo + banner 153 $('body').addClass('fade-in'); 154
155 // Add class to nav items with subnav 156 $('.wsite-menu-default').find('li.wsite-menu-item-wrap').each(function(){ 157 var $me = $(this); 158 159 if($me.children('.wsite-menu-wrap').length > 0) { 160 $me.addClass('has-submenu'); 161 $('<span class="icon-caret"></span>').insertAfter($me.children('a.wsite-menu-item')); 162 } 163 }); 164 165 // Add class to subnav items with subnav 166 $('.wsite-menu').find('li.wsite-menu-subitem-wrap').each(function(){ 167 var $me = $(this); 168 169 if($me.children('.wsite-menu-wrap').length > 0) { 170 $me.addClass('has-submenu'); 171 $('<span class="icon-caret"></span>').insertAfter($me.children('a.wsite-menu-subitem')); 172 } 173 }); 174 175 // Keep subnav open if submenu item is active 176 if ($(window).width() < 1024) { 177 $('li.wsite-menu-subitem-wrap.wsite-nav-current').parents('.wsite-menu-wrap').addClass('open'); 178 } 179 180 // Add placeholder text to inputs 181 $('.wsite-form-sublabel').each(function(){ 182 var sublabel = $(this).text(); 183 $(this).prev('.wsite-form-input').attr('placeholder', sublabel); 184 }); 185 }, 186 187 _checkCartItems: function() { 188 var base = this; 189 if($('#wsite-mini-cart').find('li.wsite-product-item').length > 0) { 190 $('body').addClass('cart-full'); 191 } else { 192 $('body').removeClass('cart-full'); 193 } 194 }, 195 196 _moveLogin: function() { 197 var loginDetach = $('#member-login').detach(); 198 $('.mobile-nav .wsite-menu-default > li:last-child').after(loginDetach); 199 }, 200 201 _moveFlyout: function() { 202 var maxheight = $(window).height() - $('.birdseye-header').outerHeight(); 203 var anchor = true; 204 205 $('#wsite-menus .wsite-menu-wrap').each(function() { 206 if ($(this).outerHeight() > maxheight) { 207 anchor = false; 208 } 209 }); 210 211 if (anchor) { 212 var move = $("#wsite-menus").detach(); 213 $(".birdseye-header").append(move); 214 } 215 }, 216 217 _moveCart: function() { 218 var move = $("#wsite-mini-cart").detach(); 219 $(".birdseye-header").append(move); 220 }, 221 222 _attachEvents: function() { 223 var base = this; 224 225 $('label.hamburger').on('click', function() { 226 if (!$('body').hasClass('nav-open')) { 227 $('body').addClass('nav-open'); 228 } else { 229 $('body').removeClass('nav-open'); 230 } 231 }); 232 233 // Move cart + login 234 if ($(window).width() <= 992) { 235 $.fn.intervalLoop('.mobile-nav #member-login', base._moveLogin, 800, 5); 236 } 237 238 // Move Flyout 239 $.fn.intervalLoop('.birdseye-header #wsite-menus', base._moveFlyout, 300, 8); 240 241 // Move Cart 242 $.fn.intervalLoop('.birdseye-header #wsite-mini-cart', base._moveCart, 300, 8); 243 244 // Check Cart 245 246 $.fn.intervalLoop('body.cart-full', base._checkCartItems, 300, 10); 247 248 // Window scroll 249 250 // Fixed header 251 $(window).on('scroll', function() { 252 $('body').checkHeaderPositioning(window, 'affix'); 253 }); 254 255 // Subnav toggle 256 $('li.has-submenu span.icon-caret').on('click', function() { 257 var $me = $(this); 258 259 if($me.siblings('.wsite-menu-wrap').hasClass('open')) { 260 $me.siblings('.wsite-menu-wrap').removeClass('open'); 261 } else { 262 $me.siblings('.wsite-menu-wrap').addClass('open'); 263 } 264 }); 265 266 // Store category dropdown 267 $('.wsite-com-sidebar').expandableSidebar('sidebar-expanded'); 268 269 // Search filters dropdown 270 $('#wsite-search-sidebar').expandableSidebar('sidebar-expanded'); 271 272 // Init fancybox swipe on mobile 273 if ('ontouchstart' in window) { 274 $('body').on('click', 'a.w-fancybox', function() { 275 base._initSwipeGallery(); 276 }); 277 } 278 }, 279 280 _initSwipeGallery: function() { 281 var base = this; 282 283 setTimeout(function(){ 284 var touchGallery = document.getElementsByClassName('fancybox-wrap')[0]; 285 var mc = new Hammer(touchGallery); 286 mc.on("panleft panright", function(ev) { 287 if (ev.type == "panleft") { 288 $("a.fancybox-next").trigger("click"); 289 } else if (ev.type == "panright") { 290 $("a.fancybox-prev").trigger("click"); 291 } 292 base._initSwipeGallery(); 293 }); 294 }, 500); 295 } 296 } 297 298 $(document).ready(function(){ 299 birdseyeController.init(); 300 }); 301});
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.