1 line
30 KiB
JavaScript
1 line
30 KiB
JavaScript
|
jQuery(function(t){WP_Optimize=WP_Optimize(),"undefined"!=typeof WP_Optimize_Cache&&(WP_Optimize_Cache=WP_Optimize_Cache()),"undefined"!=typeof wp_optimize.minify&&(WP_Optimize_Minify=wp_optimize.minify.init())}),function(t){var e=[];t.fn.form_errors=function(){return this},t.fn.form_errors.add=function(t,i){!1===this.has_error(t)&&e.push({type:t,message:i})},t.fn.form_errors.remove=function(t){var i=this.has_error(t);i!==!1&&e.splice(i,1)},t.fn.form_errors.has_error=function(i){var o=!1;return t.each(e,function(t,e){console.log(t,e),i==e.type&&(o=t)}.bind(this)),o},t.fn.form_errors.has_errors=function(){return e.length>0}}(jQuery);var WP_Optimize=function(){function t(){if(T("#enable-schedule").length){var t=T("#enable-schedule").is(":checked");t?T("#wp-optimize-auto-options").css("opacity","1"):T("#wp-optimize-auto-options").css("opacity","0.5")}}function e(t,e,i){e="undefined"==typeof e?"#wp-optimize-wrap":e,i="undefined"==typeof i?15:i,T(t).hide().prependTo(e).slideDown("fast").delay(1e3*i).slideUp("fast",function(){T(this).remove()})}function i(t,i){var o={type:t,enable:i?1:0};T("#"+t+"_spinner").show(),A("enable_or_disable_feature",o,function(i){if(T("#"+t+"_spinner").hide(),i&&i.hasOwnProperty("output"))for(var o=0,n=i.output.length;o<n;o++){var a='<div class="updated"><p>'+i.output[o]+"</p></div>";e(a,"#"+t+"_notice")}i&&i.hasOwnProperty("messages")&&T("#"+t+"_actionmsg").html(i.messages.join(" - "))})}function o(t){t?T("#wp-optimize-wrap").addClass("wpo-mobile-menu-opened"):T("#wp-optimize-wrap").removeClass("wpo-mobile-menu-opened")}function n(){if(!Q){var t=T(".wpo-page[data-whichpage=WP-Optimize]"),e=t.find(".wpo_shade");e.removeClass("hidden"),A("get_database_tabs",{},function(e){Q=!0,e.hasOwnProperty("optimizations")&&t.find(".wp-optimize-optimizations-table-placeholder").replaceWith(e.optimizations),b(e),T(document).trigger("wpo_database_tabs_loaded")}).always(function(){e.addClass("hidden")})}}function a(t){var e="",t="undefined"==typeof t?"string":t,i=T("#wp-optimize-database-settings form input[name!='action'], #wp-optimize-database-settings form select, #wp-optimize-database-settings form textarea, #wp-optimize-general-settings form input[name!='action'], #wp-optimize-general-settings form textarea, #wp-optimize-general-settings form select, #wp-optimize-nav-tab-contents-optimize input[type='checkbox'], .wp-optimize-nav-tab-contents input[name^='enable-auto-backup-']");return"object"==t?e=i.serializeJSON({useIntKeysAsArrayIndex:!0}):(e=i.serialize(),T.each(T('#wp-optimize-database-settings form input[type=checkbox], #wp-optimize-general-settings form input[type=checkbox], .wp-optimize-nav-tab-contents input[name^="enable-auto-backup-"]').filter(function(t){return 0==T(this).prop("checked")}),function(t,i){var o="0";e+="&"+T(i).attr("name")+"="+o})),e}function s(){A("optimizations_done",{},function(){}),S=!1}function p(){if(!I.get_lock())return void(q>0&&console.log("WP-Optimize: process_queue(): queue is currently locked - exiting"));q>0&&console.log("WP-Optimize: process_queue(): got queue lock");var t=I.peek(),e=0,i=T("#wpo_all_sites"),o=i.data("active_site");if("object"==typeof t){if(data=t,t=t.optimization_id,e=data.blog_id,"undefined"==typeof o)i.data("active_site",e),r(e,0);else if(o!=e){var n=o;i.data("active_site",e),r(e,n)}}else data={};if("undefined"==typeof t){q>0&&console.log("WP-Optimize: process_queue(): queue is apparently empty - exiting"),I.unlock();var n=i.data("active_site");return r(0,n),void s()}if(q>0&&console.log("WP-Optimize: process_queue(): processing item: "+t),I.dequeue(),T(document).trigger(["do_optimization_",t,"_start"].join("")),"optimizetables"===t){T("#optimization_info_"+t).html(wpoptimize.optimizing_table+" "+data.optimization_table);var a=parseInt(wpoptimize.table_optimization_timeout)?parseInt(wpoptimize.table_optimization_timeout):12e4,l={timeout:a,error:function(e,o){if(S=!0,"timeout"===o?console.warn("The request to optimize the table "+data.optimization_table+" timed out after "+a/1e3+" seconds"):console.warn('There was an error when running the optimization "
|