- // Unset the onbeforeunload handler so we don't break page caching in Firefox
- savedWindowOnBeforeUnload = window.onbeforeunload;
- window.onbeforeunload = null;
- if ( retval !== undefined ) {
- // ...but if the user chooses not to leave the page, we need to rebind it
- setTimeout( function () {
- window.onbeforeunload = savedWindowOnBeforeUnload;
- }, 1 );
- return retval;
- }
- } )
- .on( 'pageshow.prefswarning', function () {
- // Re-add onbeforeunload handler
- if ( !window.onbeforeunload ) {
- window.onbeforeunload = savedWindowOnBeforeUnload;
- }
- } );
- $( '#mw-prefs-form' ).submit( function () {
- // Unbind our beforeunload handler
- $( window ).off( '.prefswarning' );
- } );
- $( '#mw-prefs-restoreprefs' ).click( function () {
- // Unbind our beforeunload handler
- $( window ).off( '.prefswarning' );
+ message: mediaWiki.msg( 'prefswarning-warning', mediaWiki.msg( 'saveprefs' ) ),
+ namespace: 'prefswarning'