Compact links: Set href for langugage links in ULS panel

Based on jquery.uls upstream version 982e2c32e7b3
https://github.com/wikimedia/jquery.uls/commit/982e2c32e7b3

Bug: 64797
Change-Id: Ia8b2ad22913693d2f88693091d288ca74d7d8c87
This commit is contained in:
eranroz
2014-08-25 23:59:33 +03:00
committed by Santhosh Thottingal
parent 2eecd4de00
commit 7865a65bb0
3 changed files with 13 additions and 4 deletions

View File

@@ -267,7 +267,8 @@
quickList: this.options.quickList,
clickhandler: $.proxy( this.select, this ),
source: this.$languageFilter,
showRegions: this.options.showRegions
showRegions: this.options.showRegions,
languageDecorator: this.options.languageDecorator
} ).data( 'lcd' );
this.$languageFilter.languagefilter( {
@@ -400,7 +401,8 @@
languages: $.uls.data.getAutonyms(), // Languages to be used for ULS, default is all languages
quickList: null, // Array of language codes or function that returns such
compact: false, // Show ULS in compact mode
showRegions: [ 'WW', 'AM', 'EU', 'ME', 'AF', 'AS', 'PA' ]
showRegions: [ 'WW', 'AM', 'EU', 'ME', 'AF', 'AS', 'PA' ],
languageDecorator: null // Callback function to be called when a language link is prepared - for custom decoration.
};
// Define a dummy i18n function, if jquery.i18n not integrated.

View File

@@ -246,7 +246,9 @@
a.className = 'autonym';
li.appendChild( a );
if ( this.options.languageDecorator ) {
this.options.languageDecorator( $( a ), code );
}
return li;
},
@@ -386,7 +388,8 @@
$.fn.lcd.defaults = {
languages: null,
showRegions: ['WW', 'AM', 'EU', 'ME', 'AF', 'AS', 'PA'],
itemsPerColumn: 8
itemsPerColumn: 8,
languageDecorator: null
};
$.fn.lcd.Constructor = LanguageCategoryDisplay;

View File

@@ -132,6 +132,10 @@
}
this.$menu.css( 'left', this.left );
},
languageDecorator: function ( $languageLink, language ) {
// set href according to language
$languageLink.prop( 'href', compactLinks.interlanguageList[ language ].href );
},
// Use compact version of ULS
compact: true,
// Top position of the language selector. Top it 250px above to take care of