Merge "Update formatting"

This commit is contained in:
jenkins-bot
2013-10-10 20:30:02 +00:00
committed by Gerrit Code Review
13 changed files with 51 additions and 43 deletions

View File

@@ -53,6 +53,7 @@ class ResourceLoaderULSModule extends ResourceLoaderModule {
foreach ( $this->getData() as $key => $value ) { foreach ( $this->getData() as $key => $value ) {
$out .= Xml::encodeJsCall( 'mw.config.set', array( $key, $value ) ); $out .= Xml::encodeJsCall( 'mw.config.set', array( $key, $value ) );
} }
return $out; return $out;
} }
@@ -77,6 +78,7 @@ class ResourceLoaderULSModule extends ResourceLoaderModule {
'hash' => $hash, 'hash' => $hash,
'timestamp' => $timestamp, 'timestamp' => $timestamp,
) ); ) );
return $timestamp; return $timestamp;
} }
} }

View File

@@ -33,6 +33,7 @@ class UniversalLanguageSelectorHooks {
if ( !$wgULSEnableAnon && $user->isAnon() ) { if ( !$wgULSEnableAnon && $user->isAnon() ) {
return false; return false;
} }
return true; return true;
} }
@@ -141,6 +142,7 @@ class UniversalLanguageSelectorHooks {
foreach ( $preferred as $code => $weight ) { foreach ( $preferred as $code => $weight ) {
if ( isset( $supported[$code] ) ) { if ( isset( $supported[$code] ) ) {
wfProfileOut( __METHOD__ ); wfProfileOut( __METHOD__ );
return $code; return $code;
} }
} }
@@ -152,11 +154,13 @@ class UniversalLanguageSelectorHooks {
$code = $parts[0]; $code = $parts[0];
if ( isset( $supported[$code] ) ) { if ( isset( $supported[$code] ) ) {
wfProfileOut( __METHOD__ ); wfProfileOut( __METHOD__ );
return $code; return $code;
} }
} }
wfProfileOut( __METHOD__ ); wfProfileOut( __METHOD__ );
return ''; return '';
} }
@@ -206,6 +210,7 @@ class UniversalLanguageSelectorHooks {
// Apply immediately // Apply immediately
$code = $languageToSave; $code = $languageToSave;
} }
// Otherwise just use what is stored in preferences // Otherwise just use what is stored in preferences
return true; return true;
} }
@@ -219,6 +224,7 @@ class UniversalLanguageSelectorHooks {
if ( self::isSupportedLanguage( $languageToSave ) ) { if ( self::isSupportedLanguage( $languageToSave ) ) {
$request->response()->setcookie( 'language', $languageToSave ); $request->response()->setcookie( 'language', $languageToSave );
$code = $languageToSave; $code = $languageToSave;
return true; return true;
} }
@@ -226,6 +232,7 @@ class UniversalLanguageSelectorHooks {
$languageToUse = $request->getCookie( 'language' ); $languageToUse = $request->getCookie( 'language' );
if ( self::isSupportedLanguage( $languageToUse ) ) { if ( self::isSupportedLanguage( $languageToUse ) ) {
$code = $languageToUse; $code = $languageToUse;
return true; return true;
} }

View File

@@ -75,8 +75,8 @@ $wgULSEnableAnon = true;
/** /**
* Allow anonymous users to change language with cookie and setlang * Allow anonymous users to change language with cookie and setlang
* query param. * query parameter.
*
* Do not use if you are caching anonymous page views without * Do not use if you are caching anonymous page views without
* taking cookies into account. * taking cookies into account.
* *
@@ -130,7 +130,6 @@ $wgULSEventLogging = false;
*/ */
$wgULSNoImeSelectors = array( '#wpCaptchaWord', '.ve-ce-documentNode' ); $wgULSNoImeSelectors = array( '#wpCaptchaWord', '.ve-ce-documentNode' );
/** /**
* Array of jQuery selectors of elements on which webfonts must not be applied. * Array of jQuery selectors of elements on which webfonts must not be applied.
* By default exclude the interwiki language links. * By default exclude the interwiki language links.
@@ -161,17 +160,17 @@ $wgHooks['UserGetLanguageObject'][] = 'UniversalLanguageSelectorHooks::getLangua
$wgHooks['SkinTemplateOutputPageBeforeExec'][] = $wgHooks['SkinTemplateOutputPageBeforeExec'][] =
'UniversalLanguageSelectorHooks::onSkinTemplateOutputPageBeforeExec'; 'UniversalLanguageSelectorHooks::onSkinTemplateOutputPageBeforeExec';
$wgDefaultUserOptions['uls-preferences'] = ''; $wgDefaultUserOptions['uls-preferences'] = '';
$wgHooks['GetPreferences'][] = 'UniversalLanguageSelectorHooks::onGetPreferences'; $wgHooks['GetPreferences'][] = 'UniversalLanguageSelectorHooks::onGetPreferences';
$wgExtensionFunctions[] = function() { $wgExtensionFunctions[] = function () {
global $wgHooks, $wgResourceModules, $wgULSEventLogging, $wgULSGeoService; global $wgHooks, $wgResourceModules, $wgULSEventLogging, $wgULSGeoService;
if ( $wgULSGeoService === true ) { if ( $wgULSGeoService === true ) {
$wgHooks['BeforePageDisplay'][] = function( &$out ) { $wgHooks['BeforePageDisplay'][] = function ( &$out ) {
/** @var OutputPage $out */ /** @var OutputPage $out */
$out->addScript( '<script src="//bits.wikimedia.org/geoiplookup"></script>' ); $out->addScript( '<script src="//bits.wikimedia.org/geoiplookup"></script>' );
return true; return true;
}; };
} }
@@ -183,13 +182,13 @@ $wgExtensionFunctions[] = function() {
if ( class_exists( 'ResourceLoaderSchemaModule' ) ) { if ( class_exists( 'ResourceLoaderSchemaModule' ) ) {
/// @see https://meta.wikimedia.org/wiki/Schema:UniversalLanguageSelector /// @see https://meta.wikimedia.org/wiki/Schema:UniversalLanguageSelector
$wgResourceModules['schema.UniversalLanguageSelector'] = array( $wgResourceModules['schema.UniversalLanguageSelector'] = array(
'class' => 'ResourceLoaderSchemaModule', 'class' => 'ResourceLoaderSchemaModule',
'schema' => 'UniversalLanguageSelector', 'schema' => 'UniversalLanguageSelector',
'revision' => 5729800, 'revision' => 5729800,
); );
} else { } else {
wfWarn( 'UniversalLanguageSelector is configured to use EventLogging, but ' 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; $wgULSEventLogging = false;
} }
} }

View File

@@ -29,7 +29,7 @@ class ApiULSLocalization extends ApiBase {
$params = $this->extractRequestParams(); $params = $this->extractRequestParams();
$language = $params['language']; $language = $params['language'];
if ( !Language::isValidCode( $language ) ) { if ( !Language::isValidCode( $language ) ) {
$this->dieUsage( 'Invalid language', 'invalidlanguage' ); $this->dieUsage( 'Invalid language', 'invalidlanguage' );
} }

View File

@@ -138,7 +138,6 @@ div.display-settings-block:hover .settings-text {
opacity: 1; opacity: 1;
} }
button.button { button.button {
display: inline-block; display: inline-block;
padding: 0.4065em 1.2195em 0.4065em; padding: 0.4065em 1.2195em 0.4065em;

View File

@@ -56,9 +56,10 @@ div.display-settings-block {
border-top: 1px solid #EEEEEE; border-top: 1px solid #EEEEEE;
padding-top: 25px; padding-top: 25px;
top: -20px; top: -20px;
position:relative; position: relative;
min-height: 150px; min-height: 150px;
} }
.uls-display-settings-font-selectors { .uls-display-settings-font-selectors {
margin: 5px 0 15px 0; margin: 5px 0 15px 0;
border-top: 1px solid #EEEEEE; border-top: 1px solid #EEEEEE;

View File

@@ -71,7 +71,7 @@ div.input-settings-block {
} }
.ext-uls-input-settings-imes-title:empty { .ext-uls-input-settings-imes-title:empty {
display:none; display: none;
} }
.uls-input-settings-disable-info, .uls-input-settings-disable-info,

View File

@@ -524,7 +524,7 @@
} ); } );
displaySettings.$parent.position(); displaySettings.$parent.position();
$tabButtons.filter( '.down' ).removeClass( 'down'); $tabButtons.filter( '.down' ).removeClass( 'down' );
$button.addClass( 'down' ); $button.addClass( 'down' );
} ); } );

View File

@@ -85,7 +85,7 @@
mw.hook( 'mw.uls.interface.language.change' ).add( $.proxy( this.interfaceLanguageChange, this ) ); mw.hook( 'mw.uls.interface.language.change' ).add( $.proxy( this.interfaceLanguageChange, this ) );
mw.hook( 'mw.uls.font.change' ).add( $.proxy( this.fontChange, this ) ); mw.hook( 'mw.uls.font.change' ).add( $.proxy( this.fontChange, this ) );
$( 'body' ).on( 'noresults.uls', '.uls-menu .languagefilter', $( 'body' ).on( 'noresults.uls', '.uls-menu .languagefilter',
$.proxy( this.noSearchResults, this ) $.proxy( this.noSearchResults, this )
); );
}, },

View File

@@ -283,28 +283,27 @@
} ); } );
} ); } );
function imeNotification () { function imeNotification() {
var notificationMsg = ( mw.config.get( 'wgULSPosition' ) === 'personal' ) ? var notificationMsg = ( mw.config.get( 'wgULSPosition' ) === 'personal' ) ?
'ext-uls-input-disable-notification-info-personal' : 'ext-uls-input-disable-notification-info-personal' :
'ext-uls-input-disable-notification-info-interlanguage', 'ext-uls-input-disable-notification-info-interlanguage',
$notification = $( '<div>' ) $notification = $( '<div>' )
.addClass( 'uls-ime-notification-bubble' ) .addClass( 'uls-ime-notification-bubble' )
.append( .append(
$( '<div>' ) $( '<div>' )
.attr( 'data-i18n', 'ext-uls-input-disable-notification' ), .attr( 'data-i18n', 'ext-uls-input-disable-notification' ),
$( '<div>' ) $( '<div>' )
.addClass( 'link' ) .addClass( 'link' )
.attr( 'data-i18n', 'ext-uls-input-disable-notification-undo' ) .attr( 'data-i18n', 'ext-uls-input-disable-notification-undo' )
.on( 'click', function() { .on( 'click', function () {
$.ime.preferences.enable(); $.ime.preferences.enable();
$.ime.preferences.save( function () { $.ime.preferences.save( function () {
mw.ime.setup(); mw.ime.setup();
} ); } );
} ), } ),
$( '<div>' ).attr( 'data-i18n', notificationMsg ) $( '<div>' ).attr( 'data-i18n', notificationMsg )
); );
mw.notify( $notification.i18n() ); mw.notify( $notification.i18n() );
} }
}( jQuery, mediaWiki, document ) ); }( jQuery, mediaWiki, document ) );

View File

@@ -112,7 +112,7 @@
// Delay is zero if event logging is not enabled // Delay is zero if event logging is not enabled
window.setTimeout( function () { window.setTimeout( function () {
deferred.resolve(); deferred.resolve();
}, mw.config.get( 'wgULSEventLogging' ) * 500 ); }, mw.config.get( 'wgULSEventLogging' ) * 500 );
}; };
@@ -221,7 +221,9 @@
*/ */
function isBrowserSupported() { function isBrowserSupported() {
var blacklist = { var blacklist = {
'msie': [['<=', 7]] 'msie': [
['<=', 7]
]
}; };
// jquery.client changed in MediaWiki 1.22. // jquery.client changed in MediaWiki 1.22.

View File

@@ -184,10 +184,10 @@
previousLang = previousLanguages.slice( -1 )[0]; previousLang = previousLanguages.slice( -1 )[0];
$ulsTrigger = ( ulsPosition === 'interlanguage' ) ? $ulsTrigger = ( ulsPosition === 'interlanguage' ) ?
$( '.uls-settings-trigger' ) : $( '.uls-settings-trigger' ) :
$( '.uls-trigger' ); $( '.uls-trigger' );
if ( previousLang === currentLang ) { if ( previousLang === currentLang ) {
$ulsTrigger.tipsy( { gravity: rtlPage ? 'e' : 'w' } ); $ulsTrigger.tipsy( { gravity: rtlPage ? 'e' : 'w' } );
return; return;
@@ -196,8 +196,7 @@
previousLanguages.push( currentLang ); previousLanguages.push( currentLang );
mw.uls.setPreviousLanguages( previousLanguages ); mw.uls.setPreviousLanguages( previousLanguages );
anonMode = ( mw.user.isAnon() && anonMode = ( mw.user.isAnon() && !mw.config.get( 'wgULSAnonCanChangeLanguage' ) );
!mw.config.get( 'wgULSAnonCanChangeLanguage' ) );
if ( anonMode || !previousLang || !$.uls.data.languages[previousLang] ) { if ( anonMode || !previousLang || !$.uls.data.languages[previousLang] ) {
// Do not show tooltip // Do not show tooltip
@@ -271,7 +270,7 @@
} }
// The interlanguage position needs some time to settle down // The interlanguage position needs some time to settle down
window.setTimeout( function() { window.setTimeout( function () {
// Show the tipsy tooltip on page load. // Show the tipsy tooltip on page load.
showTipsy( 6000 ); showTipsy( 6000 );
}, 500 ); }, 500 );

View File

@@ -97,10 +97,10 @@
// Get the name of all registered modules and list them in left side menu. // Get the name of all registered modules and list them in left side menu.
// Sort the modules based on id // Sort the modules based on id
modules = $.map( $.fn.languagesettings.modules, function( element, index ) { modules = $.map( $.fn.languagesettings.modules, function ( element, index ) {
return index; return index;
} ).sort(); } ).sort();
$.each( modules, function( index, moduleName ) { $.each( modules, function ( index, moduleName ) {
if ( $.fn.languagesettings.modules.hasOwnProperty( moduleName ) ) { if ( $.fn.languagesettings.modules.hasOwnProperty( moduleName ) ) {
if ( !defaultModule ) { if ( !defaultModule ) {
defaultModule = moduleName; defaultModule = moduleName;
@@ -166,8 +166,8 @@
var top, pos, left; var top, pos, left;
pos = $.extend( {}, this.$element.offset(), { pos = $.extend( {}, this.$element.offset(), {
height: this.$element[0].offsetHeight height: this.$element[0].offsetHeight
} ); } );
top = this.top || pos.top + pos.height; top = this.top || pos.top + pos.height;
left = this.left || '25%'; left = this.left || '25%';
this.$window.css( { this.$window.css( {