Files
wrapartamenty.pl/wp-content/plugins/wp-optimize-premium/js/power-tweaks-3-4-2.min.js
Roman Pyrih d6241cfa7a first commit
2024-12-19 15:27:13 +01:00

1 line
1.3 KiB
JavaScript

!function(t,e){var n=[],a=function(n){var a=n.data("tweak");this.run=function(t){return n.addClass("running"),e("power_tweak",{sub_action:t,data:{tweak:a}},this.on_run_complete)},this.on_run_complete=function(e){var a;n.removeClass("running"),e.success&&e.message?a=t('<div class="notice updated"><p>'+e.message+"</p></div>").insertAfter(n.find("h4")):!e.success&&e.errors&&(a=t('<div class="notice notice-error"></div>').insertAfter(n.find("h4")),t.each(e.errors,function(e,n){a.append(t("<p>"+n+"</p>"))})),a&&setTimeout(function(){a.slideUp(300,function(){a.remove()})},2e3),e.hasOwnProperty("last_updated")&&(n.find(".last-updated .date").html(e.last_updated),n.find("button.run-tweak").prop("disabled",!0).text(wpoptimize.post_meta_tweak_completed))},this.on_run_action=function(e){var n;a||alert("No tweak ID found"),t(e.target).is(".run-tweak")&&(n="run"),t(e.target).is(".enable-tweak")&&(n=t(e.target).is(":checked")?"activate":"deactivate"),this.run(n)},n.on("click","button.run-tweak",this.on_run_action.bind(this)),n.on("change","input.enable-tweak",this.on_run_action.bind(this)),n.on("click",".show-details",function(t){t.preventDefault(),n.find(".details").toggleClass("hidden")})};t(function(){t(".wpo-power-tweak").each(function(e,i){n.push(new a(t(i)))})}),wp_optimize.power_tweaks={tweaks:n}}(jQuery,wp_optimize.send_command);