diff --git a/UniversalLanguageSelector.hooks.php b/UniversalLanguageSelector.hooks.php index 015ae9dd..ce7e52ee 100644 --- a/UniversalLanguageSelector.hooks.php +++ b/UniversalLanguageSelector.hooks.php @@ -28,6 +28,8 @@ class UniversalLanguageSelectorHooks { */ public static function addModules( $out, $skin ) { $out->addModules( 'ext.uls.init' ); + $out->addModules( 'ext.uls.languagesettings' ); + $out->addModules( 'ext.uls.displaysettings' ); return true; } /** diff --git a/UniversalLanguageSelector.php b/UniversalLanguageSelector.php index 40cb79a5..583fbc2a 100644 --- a/UniversalLanguageSelector.php +++ b/UniversalLanguageSelector.php @@ -75,6 +75,22 @@ $wgResourceModules['ext.uls.init'] = array( 'position' => 'top', ); +$wgResourceModules['ext.uls.languagesettings'] = array( + 'scripts' => 'resources/js/ext.uls.languagesettings.js', + 'styles' => 'resources/css/ext.languagesettings.css', + 'localBasePath' => $dir, + 'remoteExtPath' => 'UniversalLanguageSelector', +); + +$wgResourceModules['ext.uls.displaysettings'] = array( + 'scripts' => 'resources/js/ext.uls.displaysettings.js', + 'localBasePath' => $dir, + 'dependencies' => array( + 'ext.uls.languagesettings', + ), + 'remoteExtPath' => 'UniversalLanguageSelector', +); + $wgResourceModules['jquery.uls'] = array( 'scripts' => array( 'lib/jquery.uls/src/jquery.uls.core.js', diff --git a/lib/jquery.uls/src/jquery.uls.core.js b/lib/jquery.uls/src/jquery.uls.core.js index edab8bc6..74f939b7 100644 --- a/lib/jquery.uls/src/jquery.uls.core.js +++ b/lib/jquery.uls/src/jquery.uls.core.js @@ -91,7 +91,9 @@ }, listen: function() { - var that = this, lcd; + var lcd, + that = this; + // Register all event listeners to the ULS here. that.$element.on( 'click', $.proxy( that.click, that ) ); diff --git a/resources/css/ext.languagesettings.css b/resources/css/ext.languagesettings.css new file mode 100644 index 00000000..77036921 --- /dev/null +++ b/resources/css/ext.languagesettings.css @@ -0,0 +1,89 @@ +#uls-current-language-nav { + /* @embed */ + background: url('../images/cog-16x16-ltr.png') no-repeat scroll right top transparent; + cursor: pointer; +} + +#language-settings-dialog { + display: none; /* hidden initially */ + + /* XXX pretty random position values, just to make it visible */ + bottom: 100px; + left: 200px; + + /* From here on - from .uls-menu */ + position: fixed; + z-index: 1000; + display: none; + min-width: 800px; /* changed */ + margin-top: 1px; + width: 45%; + /* Styling */ + background-color: #ffffff; + border: 1px solid #ccc; + border: 1px solid rgba(0, 0, 0, 0.2); + *border-right-width: 2px; + *border-bottom-width: 2px; + -webkit-border-radius: 5px; + -moz-border-radius: 5px; + border-radius: 5px; + -webkit-box-shadow: 0 5px 10px rgba(0, 0, 0, 0.2); + -moz-box-shadow: 0 5px 10px rgba(0, 0, 0, 0.2); + box-shadow: 0 5px 10px rgba(0, 0, 0, 0.2); + -webkit-background-clip: padding-box; + -moz-background-clip: padding; + background-clip: padding-box; +} + +/* From uls-menu, unchanged */ +#uls-current-language-nav a { + color: #0088CC; +} +#uls-current-language-nav h1 { + font-weight: normal; + padding-top: 1.25em; + border: none; + padding-bottom: 3px; + font-size: 18pt; + line-height: 1.25em; + padding-left: 15px; + color: #777; +} +#uls-current-language-nav h2 { + font-size: 16pt; + line-height: 1.5em; + padding-left: 6px; + margin-top: 0px; + margin-bottom: 15px; + border-bottom: none; + color: #777; +} +.uls-menu h3 { + font-size: 14pt; + line-height: 1.5em; + padding-left: 0px; + margin-top: 0px; + margin-bottom: 10px; + border-bottom: none; +} + +.language-settings-buttons { + text-align: right; +} + +/* Buttons in the selector panel */ +.menu-section { + color: #777; + padding: 5px 0 5px 50px; + border-left: 3px solid transparent; + display: block; + font-size: 12pt; + background: url(http://dl.dropbox.com/u/30377416/i18n/icons/WMF-Agora-Display_settings-grey.png) no-repeat scroll 15px center transparent; +} + +.menu-section.active{ + color: black; + background-color: #F6F6F6; + border-left-color: #3366BB; + background-image: url(http://dl.dropbox.com/u/30377416/i18n/icons/WMF-Agora-Display_settings-blue.svg); +} diff --git a/resources/images/cog-16x16-ltr.png b/resources/images/cog-16x16-ltr.png new file mode 100644 index 00000000..a51668fa Binary files /dev/null and b/resources/images/cog-16x16-ltr.png differ diff --git a/resources/images/cog-16x16-rtl.png b/resources/images/cog-16x16-rtl.png new file mode 100644 index 00000000..e6e6e6d9 Binary files /dev/null and b/resources/images/cog-16x16-rtl.png differ diff --git a/resources/js/ext.uls.displaysettings.js b/resources/js/ext.uls.displaysettings.js new file mode 100644 index 00000000..ea2f4fc8 --- /dev/null +++ b/resources/js/ext.uls.displaysettings.js @@ -0,0 +1,51 @@ +/** + * ULS-based display settings panel + * + * Copyright (C) 2012 Alolita Sharma, Amir Aharoni, Arun Ganesh, Brandon Harris, + * Niklas Laxström, Pau Giner, Santhosh Thottingal, Siebrand Mazeland and other + * contributors. See CREDITS for a list. + * + * UniversalLanguageSelector is dual licensed GPLv2 or later and MIT. You don't + * have to do anything special to choose one license or the other and you don't + * have to notify anyone which license you are using. You are free to use + * UniversalLanguageSelector in commercial projects as long as the copyright + * header is left intact. See files GPL-LICENSE and MIT-LICENSE for details. + * + * @file + * @ingroup Extensions + * @licence GNU General Public Licence 2.0 or later + * @licence MIT License + */ + +( function( $ ) { + "use strict"; + var template = '