View file File name : cache-3-5-0.min.js Content :var WP_Optimize_Cache=function(){function e(){var e={};return i(".cache-settings").each(function(){var a=i(this),o=a.attr("name");a.is('input[type="checkbox"]')?e[o]=a.is(":checked")?1:0:a.is("textarea")?e[o]=a.val().split("\n"):e[o]=a.val()}),i(".cache-settings-array").each(function(){var a=i(this),o=a.attr("name");e.hasOwnProperty(o)||(e[o]=[]),a.is('input[type="checkbox"]')?"value"==a.data("saveas")?a.is(":checked")&&e[o].push(a.val()):e[o].push(a.is(":checked")?1:0):a.is("textarea")?e[o].push(a.val().split("\n")):e[o].push(a.val())}),e}function a(){var e=n.add_agent({command:"get_cache_preload_status",callback:o,_keep:!1});null!==e&&p.push(e)}function o(e){e.done?(u.val(wpoptimize.run_now),u.data("running",!1)):(u.val(wpoptimize.cancel),u.data("running",!0),a()),w.text(e.message),t(e)}function t(e){i("#wpo_current_cache_size_information").text(wpoptimize.current_cache_size+" "+e.size),i("#wpo_current_cache_file_count").text(wpoptimize.number_of_files+" "+e.file_count)}var i=jQuery,s=wp_optimize.block_ui,r=wp_optimize.send_command,n=WP_Optimize_Heartbeat(),p=[],c=i("#wp_optimize_browser_cache_enable"),_=i("#wp-optimize-purge-cache"),l=i("#enable_page_caching"),d=i("#page_cache_length_value");_.on("click",function(){var e=i(this),o=e.next(),s=o.next();return!e.prop("disabled")&&(e.prop("disabled",!0),o.show(),void r("purge_page_cache",{},function(i){e.prop("disabled",!1),o.hide(),s.show(),setTimeout(function(){s.fadeOut("slow",function(){s.hide()}),a()},5e3),t(i)}))}),i("body").on("wpo_purge_cache",function(){_.trigger("click")}),c.closest("form").on("submit",function(e){return e.preventDefault(),c.trigger("click"),!1}),d.on("change",function(){var e=parseInt(d.val(),10);i('#preload_schedule_type option[value="wpo_use_cache_lifespan"]').prop("disabled",isNaN(e)||e<=0)}),i("#wp_optimize_gzip_compression_enable").on("click",function(){var e=i(this),a=e.next();a.show(),r("enable_gzip_compression",{enable:e.data("enable")},function(o){var t=i("#wpo_gzip_compression_status");o?(o.enabled?(e.text(wpoptimize.disable),e.data("enable","0"),t.removeClass("wpo-disabled").addClass("wpo-enabled")):(e.text(wpoptimize.enable),e.data("enable","1"),t.addClass("wpo-disabled").removeClass("wpo-enabled")),o.message?i("#wpo_gzip_compression_error_message").text(o.message).show():i("#wpo_gzip_compression_error_message").hide(),o.output?i("#wpo_gzip_compression_output").html(o.output).show():i("#wpo_gzip_compression_output").hide()):alert(wpoptimize.error_unexpected_response),a.hide()}).fail(function(){alert(wpoptimize.error_unexpected_response),a.hide()})}),i(".wpo-refresh-gzip-status").on("click",function(e){e.preventDefault(),$link=i(this),$link.addClass("loading"),r("get_gzip_compression_status",null,function(e){$link.removeClass("loading");var a=i("#wpo_gzip_compression_status");e.hasOwnProperty("status")?e.status?a.removeClass("wpo-disabled").addClass("wpo-enabled"):a.addClass("wpo-disabled").removeClass("wpo-enabled"):e.hasOwnProperty("error")&&(alert(e.error),console.log("Gzip status error code: "+e.code),console.log("Gzip status error message: "+e.message))})}),c.on("click",function(){var e=i("#wpo_browser_cache_expire_days"),a=i("#wpo_browser_cache_expire_hours"),o=parseInt(e.val(),10),t=parseInt(a.val(),10),s=i(this),n=s.next();return isNaN(o)&&(o=0),isNaN(t)&&(t=0),o<0||t<0?(i("#wpo_browser_cache_error_message").text(wpoptimize.please_use_positive_integers).show(),!1):t>23?(i("#wpo_browser_cache_error_message").text(wpoptimize.please_use_valid_values).show(),!1):(i("#wpo_browser_cache_error_message").hide(),e.val(o),a.val(t),n.show(),void r("enable_browser_cache",{browser_cache_expire_days:o,browser_cache_expire_hours:t},function(e){var a=i("#wpo_browser_cache_status"),o=i("#wpo_enable_browser_cache");e?(e.enabled?(s.text(wpoptimize.update),a.removeClass("wpo-disabled").addClass("wpo-enabled"),o.val("true")):(s.text(wpoptimize.enable),a.addClass("wpo-disabled").removeClass("wpo-enabled"),o.val("false")),e.message?i("#wpo_browser_cache_message").text(e.message).show():i("#wpo_browser_cache_message").hide(),e.error_message?i("#wpo_browser_cache_error_message").text(e.error_message).show():i("#wpo_browser_cache_error_message").hide(),e.output?i("#wpo_browser_cache_output").html(e.output).show():i("#wpo_browser_cache_output").hide()):alert(wpoptimize.error_unexpected_response),n.hide()}).fail(function(){alert(wpoptimize.error_unexpected_response),n.hide()}))}),i("#wp-optimize-save-cache-settings, #wp-optimize-save-cache-advanced-rules, #wp-optimize-save-cache-preload-settings").on("click",function(){var a=i(this),o=a.next(),t=o.next();o.show(),s(wpoptimize.saving),r("save_cache_settings",{"cache-settings":e()},function(e){if(e.hasOwnProperty("js_trigger")&&i(document).trigger(e.js_trigger,e),e.hasOwnProperty("error")?(console.log(e.error),wp_optimize.notices.show_notice(e.error.code,e.error.message)):i(".wpo-error__enabling-cache").addClass("wpo_hidden").find("p").text(""),e.hasOwnProperty("warnings")){console.log(e.warnings),i(".wpo-warnings__enabling-cache").removeClass("wpo_hidden").find("p").text(e.warnings_label);var a=i(".wpo-warnings__enabling-cache").find("ul").html("");i.each(e.warnings,function(e,o){a.append("<li>"+o+"</li>")})}else i(".wpo-warnings__enabling-cache").addClass("wpo_hidden").find("p").text("");if(e.hasOwnProperty("advanced_cache_file_writing_error")?i("#wpo_advanced_cache_output").text(e.advanced_cache_file_content).show():i("#wpo_advanced_cache_output").hide(),l.prop("checked",e.enabled),l.is(":checked")?(i(".purge-cache").show(),i("#wp_optimize_run_cache_preload").prop("disabled",!1),i("#wp_optimize_run_minify_preload").prop("disabled",!0),i("#minify-preload").show()):(i(".purge-cache").hide(),i("#wp_optimize_run_cache_preload").prop("disabled",!0),i("#wp_optimize_run_minify_preload").prop("disabled",!1),i("#minify-preload").hide()),e.result)t.show(),setTimeout(function(){t.fadeOut("slow",function(){t.hide()})},5e3);else{var o=i(".wp-optimize-nav-tab-contents .notice:visible").closest(".wp-optimize-nav-tab-contents").attr("id"),s="cache";if(/wpo_cache-(.+)-contents/.test(o)){var r=/wpo_cache-(.+)-contents/.exec(o);s=r[1]}i('.wpo-page.active .nav-tab-wrapper a[data-tab="'+s+'"]').trigger("click");var n=i(".wpo-page.active").offset();window.scroll(0,n.top-20)}}).always(function(){i.unblockUI(),o.hide()})}),l.on("change",function(){i(".wpo-error__enabling-cache").addClass("wpo_hidden"),i(".wpo-warnings__enabling-cache").addClass("wpo_hidden"),i("#wpo_advanced_cache_output").hide(),i("#wp-optimize-save-cache-settings").trigger("click")});var u=i("#wp_optimize_run_cache_preload"),w=i("#wp_optimize_preload_cache_status"),h=i("#enable_schedule_preload"),g=i("#preload_schedule_type");h.on("change",function(){h.prop("checked")?g.prop("disabled",!1):g.prop("disabled",!0)}),h.trigger("change"),u.on("click",function(){var e=i(this),o=e.data("running"),t=w.text();e.prop("disabled",!0),o?(e.data("running",!1),n.cancel_agents(p),r("cancel_cache_preload",null,function(e){e&&e.hasOwnProperty("message")&&w.text(e.message)}).always(function(){e.val(wpoptimize.run_now),e.prop("disabled",!1)})):(w.text(wpoptimize.starting_preload),e.data("running",!0),r("run_cache_preload",null,null,!0,{timeout:3e3}).always(function(o){try{var i=wpo_parse_json(o)}catch(s){}if(i&&i.error&&"timeout"!==i.statusText){var r=wpoptimize.error_unexpected_response;return"function"!=typeof i.error?r=i.error:i.status&&(r=i.status+": "+i.statusText),alert(r),w.text(t),e.prop("disabled",!1),void e.data("running",!1)}w.text(wpoptimize.loading_urls),e.val(wpoptimize.cancel),e.prop("disabled",!1),a()}))}),u.data("running")&&a();var m=i("#wpo-auto-preload-after-purge");m.on("click",function(){var e=this;e.disabled=!0,r("save_cache_auto_preload_option",{enabled:!!e.checked},function(a){e.disabled=!1})}),wp_optimize.cache_settings=e};