jQuery(function(r){r("body").on("click",".quick-view-btn",function(){r(".fal",this).removeClass("fa-eye").addClass("fa-spinner-third fa-spin"),r("#postModal .summary-content").removeClass("quickajax-disable quickajax");var a={action:"load_post_by_ajax",id:r(this).data("dina-product-id"),security:dinaproduct.security};r.post(dinaproduct.ajaxurl,a,function(a){a=JSON.parse(a),r("#postModal h5#postModalLabel").html(a.title),r("#postModal .quick-gallery").html(a.img_gallery),r("#postModal .summary-content").html(a.content),r("#postModal .summary-content").html(a.content),r("#postModal .summary-content").addClass(a.quickajax),r("#postModal .carousel").carousel(),r("#postModal").modal({show:!0}),r(".quick-view-btn .fal").removeClass("fa-spinner-third fa-spin").addClass("fa-eye"),jQuery("#postModal .quantity-con").on("click","button.plus, button.minus",function(){var a=jQuery(this).closest("#postModal .quantity-con").find(".qty"),t=parseFloat(a.val()),o=parseFloat(a.attr("max")),r=parseFloat(a.attr("min")),e=parseFloat(a.attr("step"));jQuery(this).is(".plus")?o&&o<=t?a.val(o):a.val(t+e):r&&t<=r?a.val(r):1<t&&a.val(t-e),jQuery('button[name="update_cart"]').prop("disabled",!1)}),r("#postModal .quickajax form.cart").on("submit",function(a){a.preventDefault();var o=r(this);o.block({message:null,overlayCSS:{background:"#fff",opacity:.6}}),(a=new FormData(this)).append("add-to-cart",o.find("[name=add-to-cart]").val()),r.ajax({url:wc_add_to_cart_params.wc_ajax_url.toString().replace("%%endpoint%%","ace_add_to_cart"),data:a,type:"POST",processData:!1,contentType:!1,complete:function(a){var t;(a=a.responseJSON)&&(a.error&&a.product_url?window.location=a.product_url:"yes"!==wc_add_to_cart_params.cart_redirect_after_add?(t=o.find(".single_add_to_cart_button"),r(document.body).trigger("added_to_cart",[a.fragments,a.cart_hash,t]),r("form.cart .added_to_cart").remove(),r(".woocommerce-error, .woocommerce-message, .woocommerce-info").remove(),o.unblock()):window.location=wc_add_to_cart_params.cart_url)}})})})}),r("body").on("click",".compare-ajax-btn",function(){r(".fal",this).removeClass("fa-random").addClass("fa-spinner-third fa-spin");var a=r(this).data("dina-compare-id"),t={action:"dina_ajax_compare",id:a,security:dinaproduct.security};prod_con=".product-"+a,r.post(dinaproduct.ajaxurl,t,function(a){a=JSON.parse(a),r(".compare-link").length&&(r(".compare-amount").html(a.conut),r(".compare-link").attr("href",a.compare_url)),r(prod_con+" .compare-ajax-btn").attr("data-original-title",a.title),r(prod_con+" .compare-ajax-btn").toggleClass("in-compare"),r(".prod-opts .compare-ajax-btn").attr("data-original-title",a.title),r(".prod-opts .compare-ajax-btn").toggleClass("in-compare"),r(".compare-ajax-btn .fal").removeClass("fa-spinner-third fa-spin").addClass("fa-random")})}),r(document).on("beforeupdate.JVMWooCommerceWishlist",function(a){r(".wish-amount").html(a.wishlist.length)})});