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