관리-도구
편집 파일: kkart-product-export.min.js
!function(n,i){var o=function(o){this.$form=o,this.xhr=!1,this.$form.find(".kkart-exporter-progress").val(0),this.processStep=this.processStep.bind(this),o.on("submit",{productExportForm:this},this.onSubmit),o.find(".kkart-exporter-types").on("change",{productExportForm:this},this.exportTypeFields)};o.prototype.onSubmit=function(o){o.preventDefault();var e=new Date,e="kkart-product-export-"+e.getDate()+"-"+(e.getMonth()+1)+"-"+e.getFullYear()+"-"+e.getTime()+".csv";o.data.productExportForm.$form.addClass("kkart-exporter__exporting"),o.data.productExportForm.$form.find(".kkart-exporter-progress").val(0),o.data.productExportForm.$form.find(".kkart-exporter-button").prop("disabled",!0),o.data.productExportForm.processStep(1,n(this).serialize(),"",e)},o.prototype.processStep=function(o,e,r,t){var c=this,p=n(".kkart-exporter-columns").val(),a=n("#kkart-exporter-meta:checked").length?1:0,s=n(".kkart-exporter-types").val(),m=n(".kkart-exporter-category").val();n.ajax({type:"POST",url:ajaxurl,data:{form:e,action:"kkart_do_ajax_product_export",step:o,columns:r,selected_columns:p,export_meta:a,export_types:s,export_category:m,filename:t,security:kkart_product_export_params.export_nonce},dataType:"json",success:function(o){o.success&&("done"===o.data.step?(c.$form.find(".kkart-exporter-progress").val(o.data.percentage),i.location=o.data.url,setTimeout(function(){c.$form.removeClass("kkart-exporter__exporting"),c.$form.find(".kkart-exporter-button").prop("disabled",!1)},2e3)):(c.$form.find(".kkart-exporter-progress").val(o.data.percentage),c.processStep(parseInt(o.data.step,10),e,o.data.columns,t)))}}).fail(function(o){i.console.log(o)})},o.prototype.exportTypeFields=function(){var o=n(".kkart-exporter-category");-1!==n.inArray("variation",n(this).val())?(o.closest("tr").hide(),o.val("").change()):o.closest("tr").show()},n.fn.kkart_product_export_form=function(){return new o(this),this},n(".kkart-exporter").kkart_product_export_form()}(jQuery,window);