1(function( $ ) { 2 'use strict'; 3 4$( document ).ready(function() { 5 6 // Check if have Fancybox 7 if (typeof $.fn.fancybox == 'function') { 8 // Customize icons 9 $.fancybox.defaults = $.extend(true, {}, $.fancybox.defaults, { 10 btnTpl: { 11 12 // Arrows 13 arrowLeft: '<button data-fancybox-prev class="fancybox-button fancybox-button--arrow fancybox-button--arrow_left" title="{{PREV}}">' + 14 '<span class="arrow-prev"></span>' + 15 "</button>", 16 17 arrowRight: '<button data-fancybox-next class="fancybox-button fancybox-button--arrow fancybox-button--arrow_right" title="{{NEXT}}">' + 18 '<span class="arrow-next"></span>' + 19 "</button>", 20 21 22 }, 23 thumbs: { 24 autoStart: false, // Display thumbnails on opening 25 hideOnClose: true, // Hide thumbnail grid when closing animation starts 26 parentEl: ".fancybox-container", // Container is injected into this element 27 axis: "y" // Vertical (y) or horizontal (x) scrolling 28 }, 29 }); 30 31 32 var selector = '.wpgs-wrapper .slick-slide:not(.slick-cloned) a'; 33 34 // Skip cloned elements 35 $().fancybox({ 36 selector: selector, 37 backFocus: false 38 }); 39 40 // Attach custom click event on cloned elements, 41 // trigger click event on corresponding link 42 $(document).on('click', '.wpgs-wrapper .slick-cloned a', function (e) { 43 $(selector) 44 .eq(($(e.currentTarget).attr("data-slick-index") || 0) % $(selector).length) 45 .trigger("click.fb-start", { 46 $trigger: $(this) 47 }); 48 49 return false; 50 }); 51 52 } 53 54 // Variation Data 55 56 var get_thumb_first = $(document).find('.gallery_thumbnail_first'); 57 var get_main_first = $(document).find('.woocommerce-product-gallery__image'); 58 59 jQuery('.variations_form').each(function () { 60 jQuery(this).on('show_variation', function (event, variation) { 61 var thumb_src = variation.image.gallery_thumbnail_src, 62 lightbox_image = get_main_first.find('img').attr("data-large_image"), 63 first_thumb_src = get_main_first.find('img').attr("data-thumb_image"); 64 get_thumb_first.find('img').attr('src', thumb_src); 65 get_main_first.find('img').removeAttr('srcset'); 66 get_main_first.find('a.woocommerce-product-gallery__lightbox').attr('href', lightbox_image); 67 68 69 }); 70 }); 71 72 $('.thumbnail_image').each(function (index) { 73 $(this).on('click', function () { 74 $('.thumbnail_image').removeClass('slick-current'); 75 $(this).addClass('slick-current'); 76 $('.woocommerce-product-gallery__lightbox').css({ "display": "none" }); 77 setTimeout(function () { 78 $('.slick-current .woocommerce-product-gallery__lightbox').css({ "display": "block", "opacity": "1" }); 79 $('.woocommerce-product-gallery__image .woocommerce-product-gallery__lightbox').css({ "display": "block", "opacity": "1" }); 80 }, 400); 81 82 }); 83 }); 84 85 // Reset Slider location to '0' when variation change 86 $('.woocommerce-product-gallery__image .img-attr').load(function () { 87 $('.wpgs-image').slick('slickGoTo', 0); 88 89 }); 90 // Remove SRCSET for Thumbanils 91 $('.wpgs-thumb img').each(function () { 92 $(this).removeAttr('srcset','data-thumb_image'); 93 $(this).removeAttr('data-thumb_image'); 94 $(this).removeAttr('sizes'); 95 $(this).removeAttr('data-large_image'); 96 }); 97 98 function ZoomIconApperce(){ 99 setTimeout(function () { 100 $('.slick-current .woocommerce-product-gallery__lightbox').css({ "display": "block", "opacity": "1" }); 101 $('.woocommerce-product-gallery__image .woocommerce-product-gallery__lightbox').css({ "display": "block", "opacity": "1" }); 102 }, 400); 103 } 104 105 // On swipe event 106 $('.wpgs-image').on('swipe', function (event, slick, direction) { 107 $('.woocommerce-product-gallery__lightbox').css({ "display": "none" }); 108 ZoomIconApperce(); 109 }); 110 // On edge hit 111 $('.wpgs-image').on('afterChange', function (event, slick, direction) { 112 ZoomIconApperce(); 113 }); 114 $('.wpgs-image').on('click', '.slick-arrow ,.slick-dots', function () { 115 $('.woocommerce-product-gallery__lightbox').css({ "display": "none"}); 116 ZoomIconApperce(); 117 }); 118 119 120 121 122 123}); 124 125 126})(jQuery); 127
128// Other code using $ as an alias to the other library
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.