Current File : /home/inlingua/www/crm/ninexb/wp-content/plugins/futurio-extra/inc/demo/assets/js/demos.min.js |
!function(t){"use strict";t(document).ready(function(){e.init()});var e={importData:{},allowPopupClosing:!0,init:function(){var e=this;this.categoriesFilter(),t(".fwp-search-input").on("keyup",function(){0<t(this).val().length?(t(".fwp-demo-wrap .themes").find(".theme-wrap").hide(),t(".fwp-demo-wrap .themes").find('.theme-wrap[data-name*="'+t(this).val().toLowerCase()+'"]').show()):t(".fwp-demo-wrap .themes").find(".theme-wrap").show()}),t(".fwp-demo-wrap .theme-actions a.button").on("click",function(t){t.stopPropagation()}),t(".fwp-open-popup").click(function(a){a.preventDefault();var i=t(this).data("demo-id"),o=t(".preview-"+i),n=t(".preview-all-"+i);o.show(),n.show(),e.getDemoData(i)}),t(document).on("click",".install-now",this.installNow),t(document).on("click",".activate-now",this.activatePlugins),t(document).on("wp-plugin-install-success",this.installSuccess),t(document).on("wp-plugin-installing",this.pluginInstalling),t(document).on("wp-plugin-install-error",this.installError)},categoriesFilter:function(){var e=t(".fwp-demo-wrap .themes").find(".theme-wrap"),a="fwp-is-fadeout",i=function(){var i=t.Deferred();return e.addClass(a),setTimeout(function(){e.removeClass(a).hide(),i.resolve()},200),i.promise()},o=function(t,a){var i=t?'[data-categories*="'+t+'"]':"div";"all"===t&&(i="div"),e.filter(i).show().addClass("fwp-is-fadein"),setTimeout(function(){e.removeClass("fwp-is-fadein"),a.resolve()},200)},n=function(e){var a=t.Deferred();return i().done(function(){o(e,a)}),a};t(".fwp-navigation-link").on("click",function(e){e.preventDefault(),t(this).parent().siblings().removeClass("active"),t(this).parent().addClass("active");var a=this.hash.slice(1),i=t(".fwp-demo-wrap .themes");i.css("min-width",i.outerHeight()),n(a).done(function(){i.removeAttr("style")})})},getDemoData:function(e){var a=this;t.ajax({url:futurioDemos.ajaxurl,type:"get",data:{action:"futurio_ajax_get_import_data",demo_name:e,security:futurioDemos.futurio_import_data_nonce},complete:function(e){a.importData=t.parseJSON(e.responseText)}}),t.ajax({url:futurioDemos.ajaxurl,type:"get",data:{action:"futurio_ajax_get_demo_data",demo_name:e,demo_data_nonce:futurioDemos.demo_data_nonce},complete:function(i){a.runPopup(i);var o=t(".preview-"+e),n=t(".preview-all-"+e);o.hide(),n.hide()}})},runPopup:function(e){var a=this,i=t("html").innerWidth();t("html").css("overflow","hidden");var o=t("html").innerWidth();t("html").css("margin-right",o-i),t("#fwp-demo-popup-wrap").fadeIn(),t(e.responseText).appendTo(t("#fwp-demo-popup-content")),t(".fwp-demo-popup-close, .fwp-demo-popup-overlay").on("click",function(t){t.preventDefault(),!0===a.allowPopupClosing&&a.closePopup()}),t(".fwp-plugins-next").on("click",function(e){e.preventDefault(),t("#fwp-demo-plugins").hide(),t("#fwp-demo-import-form").show()}),t("#fwp-demo-import-form").submit(function(e){e.preventDefault();var i=t(this).find('[name="futurio_import_demo"]').val(),o=t(this).find('[name="futurio_import_demo_data_nonce"]').val(),n=[];t(this).find('input[type="checkbox"]').each(function(){!0===t(this).is(":checked")&&n.push(t(this).attr("name"))}),t(this).hide(),t(".fwp-loader").show(),a.importContent({demo:i,nonce:o,contentToImport:n,isXML:t("#futurio_import_xml").is(":checked")})})},importContent:function(e){var a,i,o=this,n=(Date.now(),{futurio_import_demo:e.demo,futurio_import_demo_data_nonce:e.nonce});if(this.allowPopupClosing=!1,t(".fwp-demo-popup-close").fadeOut(),0===e.contentToImport.length){setTimeout(function(){t(".fwp-loader").hide(),t(".fwp-last").show()},1e3),t.ajax({url:futurioDemos.ajaxurl,type:"post",data:{action:"futurio_after_import",futurio_import_demo:e.demo,futurio_import_demo_data_nonce:e.nonce,futurio_import_is_xml:e.isXML},complete:function(t){}}),this.allowPopupClosing=!0,t(".fwp-demo-popup-close").fadeIn();return}for(var s in this.importData){var p=t.inArray(this.importData[s].input_name,e.contentToImport);if(-1!==p){a=s,e.contentToImport.splice(p,1),n.action=this.importData[s].action;break}}t(".fwp-import-status").append('<p class="fwp-importing">'+this.importData[a].loader+"</p>");var r=t.ajax({url:futurioDemos.ajaxurl,type:"post",data:n,complete:function(a){clearTimeout(i);var n=!0;if(500===a.status||502===a.status||503===a.status)t(".fwp-importing").addClass("fwp-importing-failed").removeClass("fwp-importing").text(futurioDemos.content_importing_error+" "+a.status);else if(-1!==a.responseText.indexOf("successful import"))t(".fwp-importing").addClass("fwp-imported").removeClass("fwp-importing");else{var s=t.parseJSON(a.responseText),p="";for(var r in s)p+=s[r],"xml_import_error"===r&&(n=!1);t(".fwp-importing").addClass("fwp-importing-failed").removeClass("fwp-importing").text(p),o.allowPopupClosing=!0,t(".fwp-demo-popup-close").fadeIn()}!0===n&&o.importContent(e)}});i=setTimeout(function(){r.abort(),o.allowPopupClosing=!0,t(".fwp-demo-popup-close").fadeIn(),t(".fwp-importing").addClass("fwp-importing-failed").removeClass("fwp-importing").text(futurioDemos.content_importing_error)},9e5)},closePopup:function(){t("html").css({overflow:"","margin-right":""}),t(".preview-icon").hide(),t(".preview-all").hide(),t("#fwp-demo-popup-wrap").fadeOut(),setTimeout(function(){t("#fwp-demo-popup-content").html("")},600)},installNow:function(e){e.preventDefault();var a=t(e.target),i=t(document);!(a.hasClass("updating-message")||a.hasClass("button-disabled"))&&(wp.updates.shouldRequestFilesystemCredentials&&!wp.updates.ajaxLocked&&(wp.updates.requestFilesystemCredentials(e),i.on("credential-modal-cancel",function(){t(".install-now.updating-message").removeClass("updating-message").text(wp.updates.l10n.installNow),wp.a11y.speak(wp.updates.l10n.updateCancel,"polite")})),wp.updates.installPlugin({slug:a.data("slug")}))},activatePlugins:function(e){e.preventDefault();var a=t(e.target),i=a.data("init");a.data("slug"),!(a.hasClass("updating-message")||a.hasClass("button-disabled"))&&(a.addClass("updating-message button-primary").html(futurioDemos.button_activating),t.ajax({url:futurioDemos.ajaxurl,type:"POST",data:{action:"futurio_ajax_required_plugins_activate",init:i,security:futurioDemos.futurio_import_data_nonce}}).done(function(t){t.success&&a.removeClass("button-primary install-now activate-now updating-message").attr("disabled","disabled").addClass("disabled").text(futurioDemos.button_active)}))},installSuccess:function(e,a){e.preventDefault();var i=t(".fwp-plugin-"+a.slug).find(".button"),o=i.data("init");i.removeClass("install-now installed button-disabled updated-message").addClass("updating-message").html(futurioDemos.button_activating),setTimeout(function(){t.ajax({url:futurioDemos.ajaxurl,type:"POST",data:{action:"futurio_ajax_required_plugins_activate",init:o,security:futurioDemos.futurio_import_data_nonce}}).done(function(t){t.success?i.removeClass("button-primary install-now activate-now updating-message").attr("disabled","disabled").addClass("disabled").text(futurioDemos.button_active):i.removeClass("updating-message")})},1200)},pluginInstalling:function(e,a){e.preventDefault(),t(".fwp-plugin-"+a.slug).find(".button").addClass("updating-message")},installError:function(e,a){e.preventDefault(),t(".fwp-plugin-"+a.slug).removeClass("button-primary").addClass("disabled").html(wp.updates.l10n.installFailedShort)}}}(jQuery);