Revert "Update jquery.uls to a9dc11b"
Breaks VisualEditor by throwing exceptions on most key
presses and selection changes, which causes Enter and Tab
to behave very badly in VE.
This reverts commit 3499b0a1b9.
Bug: T144871
Change-Id: I0518b056e6946341cf29eb3f16378702d37086a5
This commit is contained in:
@@ -91,7 +91,7 @@
|
||||
this.initialized = false;
|
||||
|
||||
this.$languageFilter = this.$menu.find( '#uls-languagefilter' );
|
||||
this.$resultsView = this.$menu.find( '.uls-language-list' );
|
||||
this.$resultsView = this.$menu.find( 'div.uls-language-list' );
|
||||
|
||||
this.render();
|
||||
this.listen();
|
||||
@@ -134,25 +134,15 @@
|
||||
* @returns {Object}
|
||||
*/
|
||||
position: function () {
|
||||
var pos,
|
||||
top = this.top,
|
||||
left = this.left;
|
||||
|
||||
if ( top === undefined ) {
|
||||
pos = $.extend( {}, this.$element.offset(), {
|
||||
height: this.$element[ 0 ].offsetHeight
|
||||
} );
|
||||
top = pos.top + pos.height;
|
||||
}
|
||||
|
||||
if ( left === undefined ) {
|
||||
left = $( window ).width() / 2 - this.$menu.outerWidth() / 2;
|
||||
}
|
||||
var pos;
|
||||
|
||||
pos = $.extend( {}, this.$element.offset(), {
|
||||
height: this.$element[ 0 ].offsetHeight
|
||||
} );
|
||||
|
||||
return {
|
||||
top: top,
|
||||
left: left
|
||||
top: this.top !== undefined ? this.top : pos.top + pos.height,
|
||||
left: this.left !== undefined ? this.left : '25%'
|
||||
};
|
||||
},
|
||||
|
||||
@@ -167,6 +157,7 @@
|
||||
};
|
||||
|
||||
this.$menu.addClass( widthClasses[this.getMenuWidth()] );
|
||||
this.$menu.css( this.position() );
|
||||
|
||||
if ( !this.initialized ) {
|
||||
$( 'body' ).prepend( this.$menu );
|
||||
@@ -174,7 +165,6 @@
|
||||
this.initialized = true;
|
||||
}
|
||||
|
||||
this.$menu.css( this.position() );
|
||||
this.$menu.show();
|
||||
this.$menu.scrollIntoView();
|
||||
this.shown = true;
|
||||
@@ -358,7 +348,7 @@
|
||||
|
||||
languagesCount = objectLength( this.options.languages );
|
||||
|
||||
if ( languagesCount < 25 ) {
|
||||
if ( languagesCount < 12 ) {
|
||||
return 'narrow';
|
||||
}
|
||||
|
||||
|
||||
@@ -24,18 +24,18 @@
|
||||
|
||||
var noResultsTemplate, LanguageCategoryDisplay;
|
||||
|
||||
noResultsTemplate = $( '<div>' ).addClass( 'uls-no-results-view hide' );
|
||||
noResultsTemplate = $( '<div>' ).addClass( 'twelve columns uls-no-results-view hide' );
|
||||
noResultsTemplate.append(
|
||||
$( '<h2>' )
|
||||
.attr( 'data-i18n', 'uls-no-results-found' )
|
||||
.addClass( 'uls-no-results-found-title' )
|
||||
.addClass( 'eleven columns offset-by-one uls-no-results-found-title' )
|
||||
.text( 'No results found' ),
|
||||
$( '<div>' )
|
||||
.attr( 'id', 'uls-no-found-more' )
|
||||
.addClass( 'uls-no-found-more' )
|
||||
.append(
|
||||
$( '<div>' )
|
||||
.addClass( '' )
|
||||
.addClass( 'ten columns offset-by-one' )
|
||||
.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( 'uls-lcd' );
|
||||
this.$element.addClass( 'lcd' );
|
||||
this.regionLanguages = {};
|
||||
this.renderTimeout = null;
|
||||
this.cachedQuicklist = null;
|
||||
@@ -109,9 +109,8 @@
|
||||
},
|
||||
|
||||
render: function () {
|
||||
var $section, $quicklist,
|
||||
var $section,
|
||||
lcd = this,
|
||||
narrowMode = this.options.columns === 1,
|
||||
regions = [],
|
||||
regionNames = {
|
||||
// These are fallback text when i18n library not present
|
||||
@@ -125,16 +124,7 @@
|
||||
PA: 'Pacific'
|
||||
};
|
||||
|
||||
$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' )
|
||||
);
|
||||
}
|
||||
regions.push( this.buildQuicklist() );
|
||||
|
||||
$.each( $.uls.data.regiongroups, function ( regionCode ) {
|
||||
lcd.regionLanguages[ regionCode ] = [];
|
||||
@@ -145,14 +135,14 @@
|
||||
}
|
||||
|
||||
$section = $( '<div>' )
|
||||
.addClass( 'uls-lcd-region-section hide' )
|
||||
.addClass( 'eleven columns offset-by-one uls-lcd-region-section hide' )
|
||||
.attr( 'id', regionCode );
|
||||
|
||||
// Show a region heading, unless we are using a narrow ULS
|
||||
if ( !narrowMode ) {
|
||||
if ( lcd.options.columns !== 1 ) {
|
||||
$section.append( $( '<h3>' )
|
||||
.attr( 'data-i18n', 'uls-region-' + regionCode )
|
||||
.addClass( 'uls-lcd-region-title' )
|
||||
.addClass( 'eleven columns uls-lcd-region-title' )
|
||||
.text( regionNames[ regionCode ] )
|
||||
);
|
||||
}
|
||||
@@ -316,7 +306,7 @@
|
||||
this.options.quickList = this.options.quickList();
|
||||
}
|
||||
|
||||
if ( !this.options.quickList.length ) {
|
||||
if ( !this.options.quickList ) {
|
||||
this.cachedQuicklist = $( [] );
|
||||
return this.cachedQuicklist;
|
||||
}
|
||||
@@ -327,13 +317,13 @@
|
||||
quickList.sort( $.uls.data.sortByAutonym );
|
||||
|
||||
$quickListSection = $( '<div>' )
|
||||
.addClass( 'uls-lcd-region-section' )
|
||||
.addClass( 'eleven columns offset-by-one uls-lcd-region-section' )
|
||||
.attr( 'id', 'uls-lcd-quicklist' );
|
||||
|
||||
$quickListSectionTitle = $( '<h3>' )
|
||||
.attr( 'data-i18n', 'uls-common-languages' )
|
||||
.addClass( 'uls-lcd-region-title' )
|
||||
.text( 'Suggested languages' ); // This is placeholder text if jquery.i18n not present
|
||||
.addClass( 'eleven columns uls-lcd-region-title' )
|
||||
.text( 'Common languages' ); // This is placeholder text if jquery.i18n not present
|
||||
$quickListSection.append( $quickListSectionTitle );
|
||||
|
||||
this.renderRegion(
|
||||
@@ -411,8 +401,7 @@
|
||||
// Other supported values are 1 and 2.
|
||||
// Other values will have rendering issues.
|
||||
columns: 4,
|
||||
languageDecorator: null,
|
||||
quicklist: []
|
||||
languageDecorator: null
|
||||
};
|
||||
|
||||
$.fn.lcd.Constructor = LanguageCategoryDisplay;
|
||||
|
||||
Reference in New Issue
Block a user