woocommerce/assets/js/admin/wc-product-export.min.js

1 line
1.5 KiB
JavaScript
Raw Normal View History

2017-06-19 11:49:34 +00:00
!function(o,e){var r=function(o){this.$form=o,this.xhr=!1,this.$form.find(".woocommerce-exporter-progress").val(0),this.processStep=this.processStep.bind(this),o.on("submit",{productExportForm:this},this.onSubmit)};r.prototype.onSubmit=function(e){e.preventDefault(),e.data.productExportForm.$form.addClass("woocommerce-exporter__exporting"),e.data.productExportForm.$form.find(".woocommerce-exporter-progress").val(0),e.data.productExportForm.$form.find(".woocommerce-exporter-button").prop("disabled",!0),e.data.productExportForm.processStep(1,o(this).serialize(),"")},r.prototype.processStep=function(r,t,c){var p=this,s=o(".woocommerce-exporter-columns").val(),a=o("#woocommerce-exporter-meta:checked").length?1:0,m=o(".woocommerce-exporter-types").val();o.ajax({type:"POST",url:ajaxurl,data:{form:t,action:"woocommerce_do_ajax_product_export",step:r,columns:c,selected_columns:s,export_meta:a,export_types:m,security:wc_product_export_params.export_nonce},dataType:"json",success:function(o){o.success&&("done"===o.data.step?(p.$form.find(".woocommerce-exporter-progress").val(o.data.percentage),e.location=o.data.url,setTimeout(function(){p.$form.removeClass("woocommerce-exporter__exporting"),p.$form.find(".woocommerce-exporter-button").prop("disabled",!1)},2e3)):(p.$form.find(".woocommerce-exporter-progress").val(o.data.percentage),p.processStep(parseInt(o.data.step,10),t,o.data.columns)))}}).fail(function(o){e.console.log(o)})},o.fn.wc_product_export_form=function(){return new r(this),this},o(".woocommerce-exporter").wc_product_export_form()}(jQuery,window);