[MediaWiki-commits] [Gerrit] Compacting the interlanguage links with the ULS - change (mediawiki...UniversalLanguageSelector)

2014-03-04 Thread Pginer (Code Review)
Pginer has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/116726

Change subject: Compacting the interlanguage links with the ULS
..

Compacting the interlanguage links with the ULS

Change-Id: I109bfb10f6181b6408aab170db5e8ca32493d657
---
M Resources.php
M UniversalLanguageSelector.hooks.php
M UniversalLanguageSelector.i18n.php
M UniversalLanguageSelector.php
M i18n/en.json
M i18n/qqq.json
A resources/css/ext.uls.compactlinks.css
A resources/images/compact-links-ltr.png
A resources/images/compact-links-ltr.svg
A resources/images/compact-links-rtl.png
A resources/images/compact-links-rtl.svg
A resources/js/ext.uls.compactlinks.js
12 files changed, 313 insertions(+), 3 deletions(-)


  git pull 
ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/UniversalLanguageSelector 
refs/changes/26/116726/1

diff --git a/Resources.php b/Resources.php
index cb01d80..1d07332 100644
--- a/Resources.php
+++ b/Resources.php
@@ -146,6 +146,17 @@
),
 ) + $resourcePaths;
 
+$wgResourceModules['ext.uls.compactlinks'] = array(
+   'scripts' => 'resources/js/ext.uls.compactlinks.js',
+   'styles' => 'resources/css/ext.uls.compactlinks.css',
+   'dependencies' => array(
+   'ext.uls.mediawiki',
+   'ext.uls.init',
+   'jquery.uls.compact',
+   'mediawiki.ui.button',
+   ),
+) + $resourcePaths;
+
 $wgResourceModules['ext.uls.webfonts'] = array(
'scripts' => 'resources/js/ext.uls.webfonts.js',
'dependencies' => array(
diff --git a/UniversalLanguageSelector.hooks.php 
b/UniversalLanguageSelector.hooks.php
index 9315718..f740f52 100644
--- a/UniversalLanguageSelector.hooks.php
+++ b/UniversalLanguageSelector.hooks.php
@@ -62,6 +62,13 @@
// If the extension is enabled, basic features (API, language 
data) available.
$out->addModules( 'ext.uls.init' );
 
+   // If compact ULS beta feature is enabled
+   if ( class_exists( 'BetaFeatures' ) &&
+   BetaFeatures::isFeatureEnabled( $out->getUser(), 
'uls-compact-links' )
+   ) {
+   $out->addModules( 'ext.uls.compactlinks' );
+   }
+
if ( is_string( $wgULSGeoService ) ) {
$out->addModules( 'ext.uls.geoclient' );
}
@@ -327,6 +334,20 @@
return true;
}
 
+   public static function onGetBetaFeaturePreferences( $user, &$prefs ) {
+   global $wgExtensionAssetsPath;
+   $prefs['uls-compact-links'] = array(
+   'label-message' => 'uls-betafeature-label',
+   'desc-message' => 'uls-betafeature-desc',
+   'screenshot' => $wgExtensionAssetsPath .
+   
'/UniversalLanguageSelector/resources/images/compact-links-ltr.png',
+   'info-link' =>
+   
'https://www.mediawiki.org/wiki/Universal_Language_Selector/Design/Interlanguage_links',
+   'discussion-link' =>
+   
'https://www.mediawiki.org/wiki/Talk:Universal_Language_Selector/Design/Interlanguage_links',
+   );
+   }
+
/**
 * Hook: SkinTemplateOutputPageBeforeExec
 * @param Skin $skin
diff --git a/UniversalLanguageSelector.i18n.php 
b/UniversalLanguageSelector.i18n.php
index c12250d..5941686 100644
--- a/UniversalLanguageSelector.i18n.php
+++ b/UniversalLanguageSelector.i18n.php
@@ -26,6 +26,7 @@
  * @author Amire80
  * @author Nike
  * @author Kunal Mehta
+ * @author Niharika
  */
 $messages['en'] = array(
'UniversalLanguageSelector' => 'Universal Language Selector',
@@ -36,6 +37,8 @@
'ext-uls-select-language-settings-icon-tooltip' => 'Language settings',
'ext-uls-undo-language-tooltip-text' => 'Language changed from $1',
'ext-uls-language-settings-preferences-link' => 'More language 
settings',
+   'uls-betafeature-label' => 'Compacting interlanguage links',
+   'uls-betafeature-desc' => 'Displays a shorter version of the language 
list with the languages that are more relevant to you.',
 );
 
 /** Message documentation (Message documentation)
@@ -58,6 +61,8 @@
'ext-uls-undo-language-tooltip-text' => 'Text for the tooltip appearing 
when language is changed. Parameters:
 * $1 - the previous language acronym',
'ext-uls-language-settings-preferences-link' => 'Text for the link 
showin in user preference screen',
+   'uls-betafeature-label' => 'Title for the compact interlanguage links 
beta feature',
+   'uls-betafeature-desc' => 'Description for the compact interlanguage 
links beta feature'
 );
 
 /** Arabic (العربية)
diff --git a/UniversalLanguageSelector.php b/UniversalLanguageSelector.php
index 85178ac..7f9ec45 100644
--- a/UniversalLanguageSelector.php
+++ b/Univers

[MediaWiki-commits] [Gerrit] Compacting the interlanguage links with the ULS - change (mediawiki...UniversalLanguageSelector)

2014-03-04 Thread jenkins-bot (Code Review)
jenkins-bot has submitted this change and it was merged.

Change subject: Compacting the interlanguage links with the ULS
..


Compacting the interlanguage links with the ULS

Displays a shorter version of the language list with the languages that are 
more relevant to you.
More info at 
https://www.mediawiki.org/wiki/Universal_Language_Selector/Design/Interlanguage_links

Due to a problem with duplicate patchsets we had to create a new one. 
The history and info on code and security revisions is available at
https://gerrit.wikimedia.org/r/#/c/104793/

Change-Id: I109bfb10f6181b6408aab170db5e8ca32493d657
---
M Resources.php
M UniversalLanguageSelector.hooks.php
M UniversalLanguageSelector.i18n.php
M UniversalLanguageSelector.php
M i18n/en.json
M i18n/qqq.json
A resources/css/ext.uls.compactlinks.css
A resources/images/compact-links-ltr.png
A resources/images/compact-links-ltr.svg
A resources/images/compact-links-rtl.png
A resources/images/compact-links-rtl.svg
A resources/js/ext.uls.compactlinks.js
12 files changed, 313 insertions(+), 3 deletions(-)

Approvals:
  KartikMistry: Looks good to me, but someone else must approve
  Pginer: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/Resources.php b/Resources.php
index cb01d80..1d07332 100644
--- a/Resources.php
+++ b/Resources.php
@@ -146,6 +146,17 @@
),
 ) + $resourcePaths;
 
+$wgResourceModules['ext.uls.compactlinks'] = array(
+   'scripts' => 'resources/js/ext.uls.compactlinks.js',
+   'styles' => 'resources/css/ext.uls.compactlinks.css',
+   'dependencies' => array(
+   'ext.uls.mediawiki',
+   'ext.uls.init',
+   'jquery.uls.compact',
+   'mediawiki.ui.button',
+   ),
+) + $resourcePaths;
+
 $wgResourceModules['ext.uls.webfonts'] = array(
'scripts' => 'resources/js/ext.uls.webfonts.js',
'dependencies' => array(
diff --git a/UniversalLanguageSelector.hooks.php 
b/UniversalLanguageSelector.hooks.php
index 9315718..f740f52 100644
--- a/UniversalLanguageSelector.hooks.php
+++ b/UniversalLanguageSelector.hooks.php
@@ -62,6 +62,13 @@
// If the extension is enabled, basic features (API, language 
data) available.
$out->addModules( 'ext.uls.init' );
 
+   // If compact ULS beta feature is enabled
+   if ( class_exists( 'BetaFeatures' ) &&
+   BetaFeatures::isFeatureEnabled( $out->getUser(), 
'uls-compact-links' )
+   ) {
+   $out->addModules( 'ext.uls.compactlinks' );
+   }
+
if ( is_string( $wgULSGeoService ) ) {
$out->addModules( 'ext.uls.geoclient' );
}
@@ -327,6 +334,20 @@
return true;
}
 
+   public static function onGetBetaFeaturePreferences( $user, &$prefs ) {
+   global $wgExtensionAssetsPath;
+   $prefs['uls-compact-links'] = array(
+   'label-message' => 'uls-betafeature-label',
+   'desc-message' => 'uls-betafeature-desc',
+   'screenshot' => $wgExtensionAssetsPath .
+   
'/UniversalLanguageSelector/resources/images/compact-links-ltr.png',
+   'info-link' =>
+   
'https://www.mediawiki.org/wiki/Universal_Language_Selector/Design/Interlanguage_links',
+   'discussion-link' =>
+   
'https://www.mediawiki.org/wiki/Talk:Universal_Language_Selector/Design/Interlanguage_links',
+   );
+   }
+
/**
 * Hook: SkinTemplateOutputPageBeforeExec
 * @param Skin $skin
diff --git a/UniversalLanguageSelector.i18n.php 
b/UniversalLanguageSelector.i18n.php
index c12250d..5941686 100644
--- a/UniversalLanguageSelector.i18n.php
+++ b/UniversalLanguageSelector.i18n.php
@@ -26,6 +26,7 @@
  * @author Amire80
  * @author Nike
  * @author Kunal Mehta
+ * @author Niharika
  */
 $messages['en'] = array(
'UniversalLanguageSelector' => 'Universal Language Selector',
@@ -36,6 +37,8 @@
'ext-uls-select-language-settings-icon-tooltip' => 'Language settings',
'ext-uls-undo-language-tooltip-text' => 'Language changed from $1',
'ext-uls-language-settings-preferences-link' => 'More language 
settings',
+   'uls-betafeature-label' => 'Compacting interlanguage links',
+   'uls-betafeature-desc' => 'Displays a shorter version of the language 
list with the languages that are more relevant to you.',
 );
 
 /** Message documentation (Message documentation)
@@ -58,6 +61,8 @@
'ext-uls-undo-language-tooltip-text' => 'Text for the tooltip appearing 
when language is changed. Parameters:
 * $1 - the previous language acronym',
'ext-uls-language-settings-preferences-link' => 'Text for the link 
showin in user preference screen',

[MediaWiki-commits] [Gerrit] Compacting the interlanguage links with the ULS - change (mediawiki...UniversalLanguageSelector)

2014-01-29 Thread Niharika29 (Code Review)
Niharika29 has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/110204

Change subject: Compacting the interlanguage links with the ULS
..

Compacting the interlanguage links with the ULS

Change-Id: I83afc92214d3af9b11fb3fc9c486da015035956a
---
M Resources.php
M UniversalLanguageSelector.hooks.php
M i18n/en.json
M i18n/qqq.json
A resources/css/ext.uls.compactlinks.css
A resources/js/ext.uls.compactlinks.js
6 files changed, 235 insertions(+), 4 deletions(-)


  git pull 
ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/UniversalLanguageSelector 
refs/changes/04/110204/1

diff --git a/Resources.php b/Resources.php
index 1557eb4..bb95f64 100644
--- a/Resources.php
+++ b/Resources.php
@@ -73,6 +73,7 @@
'jquery.client',
'jquery.json',
'jquery.cookie',
+   'ext.uls.messages',
),
'position' => 'top',
 ) + $resourcePaths;
@@ -144,6 +145,15 @@
),
 ) + $resourcePaths;
 
+$wgResourceModules['ext.uls.compactlinks'] = array(
+   'scripts' => 'resources/js/ext.uls.compactlinks.js',
+   'styles' => 'resources/css/ext.uls.compactlinks.css',
+   'dependencies' => array(
+   'ext.uls.mediawiki',
+   'ext.uls.init'
+   ),
+) + $resourcePaths;
+
 $wgResourceModules['ext.uls.webfonts'] = array(
'scripts' => 'resources/js/ext.uls.webfonts.js',
'dependencies' => array(
diff --git a/UniversalLanguageSelector.hooks.php 
b/UniversalLanguageSelector.hooks.php
index cdf4c6a..784768d 100644
--- a/UniversalLanguageSelector.hooks.php
+++ b/UniversalLanguageSelector.hooks.php
@@ -67,6 +67,9 @@
// If the extension is enabled, basic features (API, language 
data) available.
$out->addModules( 'ext.uls.init' );
 
+   //If compact ULS beta feature is enabled-
+   $out->addModules('ext.uls.compactlinks');
+
if ( is_string( $wgULSGeoService ) ) {
$out->addModules( 'ext.uls.geoclient' );
}
@@ -119,7 +122,7 @@
return true;
}
 
-   // The element id will be 'pt-uls'
+   // The element id will be 'pt-uls' //Niharika see this.
$lang = $context->getLanguage();
$personal_urls = array(
'uls' => array(
diff --git a/i18n/en.json b/i18n/en.json
index 0366fc8..b370d43 100644
--- a/i18n/en.json
+++ b/i18n/en.json
@@ -45,5 +45,7 @@
 "ext-uls-input-disable-notification-undo": "Undo",
 "ext-uls-input-disable-notification-info-personal": "You can enable the input 
tools at any time from the language settings.",
 "ext-uls-input-disable-notification-info-interlanguage": "You can enable the 
input tools at any time from the language settings next to the language list.",
-"ext-uls-language-settings-applying": "Applying..."
+"ext-uls-language-settings-applying": "Applying...",
+"ext-uls-language-settings-preferences-link": "More language settings",
+"ext-uls-compact-link-count": "$1 more languages"
 }
diff --git a/i18n/qqq.json b/i18n/qqq.json
index 8d69481..c69c4ac 100644
--- a/i18n/qqq.json
+++ b/i18n/qqq.json
@@ -49,5 +49,6 @@
 "ext-uls-input-disable-notification-info-personal": "Notification bubble 
text when input methods are disabled, appears if the ULS is at personal 
toolbar",
 "ext-uls-input-disable-notification-info-interlanguage": "Notification 
bubble text when input methods are disabled, appears if the ULS is at 
interlanguage toolbar",
 "ext-uls-language-settings-applying": "Label for apply settings button in 
language settings screen, while settings being saved. Please keep it short.",
-"ext-uls-language-settings-preferences-link": "Text for the link showin in 
user preference screen"
-}
\ No newline at end of file
+"ext-uls-language-settings-preferences-link": "Text for the link showin in 
user preference screen",
+"ext-uls-compact-link-count": "Message next to list of languages which 
indicates that there are more languages than the ones shown. Parameters:\n* $1- 
number of languages"
+}
diff --git a/resources/css/ext.uls.compactlinks.css 
b/resources/css/ext.uls.compactlinks.css
new file mode 100644
index 000..d8d34bf
--- /dev/null
+++ b/resources/css/ext.uls.compactlinks.css
@@ -0,0 +1,23 @@
+#lab {
+   color: #8b8989;
+   font-size: 12px;
+}
+
+#pt-uls {
+   cursor: pointer;
+}
+
+#p-lang-list .uls-trigger {
+   background-image: none;
+}
+
+.mw-ui-button {
+   border-radius: 2px;
+   width: 12px;
+   text-align: center;
+   vertical-align:bottom;
+   padding: 1px 9px;
+   background-color: #f0ecec;
+   border-radius: 2px;
+   border: 1px solid #cdc9c9;
+}
\ No newline at end of file
diff --git a/resources/js/ext.uls.compactlinks.js 
b/resources/js/ext.uls.compactlinks.js
new file mode 100644
index 000..666cd5b

[MediaWiki-commits] [Gerrit] Compacting the interlanguage links with the ULS - change (mediawiki...UniversalLanguageSelector)

2013-12-31 Thread Niharika29 (Code Review)
Niharika29 has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/104793


Change subject: Compacting the interlanguage links with the ULS
..

Compacting the interlanguage links with the ULS

Change-Id: I193f1af405ef1a811b42ba6da57e6ff441ade01d
---
M Resources.php
A resources/js/ext.uls.compactlinks.js
2 files changed, 102 insertions(+), 1 deletion(-)


  git pull 
ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/UniversalLanguageSelector 
refs/changes/93/104793/1

diff --git a/Resources.php b/Resources.php
index 06e2ccf..7320527 100644
--- a/Resources.php
+++ b/Resources.php
@@ -165,7 +165,7 @@
),
 ) + $resourcePaths;
 
-//Module for compacting the interlanguage links in the sidebar with the help 
of the ULS - Added by NIharika
+//Module for compacting the interlanguage links in the sidebar with the ULS
 $wgResourceModules['ext.uls.compactlinks'] = array(
'scripts' => 'resources/js/ext.uls.compactlinks.js',
'dependencies' => array('ext.uls.init'),
diff --git a/resources/js/ext.uls.compactlinks.js 
b/resources/js/ext.uls.compactlinks.js
new file mode 100644
index 000..c0fd864
--- /dev/null
+++ b/resources/js/ext.uls.compactlinks.js
@@ -0,0 +1,101 @@
+/**
+ * ULS startup script - MediaWiki specific customization for jquery.uls
+ *
+ * Copyright (C) 2012-2013 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 ( $, mw ) {
+   'use strict';
+
+   function addULSlink( action, section, name ) {
+   'use strict';
+   var node,
+   aNode,
+   liNode,
+   target;
+   try {
+   if( section === 'languages') {
+   target = 'p-lang';
+   }
+   if ( action === 'add' ) {
+   node = document.getElementById( target 
).getElementsByTagName( 'div' )[0].getElementsByTagName( 'ul' )[0];
+   aNode = document.createElement( 'a' );
+   liNode = document.createElement( 'li' );
+aNode.appendChild( document.createTextNode( name ) );
+aNode.setAttribute( 'href', '#' );
+aNode.setAttribute( 'class', 'uls-trigger autonym');
+liNode.appendChild( aNode );
+liNode.setAttribute( 'class', 'active');
+liNode.setAttribute( 'id', 'pt-uls');
+node.appendChild( liNode );
+   }
+
+}
+catch( e ){
+   return;
+   }
+}
+
+
+
+function addLanguage( name ) {
+   'use strict';
+   var target = 'p-lang',
+   node = document.getElementById( target ).getElementsByTagName( 
'div' )[0].getElementsByTagName( 'ul' )[0],
+   aNode = document.createElement( 'a' ),
+   liNode = document.createElement( 'li' );
+
+   aNode.appendChild( document.createTextNode( name ) );
+aNode.setAttribute( 'href', '#' );
+   liNode.appendChild( aNode );
+liNode.setAttribute( 'class', 'active');
+liNode.setAttribute( 'id', 'pt-uls');
+node.appendChild( liNode );
+}
+
+
+function customizeSidebar() {
+   'use strict';
+//var langName = mw.uls.getBrowserLanguage();
+//new addLanguage( mw.uls.getCountryCode() );
+
+addLanguage( 'French' );
+   //var commLangs = mw.uls.getFrequentLanguageList( 
mw.uls.getCountryCode() );
+//Not working!---addLanguage( $uls.data.getAutonym('en') );
+
+   addULSlink( 'add', 'languages', 'More languages' );
+
+
+// $(".interlanguage-link").hide();
+   //var langarray= 
document.getElementByClassName('interlanguage-link');
+//$('.interlanguage-link').hide();
+
+   var elements = $('.interlanguage-link'),
+   i;
+
+   
//document.getElementsByClassName('interlanguage-link').style.display ='none';
+for (i = elements.length/2+1; i < elements.length; i++) {
+   elements[i].style.display= 'none';
+   }
+//$('.active').hide();
+//var x = $.uls.data.getLanguagesByScriptGroupInRegion;
+}
+
+$( document ).ready( function () {
+   'use strict';
+