WordPress.org

Make WordPress Core

Changeset 32052


Ignore:
Timestamp:
04/06/2015 12:59:16 AM (4 years ago)
Author:
jorbin
Message:

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

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/js/updates.js

    r31982 r32052  
    511511    } );
    512512
     513    /*
     514     * If an update is on-going and a user attempts to leave the page,
     515     * open an "Are you sure?" alert.
     516     */
     517    $( window ).on( 'beforeunload', function() {
     518        if ( wp.updates.updateLock ) {
     519            return wp.updates.l10n.beforeunload;
     520        }
     521    });
     522
    513523})( jQuery, window.wp, window.pagenow, window.ajaxurl );
Note: See TracChangeset for help on using the changeset viewer.