Conditionally add AYS to leaving shiny updates

When a shiny update is happening or pending, we should make sure users don't accidentally leave the page. This simple notification should help prevent users from accidentally not updating when they want to update.

See #31769
Props ericlewis and adamsilverstein for initial patch


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


git-svn-id: http://core.svn.wordpress.org/trunk@32031 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Aaron Jorbin 2015-04-06 01:00:26 +00:00
parent bfda508c18
commit 2c42b8f0b2
3 changed files with 12 additions and 2 deletions

View File

@ -510,4 +510,14 @@ window.wp = window.wp || {};
} ); } );
/*
* If an update is on-going and a user attempts to leave the page,
* open an "Are you sure?" alert.
*/
$( window ).on( 'beforeunload', function() {
if ( wp.updates.updateLock ) {
return wp.updates.l10n.beforeunload;
}
});
})( jQuery, window.wp, window.pagenow, window.ajaxurl ); })( jQuery, window.wp, window.pagenow, window.ajaxurl );

File diff suppressed because one or more lines are too long

View File

@ -4,7 +4,7 @@
* *
* @global string $wp_version * @global string $wp_version
*/ */
$wp_version = '4.2-beta4-32051'; $wp_version = '4.2-beta4-32052';
/** /**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema. * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.