%PDF- %PDF-
Direktori : /home/t/r/a/tradesc/www/albanie/wp-content/plugins/one-click-demo-import/assets/js/ |
Current File : /home/t/r/a/tradesc/www/albanie/wp-content/plugins/one-click-demo-import/assets/js/main.min.js |
jQuery(function(d){"use strict";function i(i){var t,o=jQuery.Deferred();return t=jQuery.Deferred(),n.addClass(e),setTimeout(function(){n.removeClass(e).hide(),t.resolve()},s),t.promise().done(function(){var t=i,e=o;t="all"!==t&&t?'[data-categories*="'+t+'"]':"div",n.filter(t).show().addClass("ocdi-is-fadein"),setTimeout(function(){n.removeClass(a),e.resolve()},s)}),o}var n,e,a,s;function c(t,e,i){return i.indexOf(t)===e}function l(t,e,i,o,n){var a=t[e].name;d.ajax({method:"POST",url:ocdi.ajax_url,data:{action:"ocdi_install_plugin",security:ocdi.ajax_nonce,slug:a},beforeSend:function(){var t=d(".plugin-item-"+a);t.find(".js-ocdi-plugin-item-info").empty(),t.find(".js-ocdi-plugin-item-error").empty(),t.addClass("plugin-item--loading")}}).done(function(t){var e=d(".plugin-item-"+a);e.removeClass("plugin-item--loading"),t.success?(e.addClass("plugin-item--active"),e.find("input[type=checkbox]").prop("disabled",!0)):(-1===t.data.indexOf("<p>")&&(t.data="<p>"+t.data+"</p>"),e.find(".js-ocdi-plugin-item-error").append(t.data),e.find("input[type=checkbox]").prop("checked",!1),n=!0)}).fail(function(t){var e=d(".plugin-item-"+a);e.removeClass("plugin-item--loading"),e.find(".js-ocdi-plugin-item-error").append("<p>"+t.statusText+" ("+t.status+")</p>"),n=!0}).always(function(){++e===t.length?(o&&(n?alert(ocdi.texts.plugin_install_failed):p(r("import"))),i.removeClass("ocdi-button-disabled")):l(t,e,i,o,n)})}function r(t){for(var e,i=window.location.search.substring(1).split("&"),o=0;o<i.length;o++)if((e=i[o].split("="))[0]===t)return e[1],decodeURIComponent(e[1]);return!1}function p(t){var e=new FormData;e.append("action","ocdi_import_demo_data"),e.append("security",ocdi.ajax_nonce),t&&e.append("selected",t),function i(o){d.ajax({method:"POST",url:ocdi.ajax_url,data:o,contentType:!1,processData:!1,beforeSend:function(){d(".js-ocdi-install-plugins-content").hide(),d(".js-ocdi-importing").show()}}).done(function(t){var e;void 0!==t.status&&"newAJAX"===t.status?i(o):void 0!==t.status&&"customizerAJAX"===t.status?((e=new FormData).append("action","ocdi_import_customizer_data"),e.append("security",ocdi.ajax_nonce),!0===ocdi.wp_customize_on&&e.append("wp_customize","on"),i(e)):void 0!==t.status&&"afterAllImportAJAX"===t.status?((e=new FormData).append("action","ocdi_after_import_data"),e.append("security",ocdi.ajax_nonce),i(e)):void 0!==t.message?(d(".js-ocdi-ajax-response").append(t.message),void 0!==t.title&&d(".js-ocdi-ajax-response-title").html(t.title),void 0!==t.subtitle&&d(".js-ocdi-ajax-response-subtitle").html(t.subtitle),d(".js-ocdi-importing").hide(),d(".js-ocdi-imported").show(),d(document).trigger("ocdiImportComplete")):(d(".js-ocdi-ajax-response").append('<img class="ocdi-imported-content-imported ocdi-imported-content-imported--error" src="'+ocdi.plugin_url+'assets/images/error.svg" alt="'+ocdi.texts.import_failed+'"><p>'+t+"</p>"),d(".js-ocdi-ajax-response-title").html(ocdi.texts.import_failed),d(".js-ocdi-ajax-response-subtitle").html("<p>"+ocdi.texts.import_failed_subtitle+"</p>"),d(".js-ocdi-importing").hide(),d(".js-ocdi-imported").show())}).fail(function(t){d(".js-ocdi-ajax-response").append('<img class="ocdi-imported-content-imported ocdi-imported-content-imported--error" src="'+ocdi.plugin_url+'assets/images/error.svg" alt="'+ocdi.texts.import_failed+'"><p>Error: '+t.statusText+" ("+t.status+")</p>"),d(".js-ocdi-ajax-response-title").html(ocdi.texts.import_failed),d(".js-ocdi-ajax-response-subtitle").html("<p>"+ocdi.texts.import_failed_subtitle+"</p>"),d(".js-ocdi-importing").hide(),d(".js-ocdi-imported").show()})}(e)}d(".js-ocdi-notice-wrapper").appendTo(".js-ocdi-admin-notices-container"),d(".js-ocdi-auto-start-manual-import").length&&p(!1),d(".js-ocdi-start-manual-import").on("click",function(t){t.preventDefault();var e=d(this);if(e.hasClass("ocdi-button-disabled"))return!1;t=new FormData;if(t.append("action","ocdi_upload_manual_import_files"),t.append("security",ocdi.ajax_nonce),d("#ocdi__content-file-upload").length&&d("#ocdi__content-file-upload").get(0).files.length){var i=d("#ocdi__content-file-upload")[0].files[0],o=i.name.split(".").pop();if(-1===["xml"].indexOf(o.toLowerCase()))return alert(ocdi.texts.content_filetype_warn),!1;t.append("content_file",i)}if(d("#ocdi__widget-file-upload").length&&d("#ocdi__widget-file-upload").get(0).files.length){o=d("#ocdi__widget-file-upload")[0].files[0],i=o.name.split(".").pop();if(-1===["json","wie"].indexOf(i.toLowerCase()))return alert(ocdi.texts.widgets_filetype_warn),!1;t.append("widget_file",o)}if(d("#ocdi__customizer-file-upload").length&&d("#ocdi__customizer-file-upload").get(0).files.length){i=d("#ocdi__customizer-file-upload")[0].files[0],o=i.name.split(".").pop();if(-1===["dat"].indexOf(o.toLowerCase()))return alert(ocdi.texts.customizer_filetype_warn),!1;t.append("customizer_file",i)}if(d("#ocdi__redux-file-upload").length&&d("#ocdi__redux-file-upload").get(0).files.length){o=d("#ocdi__redux-file-upload")[0].files[0],i=o.name.split(".").pop();if(-1===["json"].indexOf(i.toLowerCase()))return alert(ocdi.texts.redux_filetype_warn),!1;t.append("redux_file",o),t.append("redux_option_name",d("#ocdi__redux-option-name").val())}e.addClass("ocdi-button-disabled"),d.ajax({method:"POST",url:ocdi.ajax_url,data:t,contentType:!1,processData:!1}).done(function(t){t.success?window.location.href=ocdi.import_url:(alert(t.data),e.removeClass("ocdi-button-disabled"))}).fail(function(t){alert(t.statusText+" ("+t.status+")"),e.removeClass("ocdi-button-disabled")})}),d(".js-ocdi-cancel-manual-import").on("click",function(){d(".ocdi__file-upload-container-items input[type=file]").each(function(){d(this).val("").trigger("change")})}),d(document).on("change",".ocdi__file-upload-container-items input[type=file]",function(){var t=d(this),e=t.siblings("label"),i=!1;this.files&&0<this.files.length?(t.removeClass("ocdi-hide-input").blur(),e.hide()):(t.addClass("ocdi-hide-input"),e.show()),d(".ocdi__file-upload-container-items input[type=file]").each(function(){this.files&&0<this.files.length&&(i=!0)}),d(".js-ocdi-start-manual-import").prop("disabled",!i),d(".js-ocdi-cancel-manual-import").prop("disabled",!i)}),d(".ocdi-install-plugins-content-content .plugin-item.plugin-item--required input[type=checkbox]").on("click",function(t){return t.preventDefault(),!1}),d(".js-ocdi-install-plugins").on("click",function(t){t.preventDefault();var e,t=d(this);return!t.hasClass("ocdi-button-disabled")&&0!==(e=d(".ocdi-install-plugins-content-content .plugin-item input[type=checkbox]").serializeArray()).length&&(t.addClass("ocdi-button-disabled"),void l(e,0,t,!1,!1))}),d(".js-ocdi-install-plugins-before-import").on("click",function(t){t.preventDefault();var e,t=d(this);return!t.hasClass("ocdi-button-disabled")&&(0===(e=d(".ocdi-install-plugins-content-content .plugin-item:not(.plugin-item--disabled) input[type=checkbox]").serializeArray()).length?(p(r("import")),!1):(t.addClass("ocdi-button-disabled"),void l(e,0,t,!0,!1)))}),d(".js-ocdi-create-content").on("click",function(t){t.preventDefault();var e,t=d(this);return!t.hasClass("ocdi-button-disabled")&&0!==(e=d(".ocdi-create-content-content .content-item input[type=checkbox]").serializeArray()).length&&(t.addClass("ocdi-button-disabled"),void function i(o,n,a){var t=o[n],s=t.name;d.ajax({method:"POST",url:ocdi.ajax_url,data:{action:"ocdi_import_created_content",security:ocdi.ajax_nonce,slug:s},beforeSend:function(){var t=d(".content-item-"+s);t.find(".js-ocdi-content-item-info").empty(),t.find(".js-ocdi-content-item-error").empty(),t.addClass("content-item--loading")}}).done(function(t){var e;t.data&&t.data.refresh?i(o,n,a):((e=d(".content-item-"+s)).removeClass("content-item--loading"),t.success?e.find(".js-ocdi-content-item-info").append("<p>"+ocdi.texts.successful_import+"</p>"):e.find(".js-ocdi-content-item-error").append("<p>"+t.data+"</p>"))}).fail(function(t){var e=d(".content-item-"+s);e.removeClass("content-item--loading"),e.find(".js-ocdi-content-item-error").append("<p>"+t.statusText+" ("+t.status+")</p>")}).always(function(t){t.data&&t.data.refresh||(++n===o.length?a.removeClass("ocdi-button-disabled"):i(o,n,a))})}(e,0,t))}),d(".js-ocdi-install-coming-soon-plugin").on("click",function(t){t.preventDefault();var e=d(this);if(e.hasClass("button-disabled"))return!1;e.addClass("button-disabled"),d.ajax({method:"POST",url:ocdi.ajax_url,data:{action:"ocdi_install_plugin",security:ocdi.ajax_nonce,slug:"coming-soon"},beforeSend:function(){e.text(ocdi.texts.installing)}}).done(function(t){t.success?e.text(ocdi.texts.installed):(alert(t.data),e.text(ocdi.texts.install_plugin),e.removeClass("button-disabled"))}).fail(function(t){alert(t.statusText+" ("+t.status+")"),e.removeClass("button-disabled")})}),d(document).on("change",".ocdi--create-content .content-item input[type=checkbox]",function(t){var e=d(".ocdi--create-content .content-item input[type=checkbox]"),i=d(".js-ocdi-create-content-install-plugins-notice"),o=[];e.each(function(){var e,i,t=d(this);t.is(":checked")&&(o=o.concat((e=(e=t.data("plugins")).split(","),i=[],ocdi.missing_plugins.forEach(function(t){-1!==e.indexOf(t.slug)&&i.push(t.name)}),i)))}),0<(o=o.filter(c).join(", ")).length?(i.find(".js-ocdi-create-content-install-plugins-list").text(o),i.show()):(i.find(".js-ocdi-create-content-install-plugins-list").text(""),i.hide())}),n=d(".js-ocdi-gl-item-container").find(".js-ocdi-gl-item"),e="ocdi-is-fadeout",a="ocdi-is-fadein",s=200,d(".js-ocdi-nav-link").on("click",function(t){t.preventDefault(),d(this).parent().siblings().removeClass("active"),d(this).parent().addClass("active");var t=this.hash.slice(1),e=d(".js-ocdi-gl-item-container");e.css("min-width",e.outerHeight()),i(t).done(function(){e.removeAttr("style")})}),d(".js-ocdi-gl-search").on("keyup",function(t){(0<d(this).val().length?(d(".js-ocdi-gl-item-container").find(".js-ocdi-gl-item").hide(),d(".js-ocdi-gl-item-container").find('.js-ocdi-gl-item[data-name*="'+d(this).val().toLowerCase()+'"]')):d(".js-ocdi-gl-item-container").find(".js-ocdi-gl-item")).show()})});