woocommerce/assets/js/admin/write-panels.min.js

1 line
20 KiB
JavaScript
Raw Normal View History

jQuery(function(a){function e(){a(".woocommerce_attributes .woocommerce_attribute").each(function(b,c){a(".attribute_position",c).val(parseInt(a(c).index(".woocommerce_attributes .woocommerce_attribute")))})}a("#upsell_product_data").bind("keypress",function(a){if(a.keyCode==13)return!1});a("ul.tabs").show();a("div.panel-wrap").each(function(){a("div.panel:not(div.panel:first)",this).hide()});a("ul.tabs a").click(function(){var b=a(this).closest("div.panel-wrap");a("ul.tabs li",b).removeClass("active");a(this).parent().addClass("active");a("div.panel",b).hide();a(a(this).attr("href")).show();return!1});jQuery("select.chosen_select").chosen();jQuery("select.chosen_select_nostd").chosen({allow_single_deselect:"true"});jQuery("select.ajax_chosen_select_products").ajaxChosen({method:"GET",url:woocommerce_writepanel_params.ajax_url,dataType:"json",data:{action:"woocommerce_json_search_products",security:woocommerce_writepanel_params.search_products_nonce}},function(b){var c={};a.each(b,function(a,b){c[a]=b});return c});a(".multi_select_products #product_search").bind("keyup click",function(){a(".multi_select_products_source").addClass("loading");a(".multi_select_products_source li:not(.product_search)").remove();var b=a(this).val(),c=this,d=a(this).attr("rel");if(b.length<3){a(".multi_select_products_source").removeClass("loading");return}var e={name:d,search:encodeURI(b),action:"woocommerce_upsell_crosssell_search_products",security:woocommerce_writepanel_params.search_products_nonce};f=a.ajax({url:woocommerce_writepanel_params.ajax_url,data:e,type:"POST",success:function(b){a(".multi_select_products_source").removeClass("loading");a(".multi_select_products_source li:not(.product_search)").remove();a(c).parent().parent().append(b)}})});jQuery("#woocommerce-order-actions input, #woocommerce-order-actions a").click(function(){window.onbeforeunload=""});a("a.edit_address").click(function(b){a(this).hide();a(this).closest(".order_data").find("div.address").hide();a(this).closest(".order_data").find("div.edit_address").show();b.preventDefault()});a("#order_items_list .remove_row").live("click",function(){var b=confirm(woocommerce_writepanel_params.remove_item_notice);if(b){a(this).closest("tr.item").hide();a("input",a(this).closest("tr.item")).val("")}return!1});a("button.calc_line_taxes").live("click",function(){a(".woocommerce_order_items_wrapper").block({message:null,overlayCSS:{background:"#fff url("+woocommerce_writepanel_params.plugin_url+"/assets/images/ajax-loader.gif) no-repeat center",opacity:.6}});var b=confirm(woocommerce_writepanel_params.calc_line_taxes);if(b){var c=a("#order_items_list tr.item"),d=a("#_shipping_country").val();if(d)var e=a("#_shipping_state").val(),f=a("#_shipping_postcode").val();else{d=a("#_billing_country").val();var e=a("#_billing_state").val(),f=a("#_billing_postcode").val()}c.each(function(b){var g=a(this),h={action:"woocommerce_calc_line_taxes",item_id:g.find("input.item_id").val(),line_subtotal:g.find("input.line_subtotal").val(),line_total:g.find("input.line_total").val(),tax_class:g.find("select.tax_class").val(),country:d,state:e,postcode:f,security:woocommerce_writepanel_params.calc_totals_nonce};a.post(woocommerce_writepanel_params.ajax_url,h,function(d){result=jQuery.parseJSON(d);g.find("input.line_subtotal_tax").val(result.line_subtotal_tax);g.find("input.line_tax").val(result.line_tax);b==c.size()-1&&a(".woocommerce_order_items_wrapper").unblock()})})}else a(".woocommerce_order_items_wrapper").unblock();return!1}).hover(function(){a("#order_items_list input.line_subtotal_tax, #order_items_list input.line_tax").css("background-color","#d8c8d2")},function(){a("#order_items_list input.line_subtotal_tax, #order_items_list input.line_tax").css("background-color","")});a("button.calc_totals").live("click",function(){a("#woocommerce-order-totals").block({message:null,overlayCSS:{background:"#fff url("+woocommerce_writepanel_params.plugin_url+"/assets/images/ajax-loader.gif) no-repeat center",opacity:.6}});var b=confirm(woocommerce_writepanel_params.calc_totals);if(b){var c=0,d=0,e=0,f=0,g