6 lines
27 KiB
JavaScript
6 lines
27 KiB
JavaScript
|
/**
|
||
|
* TI WooCommerce Wishlist Plugin - Allow your store guests and customers to add products to Wishlist. Add Wishlist functionality to your store for free.
|
||
|
* @version 2.8.0
|
||
|
* @link https://wordpress.org/plugins/ti-woocommerce-wishlist/
|
||
|
*/
|
||
|
"use strict";function _typeof(t){return(_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function showTooltip(t,i){t.setAttribute("class","social social-clipboard tooltipped tooltipped-s"),t.setAttribute("aria-label",i)}function clearTooltip(t){t.currentTarget.setAttribute("class","social social-clipboard "),t.currentTarget.removeAttribute("aria-label")}!function(w){w.fn.tinvwl_to_wishlist=function(t){var i={api_url:window.location.href.split("?")[0],text_create:window.tinvwl_add_to_wishlist.text_create,text_already_in:window.tinvwl_add_to_wishlist.text_already_in,class:{dialogbox:".tinvwl_add_to_select_wishlist",select:".tinvwl_wishlist",newtitle:".tinvwl_new_input",dialogbutton:".tinvwl_button_add"},redirectTimer:null,onPrepareList:function(){},onGetDialogBox:function(){},onPrepareDialogBox:function(){w("body > .tinv-wishlist").length||w("body").append(w("<div>").addClass("tinv-wishlist")),w(this).appendTo("body > .tinv-wishlist")},onCreateWishList:function(t){w(this).append(w("<option>").html(t.title).val(t.ID).toggleClass("tinv_in_wishlist",t.in))},onSelectWishList:function(){},onDialogShow:function(t){w(t).addClass("tinv-modal-open"),w(t).removeClass("ftinvwl-pulse")},onDialogHide:function(t){w(this).removeClass("tinv-modal-open"),w(t).removeClass("ftinvwl-pulse")},onInited:function(){},onClick:function(){if(w(this).is(".disabled-add-wishlist"))return!1;w(this).is(".ftinvwl-animated")&&w(this).addClass("ftinvwl-pulse"),(this.tinvwl_dialog?this.tinvwl_dialog.show_list:s.onActionProduct).call(this)},onPrepareDataAction:function(t,i){w("body").trigger("tinvwl_wishlist_button_clicked",[t,i])},filterProductAlreadyIn:function(t){var t=t||[],n={};return w("form.cart[method=post], .woocommerce-variation-add-to-cart, form.vtajaxform[method=post]").find("input, select").each(function(){var t=w(this).attr("name"),i=w(this).attr("type"),e=w(this).val();("checkbox"!==i&&"radio"!==i||w(this).is(":checked"))&&(n["form"+t]=e)}),n=n.formvariation_id,t.filter(function(t){var i;return"object"===_typeof(t.in)&&"string"==typeof n?(i=parseInt(n),0<=t.in.indexOf(i)):t.in})},onMultiProductAlreadyIn:function(t){var t=t||[],e=(t=s.onPrepareList.call(t)||t,t=s.filterProductAlreadyIn.call(this,t)||t,w(this).parent().parent().find(".already-in").remove(),"");0===t.length||(e=w("<ul>"),w.each(t,function(t,i){e.append(w("<li>").html(w("<a>").html(i.title).attr({href:i.url})).val(i.ID))})),e.length&&w(this).closest(".tinv-modal-inner").find("img").after(w("<div>").addClass("already-in").html(s.text_already_in+" ").append(e))},onAction:{redirect:function(t){s.redirectTimer&&clearTimeout(s.redirectTimer),s.redirectTimer=window.setTimeout(function(){window.location.href=t},4e3)},force_redirect:function(t){window.location.href=t},wishlists:function(t){},msg:function(t){if(!t)return!1;var i=w(t).eq(0);w("body > .tinv-wishlist").length||w("body").append(w("<div>").addClass("tinv-wishlist")),w("body > .tinv-wishlist").append(i),r("body > .tinv-wishlist"),s.redirectTimer||(s.removeTimer=window.setTimeout(function(){i.remove(),s.redirectTimer&&clearTimeout(s.redirectTimer)},tinvwl_add_to_wishlist.popup_timer)),i.on("click",".tinv-close-modal, .tinvwl_button_close, .tinv-overlay",function(t){t.preventDefault(),i.remove(),s.redirectTimer&&clearTimeout(s.redirectTimer),s.removeTimer&&clearTimeout(s.removeTimer)})},status:function(t){w("body").trigger("tinvwl_wishlist_added_status",[this,t])},removed:function(t){},make_remove:function(t){},wishlists_data:function(t){d(JSON.stringify(t))}}},s=(i.onActionProduct=function(t,i){var d={form:{},tinv_wishlist_id:t||"",tinv_wishlist_name:i||"",product_type:w(this).attr("data-tinv-wl-producttype"),product_id:w(this).attr("data-tinv-wl-product")||0,product_variation:w(this).attr("data-tinv-wl-productvariation")||0,product_action:w(this).attr("data-tinv-wl-action")||"addto",redirect:window.location.href},e=this,n=[],r=[],c=new FormData;tinvwl_add_to_wishlist
|