1(function ($) { 2 'use strict'; 3 4 var cix_product_gallery_slider = { 5 6 animation: (wpgs_js_data.slider_animation == 'true') ? true : false, 7 lazyload: wpgs_js_data.slider_lazyload, 8 adaptiveHeight: (wpgs_js_data.slider_adaptiveHeight == 'true') ? true : false, 9 dots: (wpgs_js_data.slider_dots == 'true') ? true : false, 10 rtl: (wpgs_js_data.slider_rtl == 'true') ? true : false, 11 infinity: (wpgs_js_data.slider_infinity == 'true') ? true : false, 12 dragging: (wpgs_js_data.slider_dragging == 'true') ? true : false, 13 nav: (wpgs_js_data.slider_nav == 'true') ? true : false, 14 autoplay: (wpgs_js_data.slider_autoplay == 'true') ? true : false, 15 OnHover: (wpgs_js_data.slider_autoplay_pause_on_hover == 'true') ? true : false, 16 variableWidth: (wpgs_js_data.variableWidth == 1) ? true : false, 17 centerMode: (wpgs_js_data.centerMode == 1) ? true : false, 18 thumb_to_show: parseInt(wpgs_js_data.thumb_to_show), 19 carousel_mode: (wpgs_js_data.carousel_mode == 1) ? true : false, 20 21 tp_horizontal: (wpgs_js_data.thumb_v != 'bottom') ? true : false, 22 tpm_horizontal: (wpgs_js_data.thumb_position_mobile != 'bottom') ? true : false, 23 tpt_horizontal: (wpgs_js_data.thumb_v_tablet != 'bottom') ? true : false, 24 thumbnails_nav: (wpgs_js_data.thumbnails_nav == 1) ? true : false, 25 26 27 slick: function () { 28 29 $('.wpgs-nav').slick({ 30 slidesToShow: cix_product_gallery_slider.thumb_to_show, 31 slidesToScroll: parseInt(wpgs_js_data.thumbnails_mobile_thumb_scroll_by), 32 rtl: cix_product_gallery_slider.rtl, 33 arrows: cix_product_gallery_slider.thumbnails_nav, 34 speed: wpgs_js_data.thumbnail_animation_speed, 35 infinite: cix_product_gallery_slider.infinity, 36 focusOnSelect: (cix_product_gallery_slider.carousel_mode) ? false : true, 37 asNavFor: (wpgs_js_data.carousel_mode != 1) ? '.wpgs-for' : '', 38 variableWidth: cix_product_gallery_slider.variableWidth,// $variableWidth 39 centerMode: cix_product_gallery_slider.centerMode,// $centerMode 40 vertical: cix_product_gallery_slider.tp_horizontal, 41 verticalSwiping: (cix_product_gallery_slider.tp_horizontal) ? true : false, 42 43 responsive: [ 44 45 { 46 breakpoint: 1025, 47 settings: { 48 variableWidth: false, 49 vertical: cix_product_gallery_slider.tpt_horizontal, 50 verticalSwiping: (cix_product_gallery_slider.tpt_horizontal) ? true : false, 51 rtl: cix_product_gallery_slider.rtl, 52 slidesToShow: parseInt(wpgs_js_data.thumbnails_tabs_thumb_to_show), 53 slidesToScroll: parseInt(wpgs_js_data.thumbnails_tabs_thumb_scroll_by), 54 swipeToSlide: true, 55 56 } 57 }, 58 59 { 60 breakpoint: 767, 61 settings: { 62 variableWidth: false, 63 vertical: cix_product_gallery_slider.tpm_horizontal, 64 verticalSwiping: (cix_product_gallery_slider.tpm_horizontal) ? true : false, 65 rtl: cix_product_gallery_slider.rtl, 66 slidesToShow: parseInt(wpgs_js_data.thumbnails_mobile_thumb_to_show), 67 slidesToScroll: parseInt(wpgs_js_data.thumbnails_mobile_thumb_scroll_by), 68 swipeToSlide: true, 69 } 70 } 71 72 ] 73 74 }); 75 if (cix_product_gallery_slider.carousel_mode) { 76 console.log('WPGS: Carousel Mode On'); 77 return; 78 } 79 $('.wpgs-for').slick({ 80 81 fade: cix_product_gallery_slider.animation, 82 asNavFor: '.wpgs-nav', 83 lazyLoad: cix_product_gallery_slider.lazyload, 84 adaptiveHeight: cix_product_gallery_slider.adaptiveHeight, 85 dots: cix_product_gallery_slider.dots, 86 dotsClass: 'slick-dots wpgs-dots', 87 focusOnSelect: false, 88 rtl: cix_product_gallery_slider.rtl, 89 infinite: cix_product_gallery_slider.infinity, 90 draggable: cix_product_gallery_slider.dragging, 91 arrows: cix_product_gallery_slider.nav, 92 prevArrow: '<i class="flaticon-back"></i>', 93 nextArrow: '<i class="flaticon-right-arrow"></i>', 94 speed: wpgs_js_data.slider_animation_speed, 95 autoplay: cix_product_gallery_slider.autoplay, 96 pauseOnHover: cix_product_gallery_slider.OnHover, 97 pauseOnDotsHover: cix_product_gallery_slider.OnHover, 98 autoplaySpeed: wpgs_js_data.slider_autoplay_time, 99 }); 100 101 102 103 }, 104 lightBox: function () { 105 if (typeof $.fn.fancybox == 'function') { 106 $.fancybox.defaults = $.extend(true, {}, $.fancybox.defaults, { 107 108 thumbs: false, 109 afterShow: function (instance, current) { 110 111 current.opts.$orig.closest(".slick-initialized").slick('slickGoTo', parseInt(current.index), true); 112 } 113 114 }); 115 116 var selector = '.wpgs-for .slick-slide:not(.slick-cloned) a'; 117 118 // Skip cloned elements 119 $().fancybox({ 120 selector: selector, 121 backFocus: false, 122 }); 123 124 // Attach custom click event on cloned elements, 125 // trigger click event on corresponding link 126 $(document).on('click', '.slick-cloned a', function (e) { 127 $(selector) 128 .eq(($(e.currentTarget).attr("data-slick-index") || 0) % $(selector).length) 129 .trigger("click.fb-start", { 130 $trigger: $(this) 131 });
132 return false; 133 }); 134 135 } 136 }, 137 lazyLoad: function () { 138 if (wpgs_js_data.slider_lazyload != 'disable') 139 $('.wpgs-for img').each(function () { 140 $(this).removeAttr('srcset'); 141 $(this).removeAttr('sizes'); 142 143 }); 144 }, 145 misc: function () { 146 $('.wpgs-wrapper').hide(); 147 $('.wpgs-wrapper').css("opacity", "1"); 148 $('.wpgs-wrapper').show(); 149 150 // Variation Data 151 152 var get_thumb_first = $(document).find('.gallery_thumbnail_first'); 153 var get_main_first = $(document).find('.woocommerce-product-gallery__image'); 154 get_main_first.find('img').removeAttr('srcset'); 155 156 $('.thumbnail_image').each(function (index) { 157 $(this).on('click', function () { 158 $('.thumbnail_image').removeClass('slick-current'); 159 $(this).addClass('slick-current'); 160 $('.woocommerce-product-gallery__lightbox').css({ "display": "none" }); 161 setTimeout(function () { 162 $('.slick-current .woocommerce-product-gallery__lightbox').css({ "display": "block", "opacity": "1" }); 163 $('.woocommerce-product-gallery__image .woocommerce-product-gallery__lightbox').css({ "display": "block", "opacity": "1" }); 164 }, 400); 165 166 }); 167 }); 168 169 if (wpgs_js_data.zoom == 1) { 170 171 $('.wpgs-for img').each(function () { 172 $(this).wrap("<div class='zoomtoo-container' data-zoom-image=" + $(this).data("large_image") + "></div>"); 173 }); 174 175 if (wpgs_js_data.is_mobile == 1 && wpgs_js_data.mobile_zoom == 'false') { 176 $('.wpgs-for > div').each(function () { 177 $(this).removeClass('zoomtoo-container'); 178 }); 179 } 180 181 // var imgUrl = $(this).data("zoom-image"); 182 if (typeof $.fn.zoom == 'function') { 183 184 $('.zoomtoo-container').zoom({ 185 186 // Set zoom level from 1 to 5. 187 magnify: wpgs_js_data.zoom_level, 188 // Set what triggers the zoom. You can choose mouseover, click, grab, toggle. 189 on: wpgs_js_data.zoom_action, 190 touch: false 191 }); 192 } 193 } 194 195 if (wpgs_js_data.lightbox_icon == 'none' && wpgs_js_data.zoom_action == 'mouseover') { 196 $('.zoomtoo-container').on('click', function () { 197 $(this).next().trigger("click"); 198 }); 199 200 } 201 202 // Remove SRCSET for Thumbanils 203 $('.thumbnail_image img').each(function () { 204 $(this).removeAttr('srcset', 'data-thumb_image'); 205 $(this).removeAttr('data-thumb_image'); 206 $(this).removeAttr('sizes'); 207 $(this).removeAttr('data-large_image'); 208 }); 209 $('.wpgs_image img').each(function () { 210 $(this).removeAttr('srcset'); 211 212 }); 213 214 function ZoomIconApperce() { 215 setTimeout(function () { 216 $('.woocommerce-product-gallery__lightbox').css({ "display": "block", "opacity": "1" }); 217 218 }, 500); 219 220 } 221 222 // On swipe event 223 $('.wpgs-image').on('swipe', function (event, slick, direction) { 224 $('.woocommerce-product-gallery__lightbox').css({ "display": "none" }); 225 ZoomIconApperce(); 226 }); 227 // On edge hit 228 $('.wpgs-image').on('afterChange', function (event, slick, direction) { 229 ZoomIconApperce(); 230 }); 231 $('.wpgs-image').on('click', '.slick-arrow ,.slick-dots', function () { 232 $('.woocommerce-product-gallery__lightbox').css({ "display": "none" }); 233 ZoomIconApperce(); 234 }); 235 $('.wpgs-image').on('init', function (event, slick) { 236 ZoomIconApperce(); 237 }); 238 // if found prettyphoto rel then unbind click 239 $(window).on('load', function () { 240 $("a.woocommerce-product-gallery__lightbox").attr('rel', ''); // remove prettyphoto 241 $("a.woocommerce-product-gallery__lightbox").removeAttr('data-rel'); // remove prettyphoto ("id") 242 $('a.woocommerce-product-gallery__lightbox').unbind('click.prettyphoto'); 243 244 }); 245 246 247 }, 248 resetImages: function (wrapper, parent) { 249 wrapper.find('.woocommerce-product-gallery').remove(); 250 parent.prepend(wpgs_js_data.variation_data[0]); 251 cix_product_gallery_slider.lazyLoad(); 252 cix_product_gallery_slider.slick(); 253 cix_product_gallery_slider.lightBox(); 254 cix_product_gallery_slider.misc(); 255 }, 256 variationImage: function () { 257 258 var variation_form = $('.variations_form'), 259 i = 'input.variation_id', 260 body_wrap = $('body'), 261 wpgs_variation_list = wpgs_js_data.variation_data, 262 DivParent = body_wrap.find('.woocommerce-product-gallery').parent(); 263 variation_form.on('found_variation', function (event, variation) { 264 265 266 if (wpgs_variation_list?.hasOwnProperty(variation.variation_id)) { 267 268 body_wrap.find('.woocommerce-product-gallery').remove();
269 DivParent.prepend(wpgs_variation_list[variation.variation_id]); 270 cix_product_gallery_slider.lazyLoad(); 271 cix_product_gallery_slider.slick(); 272 cix_product_gallery_slider.lightBox(); 273 cix_product_gallery_slider.misc(); 274 275 276 } else { 277 if (wpgs_js_data.additional_ajax_trigger == 'if_have_gallery') { 278 if (variation.wavi_value) { 279 // Set BlockUI on any element 280 body_wrap.find('.woocommerce-product-gallery').block({ 281 message: null, 282 overlayCSS: { 283 cursor: 'none', 284 background: '#fff', 285 opacity: 0.6 286 } 287 }); 288 cix_product_gallery_slider.variationAjax(variation.variation_id, body_wrap, DivParent); 289 } else { 290 291 if (wpgs_js_data.gallery_count > 0 && wpgs_js_data.thumbnails_lightbox != 1) { 292 293 294 $('.woocommerce-product-gallery__image img.zoomImg').attr('src', variation.image.url); 295 $('.wpgs-for').slick('slickGoTo', 0); 296 $('.wpgs-for').slick('refresh'); 297 298 } 299 300 } 301 }else{ 302 cix_product_gallery_slider.variationAjax(variation.variation_id, body_wrap, DivParent); 303 } 304 305 } 306 307 308 }) 309 // On clicking the reset variation button 310 .on('reset_data', function (event) { 311 cix_product_gallery_slider.resetImages(body_wrap, DivParent); 312 313 }); 314 315 }, 316 variationAjax: function ($variation_id, body_wrap, DivParent) { 317 318 $.ajax({ 319 url: wpgs_js_data.ajax_url, 320 type: 'post', 321 data: { 322 action: 'twist_variation_ajax', 323 nonce: wpgs_js_data.ajax_nonce, 324 product_id: wpgs_js_data.product_id, 325 variation_id: $variation_id 326 327 }, 328 329 success: function (res) { 330 331 body_wrap.find('.woocommerce-product-gallery').remove(); 332 DivParent.prepend(res.data.variation_images); 333 cix_product_gallery_slider.lazyLoad(); 334 cix_product_gallery_slider.slick(); 335 cix_product_gallery_slider.lightBox(); 336 cix_product_gallery_slider.misc(); 337 }, 338 error: function () { 339 console.log('Ajax Error: variationAjax'); 340 } 341 }); 342 } 343 344 }; 345 346 window.cix_product_gallery_slider_int = function () { 347 cix_product_gallery_slider.lazyLoad(); 348 cix_product_gallery_slider.slick(); 349 cix_product_gallery_slider.lightBox(); 350 cix_product_gallery_slider.misc(); 351 cix_product_gallery_slider.variationImage(); 352 console.log('WPGS: Initialized'); 353 } 354 355 $(document).ready(function () { 356 cix_product_gallery_slider_int(); 357 358 }); 359 //YITH quick view support 360 $(document).on('qv_loader_stop', function () { 361 cix_product_gallery_slider_int(); 362 }); 363 364 365 366})(jQuery); 367
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.