mirror of
https://github.com/WordPress/WordPress.git
synced 2024-12-23 09:37:42 +01:00
Use named function instead of anonymous function
The named function is testable and replaceable. Fixes #31964 Props DavidAnderson, adamsilverstein, jorbin Built from https://develop.svn.wordpress.org/trunk@32126 git-svn-id: http://core.svn.wordpress.org/trunk@32105 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
5e4616039c
commit
a07e9e127f
@ -417,6 +417,21 @@ window.wp = window.wp || {};
|
||||
$message.html( $message.data( 'originaltext' ) );
|
||||
wp.a11y.speak( wp.updates.l10n.updateCancel );
|
||||
};
|
||||
/**
|
||||
* Potentially add an AYS to a user attempting to leave the page
|
||||
*
|
||||
* If an update is on-going and a user attempts to leave the page,
|
||||
* open an "Are you sure?" alert.
|
||||
*
|
||||
* @since 4.2.0
|
||||
*/
|
||||
|
||||
wp.updates.beforeunload = function() {
|
||||
if ( wp.updates.updateLock ) {
|
||||
return wp.updates.l10n.beforeunload;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
$( document ).ready( function() {
|
||||
/*
|
||||
@ -530,18 +545,8 @@ window.wp = window.wp || {};
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
|
||||
} );
|
||||
|
||||
/*
|
||||
* 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;
|
||||
}
|
||||
});
|
||||
$( window ).on( 'beforeunload', wp.updates.beforeunload );
|
||||
|
||||
})( jQuery, window.wp, window.pagenow, window.ajaxurl );
|
||||
|
2
wp-admin/js/updates.min.js
vendored
2
wp-admin/js/updates.min.js
vendored
File diff suppressed because one or more lines are too long
@ -4,7 +4,7 @@
|
||||
*
|
||||
* @global string $wp_version
|
||||
*/
|
||||
$wp_version = '4.2-beta4-32125';
|
||||
$wp_version = '4.2-beta4-32126';
|
||||
|
||||
/**
|
||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||
|
Loading…
Reference in New Issue
Block a user