You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
1 line
4.0 KiB
JavaScript
1 line
4.0 KiB
JavaScript
7 months ago
|
!function(){"use strict";var e,r={n:function(e){var a=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(a,{a:a}),a},d:function(e,a){for(var t in a)r.o(a,t)&&!r.o(e,t)&&Object.defineProperty(e,t,{enumerable:!0,get:a[t]})},o:function(e,r){return Object.prototype.hasOwnProperty.call(e,r)}},a=jQuery;(e=r.n(a)())((function(){({init:function(){this.wrap=e(".rank-math-seo-analysis-wrap"),this.results=this.wrap.find(".rank-math-results-wrapper"),this.progress=this.wrap.find(".progress"),this.counter=this.wrap.find(".progress-bar span"),this.events(),this.graphs(),this.single(),this.filters()},events:function(){var r=this;this.wrap.on("click",".rank-math-recheck",(function(a){e(this),a.preventDefault(),r.wrap.addClass("is-loading").removeClass("is-loaded"),r.results.empty();var t=function(a){e(".notice-seo-analysis-error").remove(),0!==a.length&&(r.wrap.find(".rank-math-analyzer-result").first().prepend(a),a.slideDown())},n={action:"rank_math_analyze",security:rankMath.security,u:r.wrap.find(".rank-math-analyze-url").val()};r.wrap.find('input[type="hidden"]').length>0&&r.wrap.find('input[type="hidden"]').each((function(){n[e(this).attr("name")]=e(this).val()})),e.ajax({url:ajaxurl,type:"POST",dataType:"html",data:n,beforeSend:function(){r.renderProgressBar()},complete:function(){clearInterval(r.interval),r.progress.css("width","100%"),r.counter.html("100%")},error:function(){var a=e('<div class="notice notice-error is-dismissible notice-seo-analysis-error"><p>An error occured.</p></div>').hide();t(a),r.wrap.addClass("is-loaded").removeClass("is-loading")},success:function(a){r.results.html(a);var n=r.results.find(".notice");0!==e(a).find("#rank-math-circle-progress").length?(r.wrap.addClass("is-loaded").removeClass("is-loading"),r.graphs()):(r.wrap.removeClass("is-loaded is-loading"),r.progress.css("width","0%"),r.counter.html("0%")),t(n)}})})),r.wrap.on("click",".result-action",(function(r){r.preventDefault(),e(this).parent("div").toggleClass("expanded")})),r.wrap.on("click",".enable-auto-update",(function(r){r.preventDefault(),e.ajax({url:ajaxurl,type:"POST",data:{action:"rank_math_enable_auto_update",security:rankMath.security}}),e(this).closest(".auto-update-disabled").addClass("hidden").siblings(".auto-update-enabled").removeClass("hidden").closest(".row-description").find(".status-icon").removeClass("status-warning dashicons-warning").addClass("status-ok dashicons-yes")}))},renderProgressBar:function(){var e=this,r=0;e.progress.css("width",r),e.interval=setInterval((function(){100==++r&&clearInterval(e.interval),e.counter.html(r+"%"),e.progress.css("width",r+"%")}),30)},graphs:function(){var r=e("#rank-math-circle-progress");if(!(0>r.length)){var a=r.data("result"),t=["#10AC84","#10AC84"];.5>a?t=["#ed5e5e","#ed5e5e"]:.7>a&&(t=["#FF9F43","#FF9F43"]),r.circleProgress({value:a,size:207,thickness:15,lineCap:"round",emptyFill:"#e9e9ea",fill:{gradient:t},startAngle:-Math.PI/2})}},single:function(){var e=this,r=e.wrap.find(".rank-math-current-url"),a=e.wrap.find(".rank-math-analyze-url"),t=e.wrap.find(".rank-math-recheck"),n=e.wrap.find(".rank-math-changeurl"),s=e.wrap.find(".rank-math-changeurl-ok");if(!a.length)return e;n.on("click",(function(){return r.hide(),n.hide(),a.show(),s.show(),!1})),s.on("click",(function(){return a.hide(),s.hide(),r.show(),n.show(),r.html(a.val()),t.trigger("click"),!1})),a.on("keypress",(function(e){13===e.keyCode&&s.trigger("click")})),t.not(".no-autostart").trigger("click")},filters:function(){var r=this,a=r.wrap.find(".rank-math-result-filter");r.wrap.on("click",a,(function(a){var t=e(a.target).data("filter"),n=r.wrap.find(".rank-math-result-filter");if(void 0!==t){a.preventDefault();var s=r.wrap.find(".rank-math-result-table"),i=r.wrap.find(".table-row");if(n.removeClass("active"),e(a.target).addClass("active"),s.addClass("hidden"),i.addClass("hidden"),"all"===t)return s.removeClass("hidden"),void i.removeClass("hidden");s.filter(".rank-math-result-statuses-"+t).removeClass("hidden"),i.filter(".rank-math-result-status-"+t).removeClass("hidden")}}))}}).init()}))}();
|