| 1 |
"use strict";var merchant=merchant||{};merchant.modules=merchant.modules||{},function(r){merchant.modules.quickView={init:function(){var t=r(".merchant-quick-view-modal");t.length&&t.each(function(){var e=r(this),t=r(".merchant-quick-view-button"),n=e.find(".merchant-quick-view-close-button"),i=e.find(".merchant-quick-view-inner"),a=e.find(".merchant-quick-view-content"),c=e.find(".merchant-quick-view-overlay"),o=!1;t.on("click",function(t){t.preventDefault(),a.empty(),e.addClass("merchant-show"),e.addClass("merchant-loading"),o=!0,r.post(window.merchant.setting.ajax_url,{action:"merchant_quick_view_content",nonce:window.merchant.setting.nonce,product_id:r(this).data("product-id")},function(t){var n;t.success&&o?(a.html(t.data),i.addClass("merchant-show"),e.removeClass("merchant-loading"),n=a.find(".woocommerce-product-gallery"),wc_single_product_params.zoom_enabled=window.merchant.setting.quick_view_zoom,"function"==typeof r.fn.wc_product_gallery&&n.length&&(n.trigger("wc-product-gallery-before-init",[n.get(0),wc_single_product_params]),n.wc_product_gallery(wc_single_product_params),n.trigger("wc-product-gallery-after-init",[n.get(0),wc_single_product_params])),n=a.find(".variations_form"),"function"==typeof r.fn.wc_variation_form&&n.length&&n.each(function(){r(this).wc_variation_form()}),window.botiga&&window.botiga.productSwatch&&window.botiga.productSwatch.init(),window.botiga&&window.botiga.qtyButton&&window.botiga.qtyButton.init("quick-view")):(a.html(t.data),i.addClass("merchant-show"),e.removeClass("merchant-loading"))}).fail(function(t,n){a.html(n),i.addClass("merchant-show"),e.removeClass("merchant-loading")})}),c.on("click",function(t){t.preventDefault(),n.trigger("click")}),n.on("click",function(t){t.preventDefault(),o=!1,e.removeClass("merchant-show"),i.removeClass("merchant-show")})})}},r(document).ready(function(){merchant.modules.quickView.init()})}(jQuery); |