1(function ($) { 2 $(function () { 3 $(document.body).on('click', '.product .quick-view-button, .product-quick-view-navigation a', function (e) { 4 e.preventDefault(); 5 var $button = $(this); 6 $.fancybox.close(); 7 $.fancybox.open({ 8 type: 'ajax', 9 src: thegem_woo_data.ajax_url, 10 autoFocus: false, 11 ajax: { 12 settings: { 13 method: 'POST', 14 data: { 15 ajax_nonce: thegem_woo_data.ajax_nonce, 16 action: 'thegem_product_quick_view', 17 product_id: $(this).data('product-id') 18 } 19 } 20 }, 21 slideClass: 'woo-modal-product', 22 baseClass: "product-quick-view product-quick-view__wrapper", 23 afterShow: function (el) { 24 var quickViewGalleryType = $('.product-quick-view .single-product').attr("data-quick-view"); 25 var quickViewLayoutType = $('.product-quick-view .single-product-content ').attr("data-layout"); 26 27 $('.product-quick-view .gem-attribute-selector').gemWooAttributeSelector(); 28 29 if (quickViewLayoutType !== 'legacy') { 30 el.current.$content.initProductQuickViewScripts(); 31 } 32 33 if (quickViewGalleryType === 'legacy'){ 34 legacyQuickViewGallery(el); 35 } else { 36 defaultQuickViewGallery(el); 37 } 38 } 39 }, { 40 spinnerTpl: '<div class="gem-fancybox-preloader"><div class="preloader-spin"></div></div>', 41 caption: '<div class="product-navigation-caption"></div>', 42 touch: false, 43 backFocus: false, 44 locked: false, 45 }); 46 }); 47 48 function defaultQuickViewGallery(el) { 49 $('.gem-combobox').combobox(); 50 el.current.$content.buildQuickViewGallery(); 51 el.current.$content.updateProductGalleries(); 52 $('.variations_form', el.current.$content).each(function () { 53 var $form = $(this); 54 $form.on('reset_image show_variation', function () { 55 el.removeEvents(); 56 window.setTimeout(function () { 57 el.addEvents(); 58 }, 100); 59 }); 60 $form.on('show_variation', function (e, variation) { 61 if(variation.image_id) { 62 var $product_content = $(this).closest('.single-product-content'); 63 var $gallery = $product_content.find('.product-gallery').eq(0); 64 var $mainCarousel = $gallery.find('.product-gallery-slider'); 65 if($gallery.length) { 66 var $gallery_item = $gallery.find('.product-gallery-slider .product-gallery-slider-item[data-image-id="'+variation.image_id+'"]').parent('.owl-item').index(); 67 $mainCarousel.trigger('to.owl.carousel', [$gallery_item, 300, true]); 68 } 69 } 70 }); 71 $form.wc_variation_form(); 72 $form.on('change', '.variations select', function (event) { 73 var $text = $(this).closest('.combobox-wrapper').find('.combobox-text'); 74 $text.text($('option:selected', $(this)).text()); 75 }); 76 }); 77 } 78 79 function legacyQuickViewGallery(el) { 80 $('.gem-combobox').combobox(); 81 el.current.$content.buildSimpleGalleries(); 82 el.current.$content.updateSimpleGalleries(); 83 $('.variations_form', el.current.$content).each(function () { 84 var $form = $(this); 85 $form.on('reset_image show_variation', function () { 86 el.removeEvents(); 87 window.setTimeout(function () { 88 el.addEvents(); 89 }, 100); 90 }); 91 $form.on('show_variation', function (e, variation) { 92 if (variation.image && variation.image.src) { 93 var $g_item = $('.gem-quick-view-gallery .gem-gallery-item img[src="' + variation.image.src + '"]', el.current.$content).closest('.gem-gallery-item'); 94 $('.gem-quick-view-gallery .gem-gallery-items-carousel', el.current.$content).trigger('slideTo', [$g_item]); 95 } 96 }); 97 $form.wc_variation_form(); 98 $form.on('change', '.variations select', function (event) { 99 var $text = $(this).closest('.combobox-wrapper').find('.combobox-text'); 100 $text.text($('option:selected', $(this)).text()); 101 }); 102 }); 103 } 104 }); 105})(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.