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

1 line
6.9 KiB
JavaScript
Raw Normal View History

2018-02-23 16:55:06 +00:00
jQuery(function(e){if("undefined"!=typeof woocommerce_admin){var t=e(".edit-php.post-type-product"),i=t.find(".page-title-action:first");0===t.find(".woocommerce-BlankState").length?(i.after('<a href="'+woocommerce_admin.urls.export_products+'" class="page-title-action">'+woocommerce_admin.strings.export_products+"</a>"),i.after('<a href="'+woocommerce_admin.urls.import_products+'" class="page-title-action">'+woocommerce_admin.strings.import_products+"</a>")):i.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,i,o){var n=i.position();0===i.parent().find(".wc_error_tip").length&&(i.after('<div class="wc_error_tip '+o+'">'+woocommerce_admin[o]+"</div>"),i.parent().find(".wc_error_tip").css("left",n.left+i.width()-i.width()/2-e(".wc_error_tip").width()/2).css("top",n.top+i.height()).fadeIn("100"))}).on("wc_remove_error_tip",function(t,i,o){i.parent().find(".wc_error_tip."+o).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 i=e(this).val(),o=i.replace(t,"");i!==o&&e(this).val(o)}).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,i;e(this).is(".wc_input_price")||e(this).is("#refund_amount")?(t=new RegExp("[^-0-9%\\"+woocommerce_admin.mon_decimal_point+"]+","gi"),i="i18n_mon_decimal_error"):e(this).is(".wc_input_country_iso")?(t=new RegExp("([^A-Z])+|(.){3,}","im"),i="i18n_country_iso_error"):(t=new RegExp("[^-0-9%\\"+woocommerce_admin.decimal_point+"]+","gi"),i="i18n_decimal_error");var o=e(this).val();o!==o.replace(t,"")?e(document.body).triggerHandler("wc_add_error_tip",[e(this),i]):e(document.body).triggerHandler("wc_remove_error_tip",[e(this),i])}).on("change","#_sale_price.wc_input_price[type=text], .wc_input_price[name^=variable_sale_price]",function(){var t,i=e(this);t=-1!==i.attr("name").indexOf("variable")?i.parents(".variable_pricing").find(".wc_input_price[name^=variable_regular_price]"):e("#_regular_price"),parseFloat(window.accounting.unformat(i.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,i=e(this);t=-1!==i.attr("name").indexOf("variable")?i.parents(".variable_pricing").find(".wc_input_price[name^=variable_regular_price]"):e("#_regular_price"),parseFloat(window.accounting.unformat(i.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_tooltips"),e(".wc_input_table.sortable tbody").sortable({items:"tr",cursor:"move",axis