1(function ($) { 2 'use strict'; 3 // jQuery document ready 4 $(function () { 5 6 7 // Image lazy load 8 $('img.lazyload').lazyload( 9 { 10 effect: 'fadeIn' 11 } 12 ); 13 14 // smart menus from library 15 $($.SmartMenus.Bootstrap.init); 16 17 // V6 fileupload 18 $('.file-upload-input').on('change', function () { 19 var $this = $(this); 20 var file_name = $this.val().replace(/\\/g, '/').replace(/.*\//, ''); 21 $this.closest('.file-upload-control').find('.file-upload-name').val(file_name); 22 }); 23 24 //checkout page summary stick, from library 25 $(".side-col").stick_in_parent(); 26 27 var owlOptions = { 28 margin:30, 29 loop:false, 30 nav:true, 31 dots:false, 32 navText:['<i class="fa fa-fw fa-angle-left"></i>','<i class="fa fa-fw fa-angle-right"></i>'], 33 autoHeight:true, 34 responsive:{ 35 0:{ 36 items:1 37 }, 38 430:{ 39 items:2 40 }, 41 768:{ 42 items:3 43 }, 44 992:{ 45 items:4 46 } 47 } 48 }; 49 //suggested products area 50 if ($('body').hasClass('pageType_product')) { 51 var suggestedOwl = $('.suggested-products').owlCarousel(owlOptions); 52 suggestedOwl.on('mousewheel', '.owl-stage', function (e) { 53 if (e.deltaY>0) { 54 suggestedOwl.trigger('next.owl'); 55 } else { 56 suggestedOwl.trigger('prev.owl'); 57 } 58 e.preventDefault(); 59 }); 60 } 61 //featured 62 if ($('body').hasClass('pageType_category')) { 63 var featuredOwl = $('.featured-products-carousel').owlCarousel(owlOptions); 64 featuredOwl.on('mousewheel', '.owl-stage', function (e) { 65 if (e.deltaY>0) { 66 featuredOwl.trigger('next.owl'); 67 } else { 68 featuredOwl.trigger('prev.owl'); 69 } 70 e.preventDefault(); 71 }); 72 } 73 74 //setup search 75 prsearch("sidebar-search", "sidebar-search-input", "sidebar-search-button"); 76 77 //Product Image Gallery 78 if ($('body').hasClass('pageType_product')) { 79 //get all gallery items 80 window.galleryItems = []; 81 window.isSingleImage = true; 82 83 //init photoswipe 84 var initPhotoswipe = function () { 85 var $pswp = $('<div class="pswp" tabindex="-1" role="dialog" aria-hidden="true"><div class="pswp__bg"></div><div class="pswp__scroll-wrap"><div class="pswp__container"><div class="pswp__item"></div><div class="pswp__item"></div><div class="pswp__item"></div></div><div class="pswp__ui pswp__ui--hidden"><div class="pswp__top-bar"><div class="pswp__counter"></div><a class="pswp__button pswp__button--close" title="Close (Esc)"></a> <a class="pswp__button pswp__button--share" title="Share"></a> <a class="pswp__button pswp__button--fs" title="Toggle fullscreen"></a> <a class="pswp__button pswp__button--zoom" title="Zoom in/out"></a><div class="pswp__preloader"><div class="pswp__preloader__icn"><div class="pswp__preloader__cut"><div class="pswp__preloader__donut"></div></div></div></div></div><div class="pswp__share-modal pswp__share-modal--hidden pswp__single-tap"><div class="pswp__share-tooltip"></div></div><a class="pswp__button pswp__button--arrow--left" title="Previous (arrow left)"></a> <a class="pswp__button pswp__button--arrow--right" title="Next (arrow right)"></a><div class="pswp__caption"><div class="pswp__caption__center"></div></div></div></div></div>') 86 .appendTo('body'); 87 window.pswp = $pswp[0]; 88 }; 89 initPhotoswipe(); 90 91 var openPhotoswipe = function (index) { 92 var options = { 93 bgOpacity: .5, 94 index: index, 95 history:false 96 } 97 var gallery = new PhotoSwipe(window.pswp, PhotoSwipeUI_Default, window.galleryItems, options); 98 gallery.init(); 99 }; 100 101 var $desktopGallery = $('.product-image-gallery.desktop'); 102 var $mobileGallery = $('.product-image-gallery.mobile'); 103 104 //**** Desktop Gallery **** 105 //desktop gallery always on page 106 var $desktopCarousel = $('.product-gallery-carousel',$desktopGallery); 107 var $desktopPrimaryImageLink = $('.product-gallery-primary > a',$desktopGallery); 108 var $desktopPrimaryImage = $desktopPrimaryImageLink.find('img'); 109
110 if ($desktopCarousel.length) { 111 window.isSingleImage = false; 112 } 113 114 //fetch gallery data 115 if(!window.isSingleImage){ 116 var $desktopCarouselLinkItems = $desktopCarousel.find('.product-gallery-carousel-item > a'); 117 $desktopCarouselLinkItems.each(function () { 118 window.galleryItems.push({ 119 src: $(this).attr('href'), 120 msrc: $(this).data('src'), 121 w: $(this).data('width'), 122 h: $(this).data('height') 123 }); 124 }); 125 } 126 else{ 127 window.galleryItems.push({ 128 src: $desktopPrimaryImageLink.attr('href'), 129 msrc: $desktopPrimaryImageLink.find('img').attr('src'), 130 w: $desktopPrimaryImageLink.data('width'), 131 h: $desktopPrimaryImageLink.data('height') 132 }); 133 $desktopPrimaryImageLink.data('index',0); 134 } 135 136 //init desktop carousel 137 $desktopCarousel.owlCarousel({ 138 margin: 20, 139 dots: false, 140 nav: true, 141 navText: ['<i class="fa fa-angle-left" aria-hidden="true"></i>', '<i class="fa fa-angle-right" aria-hidden="true"></i>'], 142 autoHeight: true, 143 lazyLoad: true, 144 navElement: 'a', 145 responsive: { 146 0: { 147 items: 5, 148 slideBy:5 149 }, 150 992: { 151 items: 4, 152 slideBy:4 153 }, 154 1200: { 155 items: 5, 156 slideBy:5 157 } 158 } 159 }); 160 $desktopCarousel.on('loaded.owl.lazy', function (e) { 161 $(e.element).closest('.product-gallery-carousel-item').addClass('loaded'); 162 }); 163 164 var changeCurrentImage = function (index) { 165 //switch primary image 166 $desktopPrimaryImageLink.data('index', index); 167 $desktopPrimaryImageLink.attr('href', window.galleryItems[index].src); 168 $desktopPrimaryImage.attr('src', window.galleryItems[index].msrc); 169 170 if(!window.isSingleImage) 171 { 172 //set desktop carousel active item 173 $desktopCarouselLinkItems.removeClass('gallery-current'); 174 $desktopCarouselLinkItems.eq(index).addClass('gallery-current'); 175 } 176 }; 177 changeCurrentImage(0); 178 179 //carousel item click event 180 $desktopCarousel.on('click','.owl-item', function (e) { 181 e.preventDefault(); 182 var index = $(this).index(); 183 changeCurrentImage(index); 184 }); 185 186 //primary image click event 187 $desktopPrimaryImageLink.on('click', function (e) { 188 e.preventDefault(); 189 var index = $(this).data('index'); 190 openPhotoswipe(index); 191 }); 192 193 //**** Mobile Gallery **** 194 if($mobileGallery.length){ 195 if(!window.isSingleImage){ 196 var $mobileCarousel = $('.product-gallery-carousel',$mobileGallery); 197 $mobileCarousel.owlCarousel({ 198 margin: 20, 199 dots: false, 200 nav: true, 201 navText: ['<i class="fa fa-angle-left" aria-hidden="true"></i>', '<i class="fa fa-angle-right" aria-hidden="true"></i>'], 202 autoHeight: true, 203 lazyLoad: true, 204 navElement: 'a', 205 responsive: { 206 0: { 207 items: 1, 208 slideBy:1 209 } 210 , 211 768:{ 212 items: 2, 213 slideBy:2 214 } 215 } 216 }); 217 $mobileCarousel.on('loaded.owl.lazy', function (e) { 218 $(e.element).closest('.product-gallery-carousel-item').addClass('loaded'); 219 }); 220 $mobileCarousel.on("click", ".owl-item", function(e){ 221 e.preventDefault(); 222 var index = $(this).index(); 223 openPhotoswipe(index); 224 }); 225 } 226 else{ 227 var $mobilePrimaryImageLink = $('.product-gallery-primary > a',$mobileGallery); 228 $mobilePrimaryImageLink.on('click', function (e) { 229 e.preventDefault(); 230 openPhotoswipe(0); 231 }); 232 } 233 } 234 } 235 236 //Category page product filter 237 if ($("body").hasClass("pageType_category")) { 238 $(".product-filter").productFilter({ 239 onNoData: function($filterEl) { 240 $filterEl.closest('.sidebar-panel').hide() 241 }, 242 onLoadFailed: function($filterEl) { 243 $filterEl.closest('.sidebar-panel').hide() 244 } 245 }); 246 } 247 }); 248})(jQuery);
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.