Admin: Site Health JavaScript minor clean-up.

See #46573.

Built from https://develop.svn.wordpress.org/trunk@44988


git-svn-id: http://core.svn.wordpress.org/trunk@44819 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Andrea Fercia 2019-03-23 16:39:52 +00:00
parent 8ea4da0826
commit a668866f05
3 changed files with 5 additions and 7 deletions

View File

@ -23,7 +23,7 @@ jQuery( document ).ready( function( $ ) {
$( '.copy-field-success', $wrapper ).addClass( 'visible' );
$( this ).focus();
wp.a11y.speak( SiteHealth.string.site_info_copied, 'polite' );
wp.a11y.speak( SiteHealth.string.site_info_copied );
}
} );
@ -107,7 +107,7 @@ jQuery( document ).ready( function( $ ) {
pct = ( ( 100 - val ) / 100 ) * c;
$circle.css({ strokeDashoffset: pct } );
$circle.css( { strokeDashoffset: pct } );
if ( 1 > parseInt( SiteHealth.site_status.issues.critical, 0 ) ) {
$( '#health-check-issues-critical' ).addClass( 'hidden' );
@ -133,8 +133,6 @@ jQuery( document ).ready( function( $ ) {
$progressBar.attr( 'data-pct', val );
$progressBar.attr( 'aria-valuenow', val );
$( '.health-check-body' ).attr( 'aria-hidden', false );
$.post(
ajaxurl,
{
@ -144,7 +142,7 @@ jQuery( document ).ready( function( $ ) {
}
);
wp.a11y.speak( SiteHealth.string.site_health_complete_screen_reader.replace( '%s', val + '%' ), 'polite' );
wp.a11y.speak( SiteHealth.string.site_health_complete_screen_reader.replace( '%s', val + '%' ) );
}
/**

View File

@ -1 +1 @@
jQuery(document).ready(function(a){function b(b){var c=wp.template("health-check-issue"),d=a("#health-check-issues-"+b.status),e=a(".issue-count",d);SiteHealth.site_status.issues[b.status]++,e.text(SiteHealth.site_status.issues[b.status]),a(".issues","#health-check-issues-"+b.status).append(c(b))}function c(){var b,c,d,e=a("#progressbar"),f=a("#progressbar svg #bar"),g=parseInt(SiteHealth.site_status.issues.good,0)+parseInt(SiteHealth.site_status.issues.recommended,0)+1.5*parseInt(SiteHealth.site_status.issues.critical,0),h=parseInt(SiteHealth.site_status.issues.recommended,0)+1.5*parseInt(SiteHealth.site_status.issues.critical,0),i=100-Math.ceil(h/g*100);return 0===g?void e.addClass("hidden"):(e.removeClass("loading"),b=f.attr("r"),c=Math.PI*(2*b),0>i&&(i=0),100<i&&(i=100),d=(100-i)/100*c,f.css({strokeDashoffset:d}),1>parseInt(SiteHealth.site_status.issues.critical,0)&&a("#health-check-issues-critical").addClass("hidden"),1>parseInt(SiteHealth.site_status.issues.recommended,0)&&a("#health-check-issues-recommended").addClass("hidden"),50<=i&&f.addClass("orange").removeClass("red"),90<=i&&f.addClass("green").removeClass("orange"),100===i&&(a(".site-status-all-clear").removeClass("hide"),a(".site-status-has-issues").addClass("hide")),e.attr("data-pct",i),e.attr("aria-valuenow",i),a(".health-check-body").attr("aria-hidden",!1),a.post(ajaxurl,{action:"health-check-site-status-result",_wpnonce:SiteHealth.nonce.site_status_result,counts:SiteHealth.site_status.issues}),void wp.a11y.speak(SiteHealth.string.site_health_complete_screen_reader.replace("%s",i+"%"),"polite"))}function d(){var e=!0;1<=SiteHealth.site_status.async.length&&a.each(SiteHealth.site_status.async,function(){var c={action:"health-check-"+this.test.replace("_","-"),_wpnonce:SiteHealth.nonce.site_status};return!!this.completed||(e=!1,this.completed=!0,a.post(ajaxurl,c,function(a){b(a.data),d()}),!1)}),e&&c()}var e;a(".health-check-copy-field").click(function(b){var c=a("#system-information-"+a(this).data("copy-field")+"-copy-field"),d=a(this).closest("div");b.preventDefault(),c.select(),document.execCommand("copy")&&(a(".copy-field-success",d).addClass("visible"),a(this).focus(),wp.a11y.speak(SiteHealth.string.site_info_copied,"polite"))}),a(".health-check-accordion").on("click",".health-check-accordion-trigger",function(){var b="true"===a(this).attr("aria-expanded");b?(a(this).attr("aria-expanded","false"),a("#"+a(this).attr("aria-controls")).attr("hidden",!0)):(a(this).attr("aria-expanded","true"),a("#"+a(this).attr("aria-controls")).attr("hidden",!1))}),a(".health-check-accordion").on("keyup",".health-check-accordion-trigger",function(b){"38"===b.keyCode.toString()?a(".health-check-accordion-trigger",a(this).closest("dt").prevAll("dt")).focus():"40"===b.keyCode.toString()&&a(".health-check-accordion-trigger",a(this).closest("dt").nextAll("dt")).focus()}),a(".site-health-view-passed").on("click",function(){var b=a("#health-check-issues-good");b.toggleClass("hidden"),a(this).attr("aria-expanded",!b.hasClass("hidden"))}),"undefined"!=typeof SiteHealth&&(0===SiteHealth.site_status.direct.length&&0===SiteHealth.site_status.async.length?c():SiteHealth.site_status.issues={good:0,recommended:0,critical:0},0<SiteHealth.site_status.direct.length&&a.each(SiteHealth.site_status.direct,function(){b(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,a.post(ajaxurl,e,function(a){b(a.data),d()})):c())});
jQuery(document).ready(function(a){function b(b){var c=wp.template("health-check-issue"),d=a("#health-check-issues-"+b.status),e=a(".issue-count",d);SiteHealth.site_status.issues[b.status]++,e.text(SiteHealth.site_status.issues[b.status]),a(".issues","#health-check-issues-"+b.status).append(c(b))}function c(){var b,c,d,e=a("#progressbar"),f=a("#progressbar svg #bar"),g=parseInt(SiteHealth.site_status.issues.good,0)+parseInt(SiteHealth.site_status.issues.recommended,0)+1.5*parseInt(SiteHealth.site_status.issues.critical,0),h=parseInt(SiteHealth.site_status.issues.recommended,0)+1.5*parseInt(SiteHealth.site_status.issues.critical,0),i=100-Math.ceil(h/g*100);return 0===g?void e.addClass("hidden"):(e.removeClass("loading"),b=f.attr("r"),c=Math.PI*(2*b),0>i&&(i=0),100<i&&(i=100),d=(100-i)/100*c,f.css({strokeDashoffset:d}),1>parseInt(SiteHealth.site_status.issues.critical,0)&&a("#health-check-issues-critical").addClass("hidden"),1>parseInt(SiteHealth.site_status.issues.recommended,0)&&a("#health-check-issues-recommended").addClass("hidden"),50<=i&&f.addClass("orange").removeClass("red"),90<=i&&f.addClass("green").removeClass("orange"),100===i&&(a(".site-status-all-clear").removeClass("hide"),a(".site-status-has-issues").addClass("hide")),e.attr("data-pct",i),e.attr("aria-valuenow",i),a.post(ajaxurl,{action:"health-check-site-status-result",_wpnonce:SiteHealth.nonce.site_status_result,counts:SiteHealth.site_status.issues}),void wp.a11y.speak(SiteHealth.string.site_health_complete_screen_reader.replace("%s",i+"%")))}function d(){var e=!0;1<=SiteHealth.site_status.async.length&&a.each(SiteHealth.site_status.async,function(){var c={action:"health-check-"+this.test.replace("_","-"),_wpnonce:SiteHealth.nonce.site_status};return!!this.completed||(e=!1,this.completed=!0,a.post(ajaxurl,c,function(a){b(a.data),d()}),!1)}),e&&c()}var e;a(".health-check-copy-field").click(function(b){var c=a("#system-information-"+a(this).data("copy-field")+"-copy-field"),d=a(this).closest("div");b.preventDefault(),c.select(),document.execCommand("copy")&&(a(".copy-field-success",d).addClass("visible"),a(this).focus(),wp.a11y.speak(SiteHealth.string.site_info_copied))}),a(".health-check-accordion").on("click",".health-check-accordion-trigger",function(){var b="true"===a(this).attr("aria-expanded");b?(a(this).attr("aria-expanded","false"),a("#"+a(this).attr("aria-controls")).attr("hidden",!0)):(a(this).attr("aria-expanded","true"),a("#"+a(this).attr("aria-controls")).attr("hidden",!1))}),a(".health-check-accordion").on("keyup",".health-check-accordion-trigger",function(b){"38"===b.keyCode.toString()?a(".health-check-accordion-trigger",a(this).closest("dt").prevAll("dt")).focus():"40"===b.keyCode.toString()&&a(".health-check-accordion-trigger",a(this).closest("dt").nextAll("dt")).focus()}),a(".site-health-view-passed").on("click",function(){var b=a("#health-check-issues-good");b.toggleClass("hidden"),a(this).attr("aria-expanded",!b.hasClass("hidden"))}),"undefined"!=typeof SiteHealth&&(0===SiteHealth.site_status.direct.length&&0===SiteHealth.site_status.async.length?c():SiteHealth.site_status.issues={good:0,recommended:0,critical:0},0<SiteHealth.site_status.direct.length&&a.each(SiteHealth.site_status.direct,function(){b(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,a.post(ajaxurl,e,function(a){b(a.data),d()})):c())});

View File

@ -13,7 +13,7 @@
*
* @global string $wp_version
*/
$wp_version = '5.2-alpha-44987';
$wp_version = '5.2-alpha-44988';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.