woocommerce/assets/js/admin/quick-edit.min.js

1 line
3.6 KiB
JavaScript

jQuery(document).ready(function(){jQuery("#the-list").on("click",".editinline",function(){inlineEditPost.revert();var e=jQuery(this).closest("tr").attr("id");e=e.replace("post-","");var t=jQuery("#woocommerce_inline_"+e),n=t.find(".sku").text(),r=t.find(".regular_price").text(),i=t.find(".sale_price").text(),s=t.find(".weight").text(),o=t.find(".length").text(),u=t.find(".width").text(),a=t.find(".height").text(),f=t.find(".visibility").text(),l=t.find(".stock_status").text(),c=t.find(".stock").text(),h=t.find(".featured").text(),p=t.find(".manage_stock").text(),d=t.find(".menu_order").text(),v=t.find(".tax_status").text(),m=t.find(".tax_class").text(),g=t.find(".backorders").text();jQuery('input[name="_sku"]',".inline-edit-row").val(n);jQuery('input[name="_regular_price"]',".inline-edit-row").val(r);jQuery('input[name="_sale_price"]',".inline-edit-row").val(i);jQuery('input[name="_weight"]',".inline-edit-row").val(s);jQuery('input[name="_length"]',".inline-edit-row").val(o);jQuery('input[name="_width"]',".inline-edit-row").val(u);jQuery('input[name="_height"]',".inline-edit-row").val(a);jQuery('input[name="_stock"]',".inline-edit-row").val(c);jQuery('input[name="menu_order"]',".inline-edit-row").val(d);jQuery('select[name="_tax_status"] option[value="'+v+'"]',".inline-edit-row").attr("selected","selected");jQuery('select[name="_tax_class"] option[value="'+m+'"]',".inline-edit-row").attr("selected","selected");jQuery('select[name="_visibility"] option, select[name="_stock_status"] option, select[name="_backorders"] option').removeAttr("selected");jQuery('select[name="_visibility"] option[value="'+f+'"]',".inline-edit-row").attr("selected","selected");jQuery('select[name="_stock_status"] option[value="'+l+'"]',".inline-edit-row").attr("selected","selected");jQuery('select[name="_backorders"] option[value="'+g+'"]',".inline-edit-row").attr("selected","selected");h=="yes"?jQuery('input[name="_featured"]',".inline-edit-row").attr("checked","checked"):jQuery('input[name="_featured"]',".inline-edit-row").removeAttr("checked");if(p=="yes"){jQuery(".stock_qty_field",".inline-edit-row").show().removeAttr("style");jQuery('input[name="_manage_stock"]',".inline-edit-row").attr("checked","checked")}else{jQuery(".stock_qty_field",".inline-edit-row").hide();jQuery('input[name="_manage_stock"]',".inline-edit-row").removeAttr("checked")}var y=t.find(".product_type").text(),b=t.find(".product_is_virtual").text();y=="simple"||y=="external"?jQuery(".price_fields",".inline-edit-row").show().removeAttr("style"):jQuery(".price_fields",".inline-edit-row").hide();b=="yes"?jQuery(".dimension_fields",".inline-edit-row").hide():jQuery(".dimension_fields",".inline-edit-row").show().removeAttr("style");y=="grouped"?jQuery(".stock_fields",".inline-edit-row").hide():jQuery(".stock_fields",".inline-edit-row").show().removeAttr("style")});jQuery("#the-list").on("change",'.inline-edit-row input[name="_manage_stock"]',function(){jQuery(this).is(":checked")?jQuery(".stock_qty_field",".inline-edit-row").show().removeAttr("style"):jQuery(".stock_qty_field",".inline-edit-row").hide()});jQuery("#wpbody").on("click","#doaction, #doaction2",function(){jQuery("input.text",".inline-edit-row").val("");jQuery("#woocommerce-fields select").prop("selectedIndex",0);jQuery("#woocommerce-fields-bulk .inline-edit-group .alignright").hide()});jQuery("#wpbody").on("change","#woocommerce-fields-bulk .inline-edit-group .change_to",function(){jQuery(this).val()>0?jQuery(this).closest("div").find(".alignright").show():jQuery(this).closest("div").find(".alignright").hide()});jQuery(".product_shipping_class-checklist input").change(function(){jQuery(this).closest("li").siblings().find("input:checked").removeAttr("checked")})});