From 4221b97ab221c320d5e8c30ed6c269aae78cbe8b Mon Sep 17 00:00:00 2001 From: "Amir E. Aharoni" Date: Wed, 22 May 2013 00:06:51 +0300 Subject: [PATCH] Hide the ULS trigger for users who disabled JS Bug: 42500 Change-Id: I297a8d3bb9d9031e21dd6842f5d27dd54f469c29 --- Resources.php | 6 ++++++ UniversalLanguageSelector.hooks.php | 5 ++++- resources/css/ext.uls.nojs.css | 4 ++++ 3 files changed, 14 insertions(+), 1 deletion(-) create mode 100644 resources/css/ext.uls.nojs.css diff --git a/Resources.php b/Resources.php index 0018022e..3e00380e 100644 --- a/Resources.php +++ b/Resources.php @@ -38,6 +38,12 @@ $wgResourceModules['ext.uls.ime'] = array( ), ) + $resourcePaths; +// Styles for users who disabled JavaScript +$wgResourceModules['ext.uls.nojs'] = array( + 'styles' => 'resources/css/ext.uls.nojs.css', + 'position' => 'top', +) + $resourcePaths; + // Base ULS module $wgResourceModules['ext.uls.init'] = array( 'scripts' => 'resources/js/ext.uls.init.js', diff --git a/UniversalLanguageSelector.hooks.php b/UniversalLanguageSelector.hooks.php index 1aa0adcf..2f175d94 100644 --- a/UniversalLanguageSelector.hooks.php +++ b/UniversalLanguageSelector.hooks.php @@ -43,7 +43,10 @@ class UniversalLanguageSelectorHooks { public static function addModules( $out, $skin ) { global $wgULSGeoService; - // If extension is enabled, basic features(API, language data) available. + // Load the style for users without JS, to hide the useless links + $out->addModuleStyles( 'ext.uls.nojs' ); + + // If the extension is enabled, basic features (API, language data) available. $out->addModules( 'ext.uls.init' ); if ( is_string( $wgULSGeoService ) ) { diff --git a/resources/css/ext.uls.nojs.css b/resources/css/ext.uls.nojs.css new file mode 100644 index 00000000..d902d27d --- /dev/null +++ b/resources/css/ext.uls.nojs.css @@ -0,0 +1,4 @@ +/* Don't show it to users who disabled JS */ +.client-nojs #pt-uls { + visibility: hidden; +}