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

1 line
7.9 KiB
JavaScript
Raw Normal View History

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