- // Check for messageboxes (.successbox, .warningbox, .errorbox) to replace with notifications
- if ( $( '.mw-preferences-messagebox' ).length ) {
- // If there is a #mw-preferences-success box and javascript is enabled, use a slick notification instead!
- if ( $( '#mw-preferences-success' ).length ) {
- notif = mw.notification.notify( mw.message( 'savedprefs' ), { autoHide: false } );
- // 'change' event not reliable!
- $( '#preftoc, .prefsection' ).one( 'change keydown mousedown', function () {
- if ( notif ) {
- notif.close();
- notif = null;
- }
- } );
-
- // Remove now-unnecessary success=1 querystring to prevent reappearance of notification on reload
- if ( history.replaceState ) {
- history.replaceState( {}, document.title, location.href.replace( /&?success=1/, '' ) );
- }
- }
- }