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

1 line
1.6 KiB
JavaScript

jQuery(function(e){e("table.widefat.wp-list-table tr").append('<td class="column-handle"></td>'),e("table.widefat.wp-list-table").sortable({items:"tbody tr:not(.inline-edit-row)",cursor:"move",handle:".column-handle",axis:"y",forcePlaceholderSize:!0,helper:"clone",opacity:.65,placeholder:"product-cat-placeholder",scrollSensitivity:40,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 #aaa")},stop:function(e,t){t.item.removeAttr("style"),t.item.children("td, th").css("border-bottom-width","1px")},update:function(t,i){var n,a,d=i.item.find(".check-column input").val(),o=i.item.find(".parent").html(),l=i.item.prev().find(".check-column input").val(),r=i.item.next().find(".check-column input").val();l!==undefined&&(n=i.item.prev().find(".parent").html())!==o&&(l=undefined),r!==undefined&&(a=i.item.next().find(".parent").html())!==o&&(r=undefined),l===undefined&&r===undefined||r===undefined&&a===l||r!==undefined&&n===d?e("table.widefat.wp-list-table").sortable("cancel"):(i.item.find(".check-column input").hide().after('<img alt="processing" src="images/wpspin_light.gif" class="waiting" style="margin-left: 6px;" />'),e.post(ajaxurl,{action:"woocommerce_term_ordering",id:d,nextid:r,thetaxonomy:woocommerce_term_ordering_params.taxonomy},function(e){"children"===e?window.location.reload():i.item.find(".check-column input").show().siblings("img").remove()}),e("table.widefat tbody tr").each(function(){jQuery("table.widefat tbody tr").index(this)%2==0?jQuery(this).addClass("alternate"):jQuery(this).removeClass("alternate")}))}})});