Update jquery.uls from upstream
Like Iecec180ca01a40f0333e5b75914dcdb0c390f6b8
but includes also the unbreak fix by Hoo man
( https://github.com/wikimedia/jquery.uls/pull/238 ).
Updating to
d77da03dbf
Bug: T144871
Bug: T138235
Bug: T137870
Change-Id: I0bafd39385148fd09e7793805f698a43a237e204
This commit is contained in:
@@ -24,18 +24,18 @@
|
||||
|
||||
var noResultsTemplate, LanguageCategoryDisplay;
|
||||
|
||||
noResultsTemplate = $( '<div>' ).addClass( 'twelve columns uls-no-results-view hide' );
|
||||
noResultsTemplate = $( '<div>' ).addClass( 'uls-no-results-view hide' );
|
||||
noResultsTemplate.append(
|
||||
$( '<h2>' )
|
||||
.attr( 'data-i18n', 'uls-no-results-found' )
|
||||
.addClass( 'eleven columns offset-by-one uls-no-results-found-title' )
|
||||
.addClass( 'uls-no-results-found-title' )
|
||||
.text( 'No results found' ),
|
||||
$( '<div>' )
|
||||
.attr( 'id', 'uls-no-found-more' )
|
||||
.addClass( 'uls-no-found-more' )
|
||||
.append(
|
||||
$( '<div>' )
|
||||
.addClass( 'ten columns offset-by-one' )
|
||||
.addClass( '' )
|
||||
.append(
|
||||
$( '<p>' ).append(
|
||||
$( '<span>' ).text( 'You can search by language name, script name, ISO code of language or you can browse by region.' )
|
||||
@@ -47,7 +47,7 @@
|
||||
LanguageCategoryDisplay = function ( element, options ) {
|
||||
this.$element = $( element );
|
||||
this.options = $.extend( {}, $.fn.lcd.defaults, options );
|
||||
this.$element.addClass( 'lcd' );
|
||||
this.$element.addClass( 'uls-lcd' );
|
||||
this.regionLanguages = {};
|
||||
this.renderTimeout = null;
|
||||
this.cachedQuicklist = null;
|
||||
@@ -109,8 +109,9 @@
|
||||
},
|
||||
|
||||
render: function () {
|
||||
var $section,
|
||||
var $section, $quicklist,
|
||||
lcd = this,
|
||||
narrowMode = this.options.columns === 1,
|
||||
regions = [],
|
||||
regionNames = {
|
||||
// These are fallback text when i18n library not present
|
||||
@@ -124,7 +125,16 @@
|
||||
PA: 'Pacific'
|
||||
};
|
||||
|
||||
regions.push( this.buildQuicklist() );
|
||||
$quicklist = this.buildQuicklist();
|
||||
regions.push( $quicklist );
|
||||
|
||||
if ( narrowMode && $quicklist.length ) {
|
||||
regions.push( $( '<h3>' )
|
||||
.attr( 'data-i18n', 'uls-region-all' )
|
||||
.addClass( 'uls-lcd-region-title' )
|
||||
.text( 'All languages' )
|
||||
);
|
||||
}
|
||||
|
||||
$.each( $.uls.data.regiongroups, function ( regionCode ) {
|
||||
lcd.regionLanguages[ regionCode ] = [];
|
||||
@@ -135,14 +145,14 @@
|
||||
}
|
||||
|
||||
$section = $( '<div>' )
|
||||
.addClass( 'eleven columns offset-by-one uls-lcd-region-section hide' )
|
||||
.addClass( 'uls-lcd-region-section hide' )
|
||||
.attr( 'id', regionCode );
|
||||
|
||||
// Show a region heading, unless we are using a narrow ULS
|
||||
if ( lcd.options.columns !== 1 ) {
|
||||
if ( !narrowMode ) {
|
||||
$section.append( $( '<h3>' )
|
||||
.attr( 'data-i18n', 'uls-region-' + regionCode )
|
||||
.addClass( 'eleven columns uls-lcd-region-title' )
|
||||
.addClass( 'uls-lcd-region-title' )
|
||||
.text( regionNames[ regionCode ] )
|
||||
);
|
||||
}
|
||||
@@ -306,7 +316,7 @@
|
||||
this.options.quickList = this.options.quickList();
|
||||
}
|
||||
|
||||
if ( !this.options.quickList ) {
|
||||
if ( !this.options.quickList.length ) {
|
||||
this.cachedQuicklist = $( [] );
|
||||
return this.cachedQuicklist;
|
||||
}
|
||||
@@ -317,13 +327,13 @@
|
||||
quickList.sort( $.uls.data.sortByAutonym );
|
||||
|
||||
$quickListSection = $( '<div>' )
|
||||
.addClass( 'eleven columns offset-by-one uls-lcd-region-section' )
|
||||
.addClass( 'uls-lcd-region-section' )
|
||||
.attr( 'id', 'uls-lcd-quicklist' );
|
||||
|
||||
$quickListSectionTitle = $( '<h3>' )
|
||||
.attr( 'data-i18n', 'uls-common-languages' )
|
||||
.addClass( 'eleven columns uls-lcd-region-title' )
|
||||
.text( 'Common languages' ); // This is placeholder text if jquery.i18n not present
|
||||
.addClass( 'uls-lcd-region-title' )
|
||||
.text( 'Suggested languages' ); // This is placeholder text if jquery.i18n not present
|
||||
$quickListSection.append( $quickListSectionTitle );
|
||||
|
||||
this.renderRegion(
|
||||
@@ -401,7 +411,8 @@
|
||||
// Other supported values are 1 and 2.
|
||||
// Other values will have rendering issues.
|
||||
columns: 4,
|
||||
languageDecorator: null
|
||||
languageDecorator: null,
|
||||
quickList: []
|
||||
};
|
||||
|
||||
$.fn.lcd.Constructor = LanguageCategoryDisplay;
|
||||
|
||||
Reference in New Issue
Block a user