woocommerce/assets/js/admin/woocommerce_admin.min.js

1 line
8.6 KiB
JavaScript
Raw Permalink Normal View History

2021-12-10 12:03:04 +00:00
!function(s,l){s(function(){var e,o,n,r,t,i,c;function a(e){t.is(e.target)||0!==t.has(e.target).length||(t.removeClass("is-open"),c=!1,s(document).off("click",a))}void 0!==l&&(i=(e=s(".edit-php.post-type-product")).find(".page-title-action:first"),0===e.find(".woocommerce-BlankState").length?(l.urls.export_products&&i.after('<a href="'+l.urls.export_products+'" class="page-title-action">'+l.strings.export_products+"</a>"),l.urls.import_products&&i.after('<a href="'+l.urls.import_products+'" class="page-title-action">'+l.strings.import_products+"</a>")):i.hide(),s(".woocommerce-progress-form-wrapper .button-next").on("click",function(){return s(".wc-progress-form-content").block({message:null,overlayCSS:{background:"#fff",opacity:.6}}),!0}),s(document.body).on("wc_add_error_tip",function(e,t,i){var o=t.position();0===t.parent().find(".wc_error_tip").length&&(t.after('<div class="wc_error_tip '+i+'">'+l[i]+"</div>"),t.parent().find(".wc_error_tip").css("left",o.left+t.width()-t.width()/2-s(".wc_error_tip").width()/2).css("top",o.top+t.height()).fadeIn("100"))}).on("wc_remove_error_tip",function(e,t,i){t.parent().find(".wc_error_tip."+i).fadeOut("100",function(){s(this).remove()})}).on("click",function(){s(".wc_error_tip").fadeOut("100",function(){s(this).remove()})}).on("blur",".wc_input_decimal[type=text], .wc_input_price[type=text], .wc_input_country_iso[type=text]",function(){s(".wc_error_tip").fadeOut("100",function(){s(this).remove()})}).on("change",".wc_input_price[type=text], .wc_input_decimal[type=text], .wc-order-totals #refund_amount[type=text]",function(){var e,t,i=l.decimal_point;(s(this).is(".wc_input_price")||s(this).is("#refund_amount"))&&(i=l.mon_decimal_point),e=new RegExp("[^-0-9%\\"+i+"]+","gi"),t=new RegExp("\\"+i+"+","gi");var o=s(this).val(),i=o.replace(e,"").replace(t,i);o!==i&&s(this).val(i)}).on("keyup",".wc_input_price[type=text], .wc_input_decimal[type=text], .wc_input_country_iso[type=text], .wc-order-totals #refund_amount[type=text]",function(){var e,t=!1,i=s(this).is(".wc_input_price")||s(this).is("#refund_amount")?(t=!0,n=new RegExp("[^-0-9%\\"+l.mon_decimal_point+"]+","gi"),e=new RegExp("[^\\"+l.mon_decimal_point+"]","gi"),"i18n_mon_decimal_error"):s(this).is(".wc_input_country_iso")?(n=new RegExp("([^A-Z])+|(.){3,}","im"),"i18n_country_iso_error"):(t=!0,n=new RegExp("[^-0-9%\\"+l.decimal_point+"]+","gi"),e=new RegExp("[^\\"+l.decimal_point+"]","gi"),"i18n_decimal_error"),o=s(this).val(),n=o.replace(n,"");t&&1<n.replace(e,"").length&&(n=n.replace(e,"")),o!==n?s(document.body).triggerHandler("wc_add_error_tip",[s(this),i]):s(document.body).triggerHandler("wc_remove_error_tip",[s(this),i])}).on("change","#_sale_price.wc_input_price[type=text], .wc_input_price[name^=variable_sale_price]",function(){var e=s(this),t=-1!==e.attr("name").indexOf("variable")?e.parents(".variable_pricing").find(".wc_input_price[name^=variable_regular_price]"):s("#_regular_price"),e=parseFloat(window.accounting.unformat(e.val(),l.mon_decimal_point));parseFloat(window.accounting.unformat(t.val(),l.mon_decimal_point))<=e&&s(this).val("")}).on("keyup","#_sale_price.wc_input_price[type=text], .wc_input_price[name^=variable_sale_price]",function(){var e=s(this),t=-1!==e.attr("name").indexOf("variable")?e.parents(".variable_pricing").find(".wc_input_price[name^=variable_regular_price]"):s("#_regular_price"),e=parseFloat(window.accounting.unformat(e.val(),l.mon_decimal_point));parseFloat(window.accounting.unformat(t.val(),l.mon_decimal_point))<=e?s(document.body).triggerHandler("wc_add_error_tip",[s(this),"i18n_sale_less_than_regular_error"]):s(document.body).triggerHandler("wc_remove_error_tip",[s(this),"i18n_sale_less_than_regular_error"])}).on("init_tooltips",function(){s(".tips, .help_tip, .woocommerce-help-tip").tipTip({attribute:"data-tip",fadeIn:50,fadeOut:50,delay:200,keepAlive:!0}),s(".column-wc_actions .wc-action-button").tipTip({fadeIn:50,fadeOut:50,delay:200}),s(".parent-tips").each(function(){s(this).closest("a, th").attr("data-tip",s(this).data("tip")).tipTip({attribute:"data-tip",fadeIn:50,fadeOut:50,delay:20