PageSourceSearch

https://piranhafab.com/wp-content/plugins/woocommerce-quick-view-pro/assets/js/wc-quick-view-pro.js?ver=1.7.17

js piranhafab.com collected 2026-10-10 01:36:52 UTC 12,582 bytes, 1 lines download raw bytes

1!function(e,t,o,i){"use strict";if(!e.fn.jQueryModal||void 0===i)return!1;const n=function(){Number(i.debug);const n=".wc-quick-view-modal",c={escapeClose:!1,clickClose:!1,showClose:!1},a=e('<div class="'+e.modal.defaults.modalClass+'-spinner"></div>').append(e.modal.defaults.spinnerHtml),r=e("html");let s,l=null,d=!1,u=!1;t.dontCloseQVP=!1;const p=function(e,t){for(var o of e)"childList"===o.type&&P()};function _(e){t.dontCloseQVP=!0}function f(e){u=!0}function m(e){"Escape"!==e.key||s.hasClass("pswp--open")||(t.dontCloseQVP=!1,w()),"Escape"===e.key&&(u||s.hasClass("pswp--open"))&&(u=!1,t.dontCloseQVP=!1)}function w(c){if(u&&!s.hasClass("pswp--open"))return u=!1,t.dontCloseQVP=!0,void setTimeout(function(){t.dontCloseQVP=!1},100);if(t.dontCloseQVP)setTimeout(function(){t.dontCloseQVP=!1},100);else if(d){const a=c?e(c.target).closest(n):[],r=!!c&&e(c.target).hasClass("dz-hidden-input");if(!c||"qvp-modal:close"===e(c.target).attr("rel")||0===a.length&&!r){const n=e.modal.getCurrent();if(c&&"updated_checkout"===c.type&&(n.$elm.find(".product").hasClass("product-type-variable")&&i.keep_option.variable||n.$elm.find(".product").hasClass("product-type-simple")&&i.keep_option.simple))return;c&&(c.preventDefault(),c.stopPropagation()),e(o.body).trigger("quick_view_pro:closed"),e.modal.close(),u=!1,t.dontCloseQVP=!1}}}function v(t,n){if(t=parseInt(t,10),n=n||[],!t)return!1;if(n.data("clicked"))return!1;n.data("clicked",!0);const a=e("#quick-view-"+t);return a.length?(a.jQueryModal(c),n.data("clicked",!1),d=!0):(e(o.body).trigger("quick_view_pro:before_open",[t]),e.ajax({url:i.rest_url+"/"+i.rest_endpoints.view+"/"+t,method:"GET",dataType:"json",beforeSend(e){e.setRequestHeader("X-WP-Nonce",i.rest_nonce)}}).done(function(n,a,r){const s=r.getResponseHeader("X-WP-Nonce");if(s&&(i.rest_nonce=s),!("quick_view"in n))return void e(o.body).trigger("quick_view_pro:open_fail",[t]);e(n.quick_view).jQueryModal(c);const l=e.modal.getCurrent();l.$elm.append(e('<a href="#close-modal" rel="qvp-modal:close" class="close-modal">Close</a>')),l&&l.$elm.trigger("quick_view_pro:load",[l.$elm])}).fail(function(i,n,c){e(o.body).trigger("quick_view_pro:open_fail",[t])}).always(function(){n.data("clicked",!1),e(o.body).trigger("quick_view_pro:open_complete",[t,n])})),!0}function g(e,t){e&&t&&e.length&&e.append(`<div class="wc-quick-view-notice error-notice">${t}</div>`)}function h(e){e.find(".wc-quick-view-notice, .wc-quick-view-success-wrap").remove()}function k(t){const o=t.find(".cart");if(!o.length)return;const i=o.find('input[name^="quantity"]');i.length&&i.val(i.attr("value")),o.find("select").each((t,o)=>{e(o).val(e(o).find("option:selected").val())});const n=o.find(".wc-pao-addon");n.length&&(n.find("input").each(function(){const t=e(this).attr("type");"checkbox"===t||"radio"===t?e(this).prop("checked",!1):e(this).val(""),e(this).change()}),n.find("select").find("option:first").prop("selected",!0).change(),n.find("textarea").val("").change())}function q(t){let o=e(t.currentTarget),i=o.data("product_id")||0;if(o.closest(".qvp-disabled").length)return!0;if(!i){const e=o.closest(".product");if(!e.length)return!0;if(i=C(e),!i)return!0}return o.blur(),v(i,o),t.preventDefault(),t.stopPropagation(),!1}function b(t,i){e(".jquery-modal").length?(e(".jquery-modal .product").css({visibility:"hidden",opacity:0}),a.prependTo(".jquery-modal .wc-quick-view-modal").show()):a.appendTo(o.body).show()}function y(){a.remove(),e(".wc-quick-view-modal .product").css({visibility:"visible",opacity:1}),function(){const t=e.modal.getCurrent();if(t){const e=t.$blocker.prop("scrollHeight")>t.$blocker.prop("clientHeight"),o=t.$elm.find(".quick-view-navigation");o&&!e&&o.css("left","0")}}(),function(){const t=e.modal.getCurrent();if(t){let e=t.$elm.find(".woocommerce-review-link");e.length&&!i.enable_tab_reviews&&(e.attr("href","#"),e.addClass("unlink"))}}(),e.modal.getCurrent().$elm.find(".wpcf7").length&&o.querySelectorAll(".jquery-modal.current .wc-quick-view-modal .wpcf7-form").forEach(e=>{wpcf7.init(e)}),d=!0}function C(e){let t=e.find("[data-product_id]").data("product_id");if(!t){const o=e.attr("class").match(/post\-(\d+)/);1 in o&&(t=o[1])}return t}function $(t,o,n){const c=e("#quick-view-"+o+".with-navigation-arrows"),a=n.closest(".product").next(".product"),r=n.closest(".product").prev(".product");let s='<div class="quick-view-navigation">';r.length&&(s+=`<button type="button" data-product_id="${o}" data-product-open="${C(r)}"\n                        class="quick-view-prev quick-view-arrow"><span class="icon"><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="#000000" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M15 18l-6-6 6-6"/></svg></span> <span class="text">${i.strings.previous}</span></button>`),a.length&&(s+=`<button type="button" data-product_id="${o}" data-product-open="${C(a)}"\n                class="quick-view-next quick-view-arrow"><span class="text">${i.strings.next}</span> <span class="icon"><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="#000000" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M9 18l6-6-6-6"/></svg></span></button>`),s+="</div>",c.append(s)}function x(t){v(e(t.currentTarget).attr("data-product-open"),function(t,o,n){let c=e(".product.product-"+t);c.length||(c=e(".product.post-"+t));const a="next"==n?c.next(".product"):c.prev(".product");let r=a.find("[data-product_id]");return r||(r=a.find(i.product_link_selector)),r}(e(t.currentTarget).attr("data-product_id"),0,e(t.currentTarget).hasClass("quick-view-next")?"next":"prev"))}function P(){e(".wc-quick-view-modal").remove()}function j(e,t){t.$elm.trigger("quick_view_pro:open",[t.$elm])}function Q(e,t){t.$elm.trigger("quick_view_pro:close",[t.$elm]),d=!1}function V(e,t){r.addClass("qvp-modal-is-open"),t.find(".cart").length&&(h(t),k(t))}function T(e,t){r.removeClass("qvp-modal-is-open"),function(e){e.find(".mejs-container").find("audio, video").each(function(){this.pause&&this.pause()})}(t),l&&(clearTimeout(l),l=null)}function E(o,n){!function(o){o.find(".wc-quick-view-product-summary").length&&(function(t){e.fn.wc_variation_form&&t.find(".variations_form").each(function(){e(this).wc_variation_form()}).on("woocommerce_variation_has_changed",function(){const t=e('input[name="variation_id"]',this);t.length&&""===t.val()&&t.val("0")}).on("reset_data",function(){h(t)})}(o),function(e){void 0!==t.WPPlaylistView&&e.find(".wp-playlist:not(:has(.mejs-container))").each(function(){new t.WPPlaylistView({el:this})}),"mediaelement"in t.wp&&t.wp.mediaelement.initialize()}(o),function(t){e.fn.productTable&&t.find(".wc-product-table").productTable(),t.find(".cart").length&&(t.trigger("quick-view-displayed"),e.fn.wc_pb_bundle_form&&t.find(".bundle_form .bundle_data").each(function(){const t=e(this);t.closest(".composite_form").length||t.wc_pb_bundle_form()}),e.fn.wc_composite_form&&t.find(".composite_form .composite_data").each(function(){e(this).wc_composite_form()}))}(o)),o.find(".wc-quick-view-product-gallery").length&&function(t){if(!e.fn.wc_product_gallery)return;const o=t.find(".woocommerce-product-gallery");if(o.length){const e=!1!==wc_single_product_params.flexslider_enabled;wc_single_product_params.flexslider_enabled=!0,wc_single_product_params.flexslider_enabled=!0,wc_single_product_params.flexslider.controlNav=i.navStyle,o.first().wc_product_gallery(wc_single_product_params),wc_single_product_params.flexslider_enabled=e;const n=t.data("imageWidth");
1n&&(t.hasClass("with-thumbnail")&&!t.hasClass("with-details")&&t.css("max-width",n+"px"),o.css("width",n+"px"))}}(o),o.find(".wc-quick-view-product-tabs").length&&e(".wc-tabs-wrapper, .woocommerce-tabs").trigger("init")}(n)}function O(){e('<div class="wc-quick-view-modal wc-quick-view-error wc-quick-view-message-only"><p>'+i.messages.open_error+"</p></div>").jQueryModal(c)}function N(c){let a=e(c.target),r=a.closest(n),s=a.find(".single_add_to_cart_button")||[];s.length||(s=a.find('button[type="submit"]'));const d=["theme-flatsome"].some(t=>e("body").hasClass(t));if(s.hasClass("loading")&&!d||s.hasClass("disabled"))return!1;if(h(r),r.hasClass("external-product"))return t.location.href=a.attr("action"),!1;const u=function(t){const o=function(e){const t=function(e){const t={},o=e.serializeArray();for(const e of o){let o=e.name.match(/^quantity\[(\d+)]$/);if(o)t.quantity||(t.quantity={}),t.quantity[Number(o[1])]=Number(e.value);else if(o=e.name.match(/(addon.*)\[(\d*)]/),o)t[o[1]]||(t[o[1]]=[]),t[o[1]].push(e.value);else{if(e.name.endsWith("[]")){const o=e.name.substring(0,e.name.length-2);o in t||(t[o]=[]),t[o].push(e.value);continue}t[e.name]=e.value}}return t}(e),o=e.find('[name="add-to-cart"]').val();return delete t["add-to-cart"],t.product_id=o,t}(t),n={isValid:!1,message:!1,cartData:null};return e.isEmptyObject(o)?(n.message=i.messages.cart_error,n):"product_id"in o||t.closest(".wc-quick-view-modal.has-quick-view-pro").length?0===o.quantity||Object.prototype.isPrototypeOf(o.quantity)&&0===Object.values(o.quantity).reduce((e,t)=>e+Number(t),0)?(n.message=i.messages.zero_quantity,n):"variation_id"in o&&0===parseInt(o.variation_id,10)?(n.message=i.messages.option_required,n):(e(":input",t).each(function(){const t=e(this).prop("name");if(e(this).prop("required")&&(!(t in o)||""===o[t]))return n.message=i.messages.option_required,n}),n.message||(n.isValid=!0),n.cartData=o,n):(n.message=i.messages.no_product_id,n)}(a),p=u.cartData;return u.isValid?(r.trigger("quick_view_pro:before_add_to_cart",[p]),t.wc_fast_cart_params&&wc_fast_cart_params.options.autoOpen||(s.addClass("loading"),e(o.body).trigger("adding_to_cart",[s,p]),e.ajax({url:i.rest_url+"/"+i.rest_endpoints.cart,type:"POST",data:p,dataType:"json",beforeSend(e){e.setRequestHeader("X-WP-Nonce",i.rest_nonce)}}).done(function(n,c,d){n.error?g(a,n.error):"undefined"==typeof wc_add_to_cart_params||"yes"!==wc_add_to_cart_params.cart_redirect_after_add?n.cart_message&&(r.append(e('<div class="wc-quick-view-success-wrap" />').append(`<p class="wc-quick-view-notice success-notice">${n.cart_message}</p>`)),r.trigger("quick_view_pro:added_to_cart",[n]),e(o.body).trigger("added_to_cart",[n.fragments,n.cart_hash,s]),l=setTimeout(function(){k(r),r.find(".product").hasClass("product-type-variable")&&i.keep_option.variable||r.find(".product").hasClass("product-type-simple")&&i.keep_option.simple?e(".wc-quick-view-success-wrap").remove():(e(o.body).trigger("quick_view_pro:closed"),e.modal.close())},1500)):t.location=wc_add_to_cart_params.cart_url}).fail(function(){r.trigger("quick_view_pro:add_to_cart_fail",[p])}).always(function(){s.removeClass("loading"),r.trigger("quick_view_pro:add_to_cart_complete",[p])})),!1):(g(a,u.message),!1)}function S(){const t=e.modal.getCurrent();t&&(e(o).off("keydown.modal"),t.$elm.find("a.close-modal").attr("rel",""))}function W(){const t=e.modal.getCurrent();t&&(e(o).on("keydown.modal",function(i){27===i.which&&t.options.escapeClose&&(e(o.body).trigger("quick_view_pro:closed"),t.close())}),t.$elm.find("a.close-modal").attr("rel","qvp-modal:close"))}function M(t,o){g(e(t.target).find(".cart"),i.messages.cart_error)}return{initialize:function(){s=e(".pswp"),e(o.body).on("click",w).on("keydown",m).on("click",".quick-view-arrow",x).on("click",'a[rel="qvp-modal:close"]',w).on("click",'[data-action="quick-view"]',q).on("quick_view_pro:before_open",b).on("quick_view_pro:open_complete",$).on("quick_view_pro:open_complete",y).on(e.modal.BEFORE_OPEN,n,j).on(e.modal.BEFORE_CLOSE,n,Q).on("quick_view_pro:load",E).on("quick_view_pro:open",V).on("quick_view_pro:close",T).on("quick_view_pro:open_fail",O).on("quick_view_pro:before_add_to_cart",S).on("quick_view_pro:add_to_cart_complete",W).on("submit",`${n} .cart, ${n} .wcbvp-cart`,N).on("quick_view_pro:add_to_cart_fail",M).on("click",".woocommerce-product-gallery__trigger",f).on("updated_checkout",w),s.on("click",_),o.querySelector(".products")&&new MutationObserver(p).observe(o.querySelector(".products"),{childList:!0,subtree:!0}
1),e(".wcbvp-variation-pool-item .action-delete").on("click",_),i.enable_product_link&&i.product_link_selector&&e(o.body).on("click",i.product_link_selector,q),t.wp=t.wp||{}},openQuickView:v,handleQuickViewClick:q}}();t.WCQuickViewPro=n,e(()=>{n.initialize()}),e(o).ready(function(){e(".woocommerce-uses-block-theme .wc-quick-view-button").addClass("wp-block-button__link wp-element-button wc-block-components-product-button__button")})}(jQuery,window,document,wc_quick_view_pro_params);

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.