File Editor
Directories:
.. (Back)
widgets
Files:
accordion.js
accordion.min.js
code-editor.js
code-editor.min.js
color-picker.js
color-picker.min.js
comment.js
comment.min.js
common.js
common.min.js
custom-background.js
custom-background.min.js
custom-header.js
customize-controls.js
customize-controls.min.js
customize-nav-menus.js
customize-nav-menus.min.js
customize-widgets.js
customize-widgets.min.js
dashboard.js
dashboard.min.js
edit-comments.js
edit-comments.min.js
editor-expand.js
editor-expand.min.js
editor.js
editor.min.js
farbtastic.js
gallery.js
gallery.min.js
image-edit.js
image-edit.min.js
inline-edit-post.js
inline-edit-post.min.js
inline-edit-tax.js
inline-edit-tax.min.js
iris.min.js
language-chooser.js
language-chooser.min.js
link.js
link.min.js
media-gallery.js
media-gallery.min.js
media-upload.js
media-upload.min.js
media.js
media.min.js
nav-menu.js
nav-menu.min.js
password-strength-meter.js
password-strength-meter.min.js
plugin-install.js
plugin-install.min.js
post.js
post.min.js
postbox.js
postbox.min.js
privacy-tools.js
privacy-tools.min.js
revisions.js
revisions.min.js
set-post-thumbnail.js
set-post-thumbnail.min.js
site-health.js
site-health.min.js
svg-painter.js
svg-painter.min.js
tags-box.js
tags-box.min.js
tags-suggest.js
tags-suggest.min.js
tags.js
tags.min.js
theme-plugin-editor.js
theme-plugin-editor.min.js
theme.js
theme.min.js
updates.js
updates.min.js
user-profile.js
user-profile.min.js
user-suggest.js
user-suggest.min.js
widgets.js
widgets.min.js
word-count.js
word-count.min.js
wp-fullscreen-stub.js
wp-fullscreen-stub.min.js
xfn.js
xfn.min.js
Create New File
Create
Edit File: site-health.min.js
jQuery(document).ready(function(h){var c=wp.i18n.__,n=wp.i18n._n,l=wp.i18n.sprintf,e=new ClipboardJS(".site-health-copy-buttons .copy-button"),o=h(".health-check-body.health-check-debug-tab").length,i=h("#health-check-accordion-block-wp-paths-sizes");function a(e){var t,s,a=wp.template("health-check-issue"),i=h("#health-check-issues-"+e.status);SiteHealth.site_status.issues[e.status]++,s=SiteHealth.site_status.issues[e.status],"critical"===e.status?t=l(n("%s critical issue","%s critical issues",s),'<span class="issue-count">'+s+"</span>"):"recommended"===e.status?t=l(n("%s recommended improvement","%s recommended improvements",s),'<span class="issue-count">'+s+"</span>"):"good"===e.status&&(t=l(n("%s item with no issues detected","%s items with no issues detected",s),'<span class="issue-count">'+s+"</span>")),t&&h(".site-health-issue-count-title",i).html(t),h(".issues","#health-check-issues-"+e.status).append(a(e))}function r(){var e=h(".site-health-progress"),t=e.closest(".site-health-progress-wrapper"),s=h(".site-health-progress-label",t),a=h(".site-health-progress svg #bar"),i=parseInt(SiteHealth.site_status.issues.good,0)+parseInt(SiteHealth.site_status.issues.recommended,0)+1.5*parseInt(SiteHealth.site_status.issues.critical,0),n=.5*parseInt(SiteHealth.site_status.issues.recommended,0)+1.5*parseInt(SiteHealth.site_status.issues.critical,0),n=100-Math.ceil(n/i*100);0!==i?(t.removeClass("loading"),i=a.attr("r"),i=Math.PI*(2*i),a.css({strokeDashoffset:(100-(n=100<(n=n<0?0:n)?100:n))/100*i}),parseInt(SiteHealth.site_status.issues.critical,0)<1&&h("#health-check-issues-critical").addClass("hidden"),parseInt(SiteHealth.site_status.issues.recommended,0)<1&&h("#health-check-issues-recommended").addClass("hidden"),80<=n&&0===parseInt(SiteHealth.site_status.issues.critical,0)?(t.addClass("green").removeClass("orange"),s.text(c("Good")),wp.a11y.speak(c("All site health tests have finished running. Your site is looking good, and the results are now available on the page."))):(t.addClass("orange").removeClass("green"),s.text(c("Should be improved")),wp.a11y.speak(c("All site health tests have finished running. There are items that should be addressed, and the results are now available on the page."))),o||(h.post(ajaxurl,{action:"health-check-site-status-result",_wpnonce:SiteHealth.nonce.site_status_result,counts:SiteHealth.site_status.issues}),100===n&&(h(".site-status-all-clear").removeClass("hide"),h(".site-status-has-issues").addClass("hide")))):e.addClass("hidden")}function t(){var e={action:"health-check-get-sizes",_wpnonce:SiteHealth.nonce.site_status_result},t=(new Date).getTime(),s=window.setTimeout(function(){wp.a11y.speak(c("Please wait..."))},3e3);h.post({type:"POST",url:ajaxurl,data:e,dataType:"json"}).done(function(e){var a,s;a=e.data||{},e=h("button.button.copy-button"),s=e.attr("data-clipboard-text"),h.each(a,function(e,t){t=t.debug||t.size;void 0!==t&&(s=s.replace(e+": loading...",e+": "+t))}),e.attr("data-clipboard-text",s),i.find("td[class]").each(function(e,t){var s=h(t),t=s.attr("class");a.hasOwnProperty(t)&&a[t].size&&s.text(a[t].size)})}).always(function(){var e=(new Date).getTime()-t;h(".health-check-wp-paths-sizes.spinner").css("visibility","hidden"),r(),3e3<e?(e=6e3<e?0:6500-e,window.setTimeout(function(){wp.a11y.speak(c("All site health tests have finished running."))},e)):window.clearTimeout(s),h(document).trigger("site-health-info-dirsizes-done")})}e.on("success",function(e){e=h(e.trigger).closest("div");h(".success",e).addClass("visible"),wp.a11y.speak(c("Site information has been added to your clipboard."))}),h(".health-check-accordion").on("click",".health-check-accordion-trigger",function(){"true"===h(this).attr("aria-expanded")?(h(this).attr("aria-expanded","false"),h("#"+h(this).attr("aria-controls")).attr("hidden",!0)):(h(this).attr("aria-expanded","true"),h("#"+h(this).attr("aria-controls")).attr("hidden",!1))}),h(".site-health-view-passed").on("click",function(){var e=h("#health-check-issues-good");e.toggleClass("hidden"),h(this).attr("aria-expanded",!e.hasClass("hidden"))}),"undefined"==typeof SiteHealth||o||(0===SiteHealth.site_status.direct.length&&0===SiteHealth.site_status.async.length?r():SiteHealth.site_status.issues={good:0,recommended:0,critical:0},0<SiteHealth.site_status.direct.length&&h.each(SiteHealth.site_status.direct,function(){a(this)}),0<SiteHealth.site_status.async.length?(e={action:"health-check-"+SiteHealth.site_status.async[0].test.replace("_","-"),_wpnonce:SiteHealth.nonce.site_status},SiteHealth.site_status.async[0].completed=!0,h.post(ajaxurl,e,function(e){a(e.data),function t(){var s=!0;1<=SiteHealth.site_status.async.length&&h.each(SiteHealth.site_status.async,function(){var e={action:"health-check-"+this.test.replace("_","-"),_wpnonce:SiteHealth.nonce.site_status};return!!this.completed||(s=!1,this.completed=!0,h.post(ajaxurl,e,function(e){a(wp.hooks.applyFilters("site_status_test_result",e.data)),t()}),!1)}),s&&r()}()})):r()),o&&(i.length?t:r)()});
Save Changes
Rename File
Rename