Make WordPress Core

Ticket #31964: unload-function-replaceable.patch

File unload-function-replaceable.patch, 602 bytes (added by DavidAnderson, 9 years ago)

Make beforeunload function in shiny updates replaceable

  • updates.js

    old new  
    538538         * If an update is on-going and a user attempts to leave the page,
    539539         * open an "Are you sure?" alert.
    540540         */
    541         $( window ).on( 'beforeunload', function() {
     541        wp.updates.beforeunload = function() {
    542542                if ( wp.updates.updateLock ) {
    543543                        return wp.updates.l10n.beforeunload;
    544544                }
    545         });
     545        }
     546       
     547        $( window ).on( 'beforeunload', wp.updates.beforeunload);
     548       
     549        $(document).trigger( 'wp-plugin-shinyupdates-loaded' );
    546550
    547551})( jQuery, window.wp, window.pagenow, window.ajaxurl );