1
2
3
|
/* Do not modify this file directly. It is compiled from other files. */
/* jshint onevar: false, smarttabs: true */
!function(t){var n,a,e;e={init:function(){var i,o,r=this;return this.on("keypress.manyItemsTable",function(t){13===t.which&&(t.preventDefault(),"function"==typeof FormData&&e.submitRow.apply(r),e.addRow.apply(r))}).on("focus.manyItemsTable",":input",function(){r.data("currentRow",t(this).parents("tr:first"))}),i=this.find("tbody:last"),o=i.find("tr:first").clone(),this.data("form",this.parents("form:first")),this.data("tbody",i),this.data("row",o),this.data("currentRow",o),n=t("#nova-menu-tax"),a=t("#_wpnonce"),this},destroy:function(){return this.off(".manyItemsTable"),this},submitRow:function(){var e,i,o,r;return e=this.data("currentRow"),i=e.find(":input"),o=this.data("form").find(":input").not(i).attr("disabled",!0).end(),r=new FormData(this.data("form").get(0)),r.append("ajax","1"),r.append("nova_menu_tax",n.val()),r.append("_wpnonce",a.val()),o.attr("disabled",!1),t.ajax({url:"",type:"POST",data:r,processData:!1,contentType:!1}).complete(function(t){e.html(t.responseText)}),i.attr("disabled",!0),this},addRow:function(){var t=this.data("row").clone();return t.appendTo(this.data("tbody")),t.find(":input:first").focus(),this}},t.fn.manyItemsTable=function(n){return e[n]?e[n].apply(this,Array.prototype.slice.call(arguments,1)):"object"!=typeof n&&n?(t.error("Method "+n+" does not exist on jQuery.manyItemsTable"),this):e.init.apply(this,arguments)},t.fn.clickAddRow=function(){var n=this.find("tbody:last"),a=n.find("tr:first").clone();t(a).find("input, textarea").val(""),t(a).appendTo(n)}}(jQuery),jQuery(".many-items-table").one("focus",":input",function(t){jQuery(t.delegateTarget).manyItemsTable()}),jQuery(".many-items-table").on("click","a.nova-new-row",function(t){jQuery(t.delegateTarget).clickAddRow()});
|