Edit File: themify-global-styles.min.js
(function(c){window.themifyGS=function(){this.form=document.getElementById("tb_admin_new_gs");this.loadAddNewForm();this.addNew();this.deleteStyle();this.restore();this.scalePreview()};themifyGS.prototype.addNew=function(){var a=document.getElementsByClassName("tb_admin_save_gs");if(0!==a.length){var a=a[0],b=this;a.addEventListener("click",function(a){a.preventDefault();b.validateForm()?(a.target.text=themifyGlobalStylesVars.messages.creating,c.ajax({type:"POST",url:themifyGlobalStylesVars.ajaxurl, dataType:"json",data:{action:"tb_save_custom_global_style",nonce:themifyGlobalStylesVars.nonce,form_data:c(b.form).serialize()},success:function(b){"failed"===b.status?(alert(b.msg),a.target.text=themifyGlobalStylesVars.messages.create):"success"===b.status?window.location=b.url:a.target.text=themifyGlobalStylesVars.messages.create}})):alert(themifyGlobalStylesVars.messages.formValid)})}};themifyGS.prototype.validateForm=function(){var a=!0,b=c(this.form).serializeArray();jQuery.each(b,function(b, c){if(""==c.value)return a=!1});return a};themifyGS.prototype.loadAddNewForm=function(){var a=c(".tb_add_new_gs");0!==a.length&&a.magnificPopup({type:"inline",midClick:!0,callbacks:{close:function(){document.getElementById("tb_admin_new_gs").reset()}}})};themifyGS.prototype.deleteStyle=function(){var a=c(".tb_remove_gs");0!==a.length&&a.click(function(a){a.preventDefault();var b=c(this);a=b.parents(".tb_admin_gs_list").data("list");window.confirm("publish"===a?themifyGlobalStylesVars.messages.deleteConfirm: themifyGlobalStylesVars.messages.deleteConfirm2)&&(b.parents(".tb_gs_element").fadeOut(),c.ajax({type:"POST",url:themifyGlobalStylesVars.ajaxurl,dataType:"json",data:{action:"tb_delete_global_style",nonce:themifyGlobalStylesVars.nonce,status:a,id:b.attr("data-id")},success:function(a){"failed"===a.status&&(alert(a.msg),b.parents(".tb_gs_element").fadeIn())}}))})};themifyGS.prototype.restore=function(){var a=c(".tb_gs_restore");0!==a.length&&a.click(function(a){a.preventDefault();var b=c(this);b.parents(".tb_gs_element").fadeOut(); c.ajax({type:"POST",url:themifyGlobalStylesVars.ajaxurl,dataType:"json",data:{action:"tb_restore_global_style",nonce:themifyGlobalStylesVars.nonce,id:b.attr("data-id")},success:function(a){"failed"===a.status&&(alert(a.msg),b.parents(".tb_gs_element").fadeIn())}})})};themifyGS.prototype.scalePreview=function(){c(".themify_builder_content").each(function(){var a=c(this),b=a.parent(),b=Math.min(b.width()/a.outerWidth(),b.height()/a.outerHeight());a.css({transform:"translate(-50%, -50%) scale("+b+")"})})}; new themifyGS})(jQuery,window,document);
Back to File Manager