woocommerce/assets/js/admin/product-ordering.min.js

1 line
1.7 KiB
JavaScript

jQuery(function(a){a("table.widefat tbody th, table.widefat tbody td").css("cursor","move"),a("table.widefat tbody").sortable({items:"tr:not(.inline-edit-row)",cursor:"move",axis:"y",containment:"table.widefat",scrollSensitivity:40,helper:function(b,c){return c.each(function(){a(this).width(a(this).width())}),c},start:function(b,c){c.placeholder.children().each(function(){var b=c.item.children().eq(c.placeholder.children().index(this)),d=a(this);a.each(b[0].attributes,function(a,b){d.attr(b.name,b.value)})}),c.item.hasClass("alternate")||c.item.css("background-color","#ffffff"),c.item.children("td, th").css("border-bottom-width","0"),c.item.css("outline","1px solid #dfdfdf")},stop:function(a,b){b.item.removeAttr("style"),b.item.children("td,th").css("border-bottom-width","1px")},update:function(b,c){a("table.widefat tbody th, table.widefat tbody td").css("cursor","default"),a("table.widefat tbody").sortable("disable");var d=c.item.find(".check-column input").val(),e=c.item.prev().find(".check-column input").val(),f=c.item.next().find(".check-column input").val();c.item.find(".check-column input").hide().after('<img alt="processing" src="images/wpspin_light.gif" class="waiting" style="margin-left: 6px;" />'),a.post(ajaxurl,{action:"woocommerce_product_ordering",id:d,previd:e,nextid:f},function(b){a.each(b,function(b,c){a("#inline_"+b+" .menu_order").html(c)}),c.item.find(".check-column input").show().siblings("img").remove(),a("table.widefat tbody th, table.widefat tbody td").css("cursor","move"),a("table.widefat tbody").sortable("enable")}),a("table.widefat tbody tr").each(function(){var b=a("table.widefat tbody tr").index(this);b%2===0?a(this).addClass("alternate"):a(this).removeClass("alternate")})}})});