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

1 line
3.6 KiB
JavaScript
Raw Normal View History

2014-02-03 14:35:26 +00:00
jQuery(function(){jQuery("#the-list").on("click",".editinline",function(){inlineEditPost.revert();var a=jQuery(this).closest("tr").attr("id");a=a.replace("post-","");var b=jQuery("#woocommerce_inline_"+a),c=b.find(".sku").text(),d=b.find(".regular_price").text(),e=b.find(".sale_price").text(),f=b.find(".weight").text(),g=b.find(".length").text(),h=b.find(".width").text(),i=b.find(".height").text(),j=b.find(".visibility").text(),k=b.find(".stock_status").text(),l=b.find(".stock").text(),m=b.find(".featured").text(),n=b.find(".manage_stock").text(),o=b.find(".menu_order").text(),p=b.find(".tax_status").text(),q=b.find(".tax_class").text(),r=b.find(".backorders").text();jQuery('input[name="_sku"]',".inline-edit-row").val(c),jQuery('input[name="_regular_price"]',".inline-edit-row").val(d),jQuery('input[name="_sale_price"]',".inline-edit-row").val(e),jQuery('input[name="_weight"]',".inline-edit-row").val(f),jQuery('input[name="_length"]',".inline-edit-row").val(g),jQuery('input[name="_width"]',".inline-edit-row").val(h),jQuery('input[name="_height"]',".inline-edit-row").val(i),jQuery('input[name="_stock"]',".inline-edit-row").val(l),jQuery('input[name="menu_order"]',".inline-edit-row").val(o),jQuery('select[name="_tax_status"] option[value="'+p+'"]',".inline-edit-row").attr("selected","selected"),jQuery('select[name="_tax_class"] option[value="'+q+'"]',".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="'+j+'"]',".inline-edit-row").attr("selected","selected"),jQuery('select[name="_stock_status"] option[value="'+k+'"]',".inline-edit-row").attr("selected","selected"),jQuery('select[name="_backorders"] option[value="'+r+'"]',".inline-edit-row").attr("selected","selected"),"yes"==m?jQuery('input[name="_featured"]',".inline-edit-row").attr("checked","checked"):jQuery('input[name="_featured"]',".inline-edit-row").removeAttr("checked"),"yes"==n?(jQuery(".stock_qty_field",".inline-edit-row").show().removeAttr("style"),jQuery('input[name="_manage_stock"]',".inline-edit-row").attr("checked","checked")):(jQuery(".stock_qty_field",".inline-edit-row").hide(),jQuery('input[name="_manage_stock"]',".inline-edit-row").removeAttr("checked"));var s=b.find(".product_type").text(),t=b.find(".product_is_virtual").text();"simple"==s||"external"==s?jQuery(".price_fields",".inline-edit-row").show().removeAttr("style"):jQuery(".price_fields",".inline-edit-row").hide(),"yes"==t?jQuery(".dimension_fields",".inline-edit-row").hide():jQuery(".dimension_fields",".inline-edit-row").show().removeAttr("style"),"grouped"==s?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")})});