Siebrand has uploaded a new change for review. https://gerrit.wikimedia.org/r/88708
Change subject: Update formatting ...................................................................... Update formatting Change-Id: Iaee2ab4f36d3a0dce143c62965ab29de504b31ea --- M ResourceLoaderULSModule.php M UniversalLanguageSelector.hooks.php M UniversalLanguageSelector.php M api/ApiULSLocalization.php M resources/css/ext.uls.css M resources/css/ext.uls.displaysettings.css M resources/css/ext.uls.inputsettings.css M resources/js/ext.uls.displaysettings.js M resources/js/ext.uls.eventlogger.js M resources/js/ext.uls.ime.js M resources/js/ext.uls.init.js M resources/js/ext.uls.interface.js M resources/js/ext.uls.languagesettings.js 13 files changed, 49 insertions(+), 42 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/UniversalLanguageSelector refs/changes/08/88708/1 diff --git a/ResourceLoaderULSModule.php b/ResourceLoaderULSModule.php index 88bf275..4bbd6eb 100644 --- a/ResourceLoaderULSModule.php +++ b/ResourceLoaderULSModule.php @@ -53,6 +53,7 @@ foreach ( $this->getData() as $key => $value ) { $out .= Xml::encodeJsCall( 'mw.config.set', array( $key, $value ) ); } + return $out; } @@ -77,6 +78,7 @@ 'hash' => $hash, 'timestamp' => $timestamp, ) ); + return $timestamp; } } diff --git a/UniversalLanguageSelector.hooks.php b/UniversalLanguageSelector.hooks.php index f776b43..b3fa7e8 100644 --- a/UniversalLanguageSelector.hooks.php +++ b/UniversalLanguageSelector.hooks.php @@ -33,6 +33,7 @@ if ( !$wgULSEnableAnon && $user->isAnon() ) { return false; } + return true; } @@ -141,6 +142,7 @@ foreach ( $preferred as $code => $weight ) { if ( isset( $supported[$code] ) ) { wfProfileOut( __METHOD__ ); + return $code; } } @@ -152,11 +154,13 @@ $code = $parts[0]; if ( isset( $supported[$code] ) ) { wfProfileOut( __METHOD__ ); + return $code; } } wfProfileOut( __METHOD__ ); + return ''; } @@ -206,6 +210,7 @@ // Apply immediately $code = $languageToSave; } + // Otherwise just use what is stored in preferences return true; } @@ -219,6 +224,7 @@ if ( self::isSupportedLanguage( $languageToSave ) ) { $request->response()->setcookie( 'language', $languageToSave ); $code = $languageToSave; + return true; } @@ -226,6 +232,7 @@ $languageToUse = $request->getCookie( 'language' ); if ( self::isSupportedLanguage( $languageToUse ) ) { $code = $languageToUse; + return true; } diff --git a/UniversalLanguageSelector.php b/UniversalLanguageSelector.php index 7da0f49..d53aa6f 100644 --- a/UniversalLanguageSelector.php +++ b/UniversalLanguageSelector.php @@ -76,7 +76,6 @@ /** * Allow anonymous users to change language with cookie and setlang * query param. - * Do not use if you are caching anonymous page views without * taking cookies into account. * @@ -130,7 +129,6 @@ */ $wgULSNoImeSelectors = array( '#wpCaptchaWord' ); - /** * Array of jQuery selectors of elements on which webfonts must not be applied. * By default exclude the interwiki language links. @@ -161,17 +159,17 @@ $wgHooks['SkinTemplateOutputPageBeforeExec'][] = 'UniversalLanguageSelectorHooks::onSkinTemplateOutputPageBeforeExec'; - $wgDefaultUserOptions['uls-preferences'] = ''; $wgHooks['GetPreferences'][] = 'UniversalLanguageSelectorHooks::onGetPreferences'; -$wgExtensionFunctions[] = function() { +$wgExtensionFunctions[] = function () { global $wgHooks, $wgResourceModules, $wgULSEventLogging, $wgULSGeoService; if ( $wgULSGeoService === true ) { - $wgHooks['BeforePageDisplay'][] = function( &$out ) { + $wgHooks['BeforePageDisplay'][] = function ( &$out ) { /** @var OutputPage $out */ $out->addScript( '<script src="//bits.wikimedia.org/geoiplookup"></script>' ); + return true; }; } @@ -183,13 +181,13 @@ if ( class_exists( 'ResourceLoaderSchemaModule' ) ) { /// @see https://meta.wikimedia.org/wiki/Schema:UniversalLanguageSelector $wgResourceModules['schema.UniversalLanguageSelector'] = array( - 'class' => 'ResourceLoaderSchemaModule', + 'class' => 'ResourceLoaderSchemaModule', 'schema' => 'UniversalLanguageSelector', 'revision' => 5729800, ); } else { wfWarn( 'UniversalLanguageSelector is configured to use EventLogging, but ' - . 'the extension is is not available. Disabling wgULSEventLogging.' ); + . 'the extension is is not available. Disabling wgULSEventLogging.' ); $wgULSEventLogging = false; } } diff --git a/api/ApiULSLocalization.php b/api/ApiULSLocalization.php index ac3ec06..1bf1c8c 100644 --- a/api/ApiULSLocalization.php +++ b/api/ApiULSLocalization.php @@ -29,7 +29,7 @@ $params = $this->extractRequestParams(); $language = $params['language']; - if ( !Language::isValidCode( $language ) ) { + if ( !Language::isValidCode( $language ) ) { $this->dieUsage( 'Invalid language', 'invalidlanguage' ); } diff --git a/resources/css/ext.uls.css b/resources/css/ext.uls.css index 8da64e5..a3cbb2d 100644 --- a/resources/css/ext.uls.css +++ b/resources/css/ext.uls.css @@ -138,7 +138,6 @@ opacity: 1; } - button.button { display: inline-block; padding: 0.4065em 1.2195em 0.4065em; diff --git a/resources/css/ext.uls.displaysettings.css b/resources/css/ext.uls.displaysettings.css index 52cbb95..8ba1213 100644 --- a/resources/css/ext.uls.displaysettings.css +++ b/resources/css/ext.uls.displaysettings.css @@ -56,9 +56,10 @@ border-top: 1px solid #EEEEEE; padding-top: 25px; top: -20px; - position:relative; + position: relative; min-height: 150px; } + .uls-display-settings-font-selectors { margin: 5px 0 15px 0; border-top: 1px solid #EEEEEE; diff --git a/resources/css/ext.uls.inputsettings.css b/resources/css/ext.uls.inputsettings.css index 7471bad..12a0fa9 100644 --- a/resources/css/ext.uls.inputsettings.css +++ b/resources/css/ext.uls.inputsettings.css @@ -71,7 +71,7 @@ } .ext-uls-input-settings-imes-title:empty { - display:none; + display: none; } .uls-input-settings-disable-info, diff --git a/resources/js/ext.uls.displaysettings.js b/resources/js/ext.uls.displaysettings.js index 5b282b3..b3d45ab 100644 --- a/resources/js/ext.uls.displaysettings.js +++ b/resources/js/ext.uls.displaysettings.js @@ -524,7 +524,7 @@ } ); displaySettings.$parent.position(); - $tabButtons.filter( '.down' ).removeClass( 'down'); + $tabButtons.filter( '.down' ).removeClass( 'down' ); $button.addClass( 'down' ); } ); diff --git a/resources/js/ext.uls.eventlogger.js b/resources/js/ext.uls.eventlogger.js index d9ecb19..d49dca7 100644 --- a/resources/js/ext.uls.eventlogger.js +++ b/resources/js/ext.uls.eventlogger.js @@ -85,7 +85,7 @@ mw.hook( 'mw.uls.interface.language.change' ).add( $.proxy( this.interfaceLanguageChange, this ) ); mw.hook( 'mw.uls.font.change' ).add( $.proxy( this.fontChange, this ) ); $( 'body' ).on( 'noresults.uls', '.uls-menu .languagefilter', - $.proxy( this.noSearchResults, this ) + $.proxy( this.noSearchResults, this ) ); }, diff --git a/resources/js/ext.uls.ime.js b/resources/js/ext.uls.ime.js index a13c770..82b76c4 100644 --- a/resources/js/ext.uls.ime.js +++ b/resources/js/ext.uls.ime.js @@ -283,28 +283,27 @@ } ); } ); - function imeNotification () { + function imeNotification() { var notificationMsg = ( mw.config.get( 'wgULSPosition' ) === 'personal' ) ? 'ext-uls-input-disable-notification-info-personal' : 'ext-uls-input-disable-notification-info-interlanguage', $notification = $( '<div>' ) - .addClass( 'uls-ime-notification-bubble' ) - .append( - $( '<div>' ) - .attr( 'data-i18n', 'ext-uls-input-disable-notification' ), - $( '<div>' ) - .addClass( 'link' ) - .attr( 'data-i18n', 'ext-uls-input-disable-notification-undo' ) - .on( 'click', function() { - $.ime.preferences.enable(); - $.ime.preferences.save( function () { - mw.ime.setup(); - } ); - } ), - $( '<div>' ).attr( 'data-i18n', notificationMsg ) - ); + .addClass( 'uls-ime-notification-bubble' ) + .append( + $( '<div>' ) + .attr( 'data-i18n', 'ext-uls-input-disable-notification' ), + $( '<div>' ) + .addClass( 'link' ) + .attr( 'data-i18n', 'ext-uls-input-disable-notification-undo' ) + .on( 'click', function () { + $.ime.preferences.enable(); + $.ime.preferences.save( function () { + mw.ime.setup(); + } ); + } ), + $( '<div>' ).attr( 'data-i18n', notificationMsg ) + ); mw.notify( $notification.i18n() ); } - }( jQuery, mediaWiki, document ) ); diff --git a/resources/js/ext.uls.init.js b/resources/js/ext.uls.init.js index 344662a..42b4b55 100644 --- a/resources/js/ext.uls.init.js +++ b/resources/js/ext.uls.init.js @@ -112,7 +112,7 @@ // Delay is zero if event logging is not enabled window.setTimeout( function () { deferred.resolve(); - }, mw.config.get( 'wgULSEventLogging' ) * 500 ); + }, mw.config.get( 'wgULSEventLogging' ) * 500 ); }; @@ -221,7 +221,9 @@ */ function isBrowserSupported() { var blacklist = { - 'msie': [['<=', 7]] + 'msie': [ + ['<=', 7] + ] }; // jquery.client changed in MediaWiki 1.22. diff --git a/resources/js/ext.uls.interface.js b/resources/js/ext.uls.interface.js index 994636a..53a33ff 100644 --- a/resources/js/ext.uls.interface.js +++ b/resources/js/ext.uls.interface.js @@ -184,10 +184,10 @@ previousLang = previousLanguages.slice( -1 )[0]; $ulsTrigger = ( ulsPosition === 'interlanguage' ) ? - $( '.uls-settings-trigger' ) : - $( '.uls-trigger' ); + $( '.uls-settings-trigger' ) : + $( '.uls-trigger' ); - if ( previousLang === currentLang ) { + if ( previousLang === currentLang ) { $ulsTrigger.tipsy( { gravity: rtlPage ? 'e' : 'w' } ); return; @@ -196,8 +196,7 @@ previousLanguages.push( currentLang ); mw.uls.setPreviousLanguages( previousLanguages ); - anonMode = ( mw.user.isAnon() && - !mw.config.get( 'wgULSAnonCanChangeLanguage' ) ); + anonMode = ( mw.user.isAnon() && !mw.config.get( 'wgULSAnonCanChangeLanguage' ) ); if ( anonMode || !previousLang || !$.uls.data.languages[previousLang] ) { // Do not show tooltip @@ -271,7 +270,7 @@ } // The interlanguage position needs some time to settle down - window.setTimeout( function() { + window.setTimeout( function () { // Show the tipsy tooltip on page load. showTipsy( 6000 ); }, 500 ); diff --git a/resources/js/ext.uls.languagesettings.js b/resources/js/ext.uls.languagesettings.js index 6e40815..3cf6c76 100644 --- a/resources/js/ext.uls.languagesettings.js +++ b/resources/js/ext.uls.languagesettings.js @@ -97,10 +97,10 @@ // Get the name of all registered modules and list them in left side menu. // Sort the modules based on id - modules = $.map( $.fn.languagesettings.modules, function( element, index ) { + modules = $.map( $.fn.languagesettings.modules,function ( element, index ) { return index; } ).sort(); - $.each( modules, function( index, moduleName ) { + $.each( modules, function ( index, moduleName ) { if ( $.fn.languagesettings.modules.hasOwnProperty( moduleName ) ) { if ( !defaultModule ) { defaultModule = moduleName; @@ -166,8 +166,8 @@ var top, pos, left; pos = $.extend( {}, this.$element.offset(), { - height: this.$element[0].offsetHeight - } ); + height: this.$element[0].offsetHeight + } ); top = this.top || pos.top + pos.height; left = this.left || '25%'; this.$window.css( { -- To view, visit https://gerrit.wikimedia.org/r/88708 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Iaee2ab4f36d3a0dce143c62965ab29de504b31ea Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/UniversalLanguageSelector Gerrit-Branch: master Gerrit-Owner: Siebrand <siebr...@wikimedia.org> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits