Allow sending the number of lcd columns as a parameter
This is needed for https://phabricator.wikimedia.org/T76196 and may also nbe useful for many other features.
This commit is contained in:
@@ -26,10 +26,12 @@
|
||||
background-clip: padding-box;
|
||||
}
|
||||
|
||||
/*
|
||||
.uls-wide {
|
||||
min-width: 715px;
|
||||
width: 45%;
|
||||
}
|
||||
*/
|
||||
|
||||
.uls-title-region a {
|
||||
padding-left: 15px;
|
||||
|
||||
@@ -144,12 +144,20 @@
|
||||
* @returns {Object}
|
||||
*/
|
||||
position: function () {
|
||||
var pos = $.extend( {}, this.$element.offset(), {
|
||||
var width, minWidth, pos;
|
||||
|
||||
width = 11 * this.options.columns;
|
||||
minWidth = 179 * this.options.columns;
|
||||
|
||||
pos = $.extend( {}, this.$element.offset(), {
|
||||
height: this.$element[0].offsetHeight
|
||||
} );
|
||||
|
||||
return {
|
||||
top: this.top !== undefined ? this.top : pos.top + pos.height,
|
||||
left: this.left !== undefined ? this.left : '25%'
|
||||
'width': width + '%',
|
||||
'min-width': minWidth,
|
||||
'top': this.top !== undefined ? this.top : pos.top + pos.height,
|
||||
'left': this.left !== undefined ? this.left : '25%'
|
||||
};
|
||||
},
|
||||
|
||||
@@ -264,6 +272,7 @@
|
||||
|
||||
lcd = this.$resultsView.lcd( {
|
||||
languages: this.languages,
|
||||
columns: this.options.columns,
|
||||
quickList: this.options.quickList,
|
||||
clickhandler: $.proxy( this.select, this ),
|
||||
source: this.$languageFilter,
|
||||
@@ -401,6 +410,7 @@
|
||||
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
|
||||
columns: 2, // How many columns of languages to show
|
||||
showRegions: [ 'WW', 'AM', 'EU', 'ME', 'AF', 'AS', 'PA' ],
|
||||
languageDecorator: null // Callback function to be called when a language link is prepared - for custom decoration.
|
||||
};
|
||||
|
||||
@@ -153,8 +153,7 @@
|
||||
*/
|
||||
renderRegions: function () {
|
||||
var lcd = this, languages,
|
||||
items = lcd.options.itemsPerColumn,
|
||||
columns = 4;
|
||||
items = lcd.options.itemsPerColumn;
|
||||
|
||||
this.$noResults.addClass( 'hide' );
|
||||
this.$element.find( '.uls-lcd-region-section' ).each( function () {
|
||||
@@ -173,7 +172,7 @@
|
||||
return;
|
||||
}
|
||||
|
||||
lcd.renderRegion( $region, languages, items, columns );
|
||||
lcd.renderRegion( $region, languages, items, lcd.options.columns );
|
||||
$region.removeClass( 'hide' );
|
||||
|
||||
lcd.regionLanguages[regionCode] = [];
|
||||
@@ -386,6 +385,7 @@
|
||||
};
|
||||
|
||||
$.fn.lcd.defaults = {
|
||||
columns: 4,
|
||||
languages: null,
|
||||
showRegions: ['WW', 'AM', 'EU', 'ME', 'AF', 'AS', 'PA'],
|
||||
itemsPerColumn: 8,
|
||||
|
||||
Reference in New Issue
Block a user