1jQuery(function($) { 2 3 // Define Theme specific functions 4 var Theme = { 5 // Swiping mobile galleries wwith Hammer.js 6 swipeGallery: function() { 7 setTimeout(function() { 8 var touchGallery = document.getElementsByClassName("fancybox-wrap")[0]; 9 var mc = new Hammer(touchGallery); 10 mc.on("panleft panright", function(ev) { 11 if (ev.type == "panleft") { 12 $("a.fancybox-next").trigger("click"); 13 } else if (ev.type == "panright") { 14 $("a.fancybox-prev").trigger("click"); 15 } 16 Theme.swipeGallery(); 17 }); 18 }, 500); 19 }, 20 swipeInit: function() { 21 if ('ontouchstart' in window) { 22 $("body").on("click", "a.w-fancybox", function() { 23 Theme.swipeGallery(); 24 }); 25 } 26 }, 27 // Toggle class on click 28 toggleClick: function(click, target, classname){ 29 $(click).click(function(){ 30 $(target).toggleClass(classname); 31 }); 32 }, 33 // Mobile Accordion 34 accordion: function(menu) { 35 $(menu).each(function(){ 36 var submenu = $(this); 37 submenu.addClass("accordion"); 38 submenu.prepend(submenu.prev("a")); 39 submenu.children('.wsite-menu').prepend('<li>'); 40 if (submenu.children("a").attr("href")) { 41 var clickable = submenu.children("a").clone(true, true); 42 clickable.appendTo(submenu.children('.wsite-menu').children('li').first()); 43 } 44 $('<span class="expand"></span>').appendTo(submenu.children("a")); 45 submenu.children("a").unbind() 46 submenu.children("a").click(function(e){ 47 e.preventDefault(); 48 submenu.toggleClass('open'); 49 submenu.find('.accordion').removeClass('open'); 50 }); 51 }); 52 }, 53 // Hide minicart better on mobile 54 hideCart: function(container){ 55 if ('ontouchstart' in window) { 56 $(container).on('click touchend mouseenter', function () { 57 $('#wsite-mini-cart').fadeOut("fast"); 58 }); 59 } 60 }, 61 interval: function(condition, action, duration, limit) { 62 var counter = 0; 63 var looper = setInterval(function(){ 64 if (counter >= limit || Theme.checkElement(condition)) { 65 clearInterval(looper); 66 } else { 67 action(); 68 counter++; 69 } 70 }, duration); 71 }, 72 checkElement: function(selector) { 73 return $(selector).length; 74 }, 75 moveCartLink: function() { 76 if ($("#wsite-nav-cart-num").text() != "-") { 77 var cart = $(".wsite-nav-cart").detach(); 78 $("#logo").after(cart); 79 $(".wsite-nav-cart a").on("click touchend mouseenter", function(e) { 80 $("#mobile-input").prop("checked", false); 81 }); 82 } 83 }, 84 moveMinicart: function() { 85 var move = $("#wsite-mini-cart").detach(); 86 $(".row2").append(move); 87 }, 88 moveFlyout: function() { 89 var move = $("#wsite-menus").detach(); 90 $(".row2").append(move); 91 }, 92 moveLogin: function() { 93 var login = $('#member-login').detach(); 94 $("#navmobile .wsite-menu-default > li:last-child").after(login); 95 }, 96 navHeight: function(){ 97 $("#navmobile").css({ "padding-bottom": ($(".row2").outerHeight() + 40) + "px" }); 98 } 99 } 100 101 $(document).ready(function() { 102 $("body").addClass("postload"); 103 Theme.swipeInit(); 104 // Timeout for benefit of iframe editor 105 setTimeout(function(){ 106 Theme.accordion("#navmobile .wsite-menu-wrap"); 107 $("body:not(.wsite-native-mobile-editor, .wsite-checkout-page) #header .row2").waypoint('sticky'); 108 }, 600); 109 Theme.hideCart('#banner, #main, #footer'); 110 Theme.interval(".row2 #wsite-mini-cart", Theme.moveMinicart, 800, 5); 111 Theme.interval(".row2 #wsite-menus", Theme.moveFlyout, 300, 10); 112 Theme.toggleClick(".hamburger", "body", "menu-open"); 113 if ($(window).width() <= 992) { 114 Theme.interval(".row2 .container > .wsite-nav-cart", Theme.moveCartLink, 800, 5); 115 Theme.navHeight(); 116 Theme.toggleClick(".wsite-com-sidebar", ".wsite-com-sidebar", "open"); 117 Theme.toggleClick("#wsite-search-sidebar", "#wsite-search-sidebar", "open"); 118 Theme.interval("#navmobile #member-login", Theme.moveLogin, 800, 5); 119 } 120 }); 121 122});
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.