Changeset 32126
- Timestamp:
- 04/14/2015 04:41:24 PM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-admin/js/updates.js
r32082 r32126 418 418 wp.a11y.speak( wp.updates.l10n.updateCancel ); 419 419 }; 420 /** 421 * Potentially add an AYS to a user attempting to leave the page 422 * 423 * If an update is on-going and a user attempts to leave the page, 424 * open an "Are you sure?" alert. 425 * 426 * @since 4.2.0 427 */ 428 429 wp.updates.beforeunload = function() { 430 if ( wp.updates.updateLock ) { 431 return wp.updates.l10n.beforeunload; 432 } 433 }; 434 420 435 421 436 $( document ).ready( function() { … … 531 546 } 532 547 533 534 535 548 } ); 536 549 537 /* 538 * If an update is on-going and a user attempts to leave the page, 539 * open an "Are you sure?" alert. 540 */ 541 $( window ).on( 'beforeunload', function() { 542 if ( wp.updates.updateLock ) { 543 return wp.updates.l10n.beforeunload; 544 } 545 }); 550 $( window ).on( 'beforeunload', wp.updates.beforeunload ); 546 551 547 552 })( jQuery, window.wp, window.pagenow, window.ajaxurl );
Note: See TracChangeset
for help on using the changeset viewer.