File: /home/adventp/www/wp-content/themes/brooklyn/unite/core/admin/assets/js/unite-save-options.min.js
jQuery.noConflict();(function(a){a(document).ready(function(){function c(i,h){a(".ut-options-overlay").fadeIn("fast","",function(){if(!h){a(".ut-overlay-message.ut-"+i).slideDown("fast","",function(){setTimeout(function(){a(".ut-overlay-message.ut-"+i).slideUp("fast","",function(){a(".ut-options-overlay").fadeOut()})},2000)})}else{a(".ut-overlay-message.ut-"+i).slideDown("fast","",function(){a(".ut-error-message").html(h)})}})}a(document).on("click",".ut-view-message",function(h){a(".ut-popup-message").fadeIn();h.preventDefault()});a(document).on("click",".ut-close-overlay-message",function(h){a(".ut-overlay-message").slideUp("fast","",function(){a(".ut-popup-message").fadeOut();a(".ut-options-overlay").fadeOut()});h.preventDefault()});function d(){a(".ut-to-copy").each(function(){var h=a(this);h.find(".ut-option-element").prop("disabled",true)});if(a("#unite_options_export").length){a("#unite_options_export").prop("disabled",true)}}function e(){a(".ut-to-copy").each(function(){var h=a(this);h.find(".ut-option-element").prop("disabled",false)});if(a("#unite_options_export").length){a("#unite_options_export").prop("disabled",false)}}a("#unite-theme-options").submit(function(){d();if(tinyMCE.editors.length){tinyMCE.triggerSave()}var h=a(this).serialize();a.ajax({type:"POST",url:ajaxurl,data:{action:"save_theme_options","save-nonce":unite.SaveOptionsNonce,options:h},success:function(i){if(i.status&&typeof i!="undefined"&&typeof i==="object"){c(i.status)}else{if(i.status&&typeof i!="undefined"&&typeof i!="object"){c("error",i)}else{c("error",i)}}e()},error:function(){c("error");e()}});return false});a(document).on("click","#ut-toolbar-save-theme-options",function(h){a("#unite-theme-options").submit();h.preventDefault()});a(document).on("click",".ut-add-theme-layout",function(i){var h=a(this).siblings("input").val();a.ajax({type:"POST",url:ajaxurl,data:{action:"save_theme_layouts","save-nonce":unite.SaveLayoutsNonce,layouts_name:h},success:function(j){a(".ut-options-overlay").fadeIn(600,function(){location.reload()})},error:function(){}});i.preventDefault()});var g=false;function b(i,h){if(h===undefined||!h.length){return}a(".ut-layout-action").data("is-disabled",true);i.toggleClass("ut-blue-button ut-gray-button");if(!g){a("#ut-title-"+h).prop("readonly",false).removeClass("hidden").focus().val();i.data("is-disabled",false);g=true}else{a("#ut-title-"+h).prop("readonly",true).addClass("hidden");a.ajax({type:"POST",url:ajaxurl,data:{action:"rename_theme_layout","save-nonce":unite.SaveLayoutsNonce,ut_layout_id:h,"ut-layout-name":a("#ut-title-"+h).val()},success:function(j){if(j.status&&typeof j!=="undefined"&&typeof j==="object"){a("#ut-title-"+h).siblings("h4").text(a("#ut-title-"+h).val())}},});a(".ut-layout-action").data("is-disabled",false);g=false}}function f(h,i){if(h===undefined||!h.length||i===undefined||!i.length){return}a.ajax({type:"POST",url:ajaxurl,data:{action:i,"save-nonce":unite.SaveLayoutsNonce,ut_layout_id:h},success:function(j){if(j.status&&typeof j!=="undefined"&&typeof j==="object"){a(".ut-options-overlay").fadeIn(600,function(){c(j.status);location.reload()})}},error:function(){}})}a(document).on("click",".ut-layout-action",function(){var l=a(this),i=l.data("message"),k=l.data("layout-action"),h=l.data("layout-key");if(k==="rename_theme_layout"){if(l.data("is-disabled")){return false}b(l,h)}else{var j=confirm(i);if(j!==true){return false}else{f(h,k)}}})})})(jQuery);