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%%', 'ziston_ajax_load_product'); 33 } else { 34 data['action'] = 'ziston_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 _qvShowModal(); 63 } 64 }); 65 }, 66 67 _qvShowModal = function() { 68 $.magnificPopup.open({ 69 mainClass: '', 70 closeMarkup: '<a class="gva-close"></a>', 71 removalDelay: 180, 72 items: { 73 src: $qvContainer, 74 type: 'inline' 75 }, 76 callbacks: { 77 open: function() { 78 _LoadSlider(); 79 80 $qvOverlay.one('touchstart.qv', function() { 81 $.magnificPopup.close(); 82 }); 83 }, 84 beforeClose: function() { 85 $qvOverlay.addClass('mfp-removing'); 86 }, 87 close: function() { 88 self.$html.css('width', ''); 89 90 $qvOverlay.removeClass('mfp-ready mfp-removing').remove(); 91 } 92 } 93 }); 94 }, 95 96 /* Function: Re-init slider */ 97 _LoadSlider = function() { 98 $("#gva-quickview-images").owlCarousel({ 99 singleItem : true, 100 loop: false, 101 nav: true, 102 items: 1, 103 autoplay: false, 104 autoplayTimeout: 5000, 105 autoplayHoverPause: true, 106 navText: [ '<span><i class="fi flaticon-left-arrow"></i></span>', '<span><i class="fi flaticon-right-arrow-1"></i></span>' ], 107 }); 108 }; 109 } 110 }); 111 112 $(document).ready(function(){ 113 $.quickview_init(); 114 $(document).on('.minicart-close', 'click', function(){ 115 $(this).parents('.cart').removeClass('open'); 116 }) 117 }); 118 119 var scrollToTop = function() { 120 var scrollTo = $('#wp-main-content').offset().top - 100; 121 $('html, body').stop().animate({ 122 scrollTop: scrollTo 123 }, 400); 124 }; 125 126})(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.