5 lines
1.8 KiB
JavaScript
5 lines
1.8 KiB
JavaScript
|
/**
|
||
|
* Based on Simple Page Ordering by 10up (http://wordpress.org/extend/plugins/simple-page-ordering/)
|
||
|
*
|
||
|
* Modified - products have no children (non hierarchical)
|
||
|
*/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(e,t){t.children().each(function(){jQuery(this).width(jQuery(this).width())});return t},start:function(e,t){t.item.hasClass("alternate")||t.item.css("background-color","#ffffff");t.item.children("td,th").css("border-bottom-width","0");t.item.css("outline","1px solid #dfdfdf")},stop:function(e,t){t.item.removeAttr("style");t.item.children("td,th").css("border-bottom-width","1px")},update:function(e,t){jQuery("table.widefat tbody th, table.widefat tbody td").css("cursor","default");jQuery("table.widefat tbody").sortable("disable");var n=t.item.find(".check-column input").val(),r=t.item.find(".post_parent").html(),i=t.item.prev().find(".check-column input").val(),s=t.item.next().find(".check-column input").val();t.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:n,previd:i,nextid:s},function(e){jQuery.each(e,function(e,t){jQuery("#inline_"+e+" .menu_order").html(t)});t.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 e=jQuery("table.widefat tbody tr").index(this);e%2==0?jQuery(this).addClass("alternate"):jQuery(this).removeClass("alternate")})}});
|