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

1 line
1.6 KiB
JavaScript

jQuery(function(a){a("table.widefat.wp-list-table tbody th, table.widefat tbody td").css("cursor","move"),a("table.widefat.wp-list-table").sortable({items:"tbody tr:not(.inline-edit-row)",cursor:"move",axis:"y",forcePlaceholderSize:!0,helper:"clone",opacity:.65,placeholder:"product-cat-placeholder",scrollSensitivity:40,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 #aaa")},stop:function(a,b){b.item.removeAttr("style"),b.item.children("td,th").css("border-bottom-width","1px")},update:function(b,c){var d=c.item.find(".check-column input").val(),e=c.item.find(".parent").html(),f=c.item.prev().find(".check-column input").val(),g=c.item.next().find(".check-column input").val(),h=void 0;if(void 0!=f){var h=c.item.prev().find(".parent").html();h!=e&&(f=void 0)}var i=void 0;return void 0!=g&&(i=c.item.next().find(".parent").html(),i!=e&&(g=void 0)),void 0==f&&void 0==g||void 0==g&&i==f||void 0!=g&&h==d?void a("table.widefat.wp-list-table").sortable("cancel"):(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_term_ordering",id:d,nextid:g,thetaxonomy:woocommerce_term_ordering_params.taxonomy},function(a){"children"==a?window.location.reload():c.item.find(".check-column input").show().siblings("img").remove()}),void a("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")}))}})});