1 line
30 KiB
JavaScript
1 line
30 KiB
JavaScript
|
var CartFlowsAjaxQueue=function(){var s=[];return{add:function(t){s.push(t)},remove:function(t){-1<jQuery.inArray(t,s)&&s.splice($.inArray(t,s),1)},run:function(){var t,e=this;s.length?(t=s[0].complete,s[0].complete=function(){"function"==typeof t&&t(),s.shift(),e.run.apply(e,[])},jQuery.ajax(s[0])):e.tid=setTimeout(function(){e.run.apply(e,[])},1e3)},stop:function(){s=[],clearTimeout(this.tid)}}}();!function(l){CartFlowsImport={doc:l(document),wrap:l(".wcf-flow-steps-data-wrap"),inner:l(".wcf-flow-steps-data-wrap-importer"),post_id:l("#post_ID").val(),_ref:null,_api_step_type:{},_api_params:{},all_steps:0,remaining_steps:0,remaining_install_plugins:0,remaining_active_plugins:0,woo_required_steps:["checkout","upsell","downsell","thankyou","optin"],step_order:["landing","checkout","upsell","downsell","thankyou","optin"],new_step_names:{landing:"Landing",checkout:"Checkout (Woo)",upsell:"Upsell (Woo)",downsell:"Downsell (Woo)",thankyou:"Thank You (Woo)",optin:"Optin (Woo)"},init:function(){var t;this._bind(),"other"!==CartFlowsImportVars.default_page_builder&&(l(".post-type-cartflows_flow").hasClass("edit-php")&&this._process_cache_remote_flows(),l(".post-type-cartflows_flow").hasClass("post-php")&&this._process_cache_remote_steps()),l(".post-type-cartflows_flow").hasClass("edit-php")&&null!==this._getParamFromURL("add-new-flow")&&this._render_remote_flows(),l(".post-type-cartflows_flow").hasClass("post-php")&&null!==this._getParamFromURL("add-new-step")&&this._render_remote_steps(),!this._getParamFromURL("highlight-step-id")||(t=l('.wcf-step-wrap[data-id="'+this._getParamFromURL("highlight-step-id")+'"]')).length&&l("html, body").animate({scrollTop:t.offset().top},1500),l(".post-type-cartflows_flow").hasClass("edit-php")&&((t=l(".edit-php.post-type-cartflows_flow").find(".page-title-action:first")).after('<a href="'+CartFlowsImportVars.export_url+'" class="page-title-action">Export</a>'),t.after('<a href="'+CartFlowsImportVars.import_url+'" class="page-title-action">Import</a>'))},_getParamFromURL:function(t,e){e=e||window.location.href,t=t.replace(/[\[\]]/g,"\\$&");e=new RegExp("[?&]"+t+"(=([^&#]*)|&|#|$)").exec(e);return e?e[2]?decodeURIComponent(e[2].replace(/\+/g," ")):"":null},_bind:function(){var t=CartFlowsImport;t.doc.on("click",".wcf-install-plugin",t._install_plugin),t.doc.on("cartflows-api-request-fail",t._api_request_failed),t.doc.on("click","#wcf-get-started-steps a, .wcf-create-from-scratch-link",t._toggle_ready_templates),t.doc.on("click",".cartflows-flow-import-blank",t._create_default_flow),t.doc.on("click","#wcf-remote-flow-importer .wcf-page-builder-links a",t._filterFlowPageBuilderClick),t.doc.on("click","#wcf-remote-step-importer #wcf-categories .step-type-filter-links a",t._filterBlankStepCategoryClick),t.doc.on("change","#wcf-remote-step-importer #wcf-scratch-steps-categories .step-type-filter-links",t._filterBlankStepCategoryChange),t.doc.on("click","#wcf-get-started-steps",t._filterBlankStepCategoryChange),t.doc.on("click","#wcf-remote-step-importer .wcf-page-builder-links a",t._filterStepPageBuilderClick),t.doc.on("click",".cartflows-step-import-blank:not(.get-pro)",t._create_blank_step),t.doc.on("click","#wcf-remote-step-importer .cartflows-step-import",t._process_import_step),t.doc.on("click","#wcf-remote-flow-importer .cartflows-step-import",t._process_import_flow),t.doc.on("click",".cartflows-preview-flow-step",t._preview_individual),t.doc.on("add_template_to_page-fail",t._add_template_to_page_fail),l("body").on("thickbox:iframe:loaded",t._previewLoaded),l(document).on("keyup input","#wcf-remote-step-importer .wcf-flow-search-input",t._remote_step_search),l(document).on("click",".actions a",t._previewResponsive),l(document).on("click",".page-title-action:first",t._render_remote_flows),l(document).on("click",".wcf-trigger-popup",t._render_remote_steps),l(document).on("click",".wcf-templates-popup-overlay",t._close_template_popup),l(document).on("click",".wcf-popup-close-wrap .close-icon",t._close_template_popup),l(document).on("wp-plugin-install-success",t._installSuccess),l(document).on("cli
|