Merge "build: Enable jscs rule 'requireSpacesInsideParentheses' and make pass"
authorjenkins-bot <jenkins-bot@gerrit.wikimedia.org>
Fri, 4 Sep 2015 22:58:57 +0000 (22:58 +0000)
committerGerrit Code Review <gerrit@wikimedia.org>
Fri, 4 Sep 2015 22:58:57 +0000 (22:58 +0000)
1  2 
resources/src/mediawiki.special/mediawiki.special.preferences.js

@@@ -1,3 -1,4 +1,3 @@@
 -
  /*!
   * JavaScript for Special:Preferences
   */
@@@ -85,23 -86,18 +85,23 @@@ jQuery( function ( $ ) 
                }
        }
  
 -      // 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/, '' ) );
 +                      }
                }
        }
  
        // Disable the button to save preferences unless preferences have changed
        $( '#prefcontrol' ).prop( 'disabled', true );
        $( '.prefsection' ).one( 'change keydown mousedown', function () {
-               $( '#prefcontrol' ).prop( 'disabled', false);
+               $( '#prefcontrol' ).prop( 'disabled', false );
        } );
  
        // Enable keyboard users to use left and right keys to switch tabs