Force anonymous mode also in when the ULS is not shown in the sidebar

Change-Id: Ie82cfa06d32eb45f0c91e01135cff0bd481682b9
This commit is contained in:
Amir E. Aharoni
2013-05-07 11:46:16 +03:00
parent 15ccc41f49
commit d124a118a3

View File

@@ -24,6 +24,7 @@
var $ulsTrigger, $pLang, var $ulsTrigger, $pLang,
ulsOptions, ulsOptions,
previousLanguages, previousLang, previousLanguages, previousLang,
anonMode,
rtlPage = $( 'body' ).hasClass( 'rtl' ), rtlPage = $( 'body' ).hasClass( 'rtl' ),
ulsPosition = mw.config.get( 'wgULSPosition' ), ulsPosition = mw.config.get( 'wgULSPosition' ),
tipsyGravity = { tipsyGravity = {
@@ -32,6 +33,9 @@
}, },
currentLang = mw.config.get( 'wgUserLanguage' ); currentLang = mw.config.get( 'wgUserLanguage' );
anonMode = ( mw.user.isAnon() &&
!mw.config.get( 'wgULSAnonCanChangeLanguage' ) );
if ( ulsPosition === 'interlanguage' ) { if ( ulsPosition === 'interlanguage' ) {
// The interlanguage links section // The interlanguage links section
$pLang = $( '#p-lang' ); $pLang = $( '#p-lang' );
@@ -86,8 +90,9 @@
// If the ULS trigger is shown in the top personal menu, // If the ULS trigger is shown in the top personal menu,
// closing the display settings must show the main ULS // closing the display settings must show the main ULS
// languages list // languages list, unless we are in anon mode and thus
if ( ulsPosition === 'personal' ) { // cannot show the language list
if ( ulsPosition === 'personal' && !anonMode ) {
displaySettingsOptions.onClose = function () { displaySettingsOptions.onClose = function () {
uls.show(); uls.show();
}; };
@@ -200,6 +205,10 @@
); );
}; };
} else if ( anonMode ) {
ulsOptions.onVisible = function () {
this.$menu.find( '#display-settings-block' ).click();
};
} }
$ulsTrigger.uls( ulsOptions ); $ulsTrigger.uls( ulsOptions );