From d124a118a3938569c8fb03e9e33a0b9caa4c3585 Mon Sep 17 00:00:00 2001 From: "Amir E. Aharoni" Date: Tue, 7 May 2013 11:46:16 +0300 Subject: [PATCH] Force anonymous mode also in when the ULS is not shown in the sidebar Change-Id: Ie82cfa06d32eb45f0c91e01135cff0bd481682b9 --- resources/js/ext.uls.interface.js | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/resources/js/ext.uls.interface.js b/resources/js/ext.uls.interface.js index b6851446..9d475b0e 100644 --- a/resources/js/ext.uls.interface.js +++ b/resources/js/ext.uls.interface.js @@ -24,6 +24,7 @@ var $ulsTrigger, $pLang, ulsOptions, previousLanguages, previousLang, + anonMode, rtlPage = $( 'body' ).hasClass( 'rtl' ), ulsPosition = mw.config.get( 'wgULSPosition' ), tipsyGravity = { @@ -32,6 +33,9 @@ }, currentLang = mw.config.get( 'wgUserLanguage' ); + anonMode = ( mw.user.isAnon() && + !mw.config.get( 'wgULSAnonCanChangeLanguage' ) ); + if ( ulsPosition === 'interlanguage' ) { // The interlanguage links section $pLang = $( '#p-lang' ); @@ -86,8 +90,9 @@ // If the ULS trigger is shown in the top personal menu, // closing the display settings must show the main ULS - // languages list - if ( ulsPosition === 'personal' ) { + // languages list, unless we are in anon mode and thus + // cannot show the language list + if ( ulsPosition === 'personal' && !anonMode ) { displaySettingsOptions.onClose = function () { uls.show(); }; @@ -200,6 +205,10 @@ ); }; + } else if ( anonMode ) { + ulsOptions.onVisible = function () { + this.$menu.find( '#display-settings-block' ).click(); + }; } $ulsTrigger.uls( ulsOptions );