bibhamrokhanpin/wp-content/__plugins/wp-optimize/js/cache-3-2-3.min.js

1 line
7.3 KiB
JavaScript
Raw Normal View History

2024-04-10 12:01:06 +00:00
var WP_Optimize_Cache=function(){function e(){var e={};return r(".cache-settings").each(function(){var a=r(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()}),r(".cache-settings-array").each(function(){var a=r(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(){d||(d=setInterval(function(){o()},5e3))}function o(){s("get_cache_preload_status",null,function(e){e.done?(_.val(wpoptimize.run_now),_.data("running",!1),clearInterval(d),d=null):(_.val(wpoptimize.cancel),_.data("running",!0)),l.text(e.message),t(e)})}function t(e){r("#wpo_current_cache_size_information").text(wpoptimize.current_cache_size+" "+e.size),r("#wpo_current_cache_file_count").text(wpoptimize.number_of_files+" "+e.file_count)}var r=jQuery,s=wp_optimize.send_command,n=r("#wp_optimize_browser_cache_enable"),i=r("#wp-optimize-purge-cache"),p=r("#enable_page_caching"),c=r("#page_cache_length_value");i.on("click",function(){var e=r(this),o=e.next(),n=o.next();o.show(),s("purge_page_cache",{},function(e){o.hide(),n.show(),setTimeout(function(){n.fadeOut("slow",function(){n.hide()}),a()},5e3),t(e)})}),r("body").on("wpo_purge_cache",function(){i.trigger("click")}),n.closest("form").on("submit",function(e){return e.preventDefault(),n.trigger("click"),!1}),c.on("change",function(){var e=parseInt(c.val(),10);r('#preload_schedule_type option[value="wpo_use_cache_lifespan"]').prop("disabled",isNaN(e)||e<=0)}),r("#wp_optimize_gzip_compression_enable").on("click",function(){var e=r(this),a=e.next();a.show(),s("enable_gzip_compression",{enable:e.data("enable")},function(o){var t=r("#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?r("#wpo_gzip_compression_error_message").text(o.message).show():r("#wpo_gzip_compression_error_message").hide(),o.output?r("#wpo_gzip_compression_output").html(o.output).show():r("#wpo_gzip_compression_output").hide()):alert(wpoptimize.error_unexpected_response),a.hide()}).fail(function(){alert(wpoptimize.error_unexpected_response),a.hide()})}),r(".wpo-refresh-gzip-status").on("click",function(e){e.preventDefault(),$link=r(this),$link.addClass("loading"),s("get_gzip_compression_status",null,function(e){$link.removeClass("loading");var a=r("#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))})}),n.on("click",function(){var e=r("#wpo_browser_cache_expire_days"),a=r("#wpo_browser_cache_expire_hours"),o=parseInt(e.val(),10),t=parseInt(a.val(),10),n=r(this),i=n.next();return isNaN(o)&&(o=0),isNaN(t)&&(t=0),o<0||t<0?(r("#wpo_browser_cache_error_message").text(wpoptimize.please_use_positive_integers).show(),!1):t>23?(r("#wpo_browser_cache_error_message").text(wpoptimize.please_use_valid_values).show(),!1):(r("#wpo_browser_cache_error_message").hide(),e.val(o),a.val(t),i.show(),void s("enable_browser_cache",{browser_cache_expire_days:o,browser_cache_expire_hours:t},function(e){var a=r("#wpo_browser_cache_status");e?(e.enabled?(n.text(wpoptimize.update),a.removeClass("wpo-disabled").addClass("wpo-enabled")):(n.text(wpoptimize.enable),a.addClass("wpo-disabled").removeClass("wpo-enabled")),e.message?r("#wpo_browser_cache_message").text(e.message).show():r("#wpo_browser_cache_message").hide(),e.error_message?r("#wpo_browser_cache_error_message").text(e.error_message).show():r("#wpo_browser_cache_error_message").hide(),e.output?r("#wpo_browser_cache_output").html(e.output).show():r("#wpo_browser_