1(function($) { 2 'use strict'; 3 4 /************* Quick view ****************/ 5 $.extend({ 6 quickview_init: function() { 7 var self = this, 8 $qvContainer = $('#gva-quickview'), 9 $qvOverlay = $('<div class="mfp-bg gva-mfp-fade-in"></div>'), 10 productId; 11 self.$html = $('html'); 12 self.$body = $('body'); 13 self.$body.on('click', '.btn-quickview', function(e) { 14 e.preventDefault(); 15 productId = $(this).data('product_id'); 16 17 if (productId) { 18 self.$html.css('width', 'auto'); 19 $qvOverlay.appendTo(self.$body); 20 $qvOverlay.addClass('show mfp-ready gva-loader'); 21 _LoadQuickView(); 22 } 23 }); 24 25 var _LoadQuickView = function() { 26 var ajaxUrl, 27 data = { 28 product_id: productId 29 }; 30 31 if (typeof wc_add_to_cart_params !== 'undefined') { 32 ajaxUrl = wc_add_to_cart_params.wc_ajax_url.toString().replace('%%endpoint%%', 'indutri_ajax_load_product'); 33 } else { 34 data['action'] = 'indutri_ajax_load_product'; 35 } 36 37 window.gva_quickview_get_product = $.ajax({ 38 type: 'POST', 39 url: ajaxUrl, 40 data: data, 41 dataType: 'html', 42 cache: false, 43 headers: {'cache-control': 'no-cache'}, 44 beforeSend: function() { 45 if (typeof window.gva_quickview_get_product === 'object') { 46 window.gva_quickview_get_product.abort(); 47 } 48 }, 49 error: function(XMLHttpRequest, textStatus, errorThrown) { 50 console.log('AJAX error - ' + errorThrown); 51 52 self.$html.css('width', ''); 53 54 $qvOverlay.removeClass('mfp-ready mfp-removing').remove(); 55 }, 56 success: function(data) { 57 $qvContainer.html(data); 58 59 var $currentContainer = $qvContainer.children('#product-'+productId), 60 $productForm = $currentContainer.find('form.cart'), 61 $lastImg = $('#gva-quickview-images').find('img').last(); 62 63 $lastImg.one('load', function() { 64 _qvShowModal(); 65 }); 66 } 67 }); 68 }, 69 70 _qvShowModal = function() { 71 $.magnificPopup.open({ 72 mainClass: '', 73 closeMarkup: '<a class="gva-close"></a>', 74 removalDelay: 180, 75 items: { 76 src: $qvContainer, 77 type: 'inline' 78 }, 79 callbacks: { 80 open: function() { 81 _LoadSlider(); 82 83 $qvOverlay.one('touchstart.qv', function() { 84 $.magnificPopup.close(); 85 }); 86 }, 87 beforeClose: function() { 88 $qvOverlay.addClass('mfp-removing'); 89 }, 90 close: function() { 91 self.$html.css('width', ''); 92 93 $qvOverlay.removeClass('mfp-ready mfp-removing').remove(); 94 } 95 } 96 }); 97 }, 98 99 /* Function: Re-init slider */ 100 _LoadSlider = function() { 101 $("#gva-quickview-images").owlCarousel({ 102 singleItem : true, 103 loop: false, 104 nav: true, 105 items: 1, 106 autoplay: false, 107 autoplayTimeout: 5000, 108 autoplayHoverPause: true, 109 navText: [ '<i class="fas fa-chevron-left"></i>', '<i class="fas fa-chevron-right"></i>' ], 110 }); 111 }; 112 } 113 }); 114 115 $(document).ready(function(){ 116 $.quickview_init(); 117 $(document).on('.minicart-close', 'click', function(){ 118 $(this).parents('.cart').removeClass('open'); 119 }) 120 }); 121 122 var scrollToTop = function() { 123 var scrollTo = $('#wp-main-content').offset().top - 100; 124 $('html, body').stop().animate({ 125 scrollTop: scrollTo 126 }, 400); 127 }; 128 129})(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.