if ( $this->getRequest()->getCheck( 'success' ) ) {
$out->wrapWikiMsg(
- Xml::tags(
+ Html::rawElement(
'div',
- array( 'class' => 'successbox', 'id' => 'mw-preferences-success' ),
- '$1'
+ array(
+ 'class' => 'mw-preferences-messagebox successbox',
+ 'id' => 'mw-preferences-success'
+ ),
+ Html::element( 'p', array(), '$1' )
),
'savedprefs'
);
-
/*!
* JavaScript for Special:Preferences
*/
}
}
- // If there is a #mw-preferences-success box and javascript is enabled, use a slick notification instead!
- if ( $( '#mw-preferences-success' ).length ) {
- notif = mediaWiki.notification.notify( mediaWiki.message( 'savedprefs' ), { autoHide: false } );
- $( '#preftoc, .prefsection' ).one( 'change keydown mousedown', function () { // 'change' event not reliable!
- if ( notif ) {
- notif.close();
- }
- } );
+ // 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 = mediaWiki.notification.notify( mediaWiki.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, document.URL.replace( /&?success=1/, '' ) );
+ // 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/, '' ) );
+ }
}
}