Update jquery.uls to 54a466e
* Change the language icon color to gray and optimize * Simplify key press event handlers Bug: T175769 Change-Id: I05cfaf699ed5ddccc781344143886831929cbb72
This commit is contained in:
committed by
Santhosh
parent
453a4458e6
commit
0c2c273c93
@@ -218,12 +218,7 @@
|
||||
} );
|
||||
|
||||
// Handle key press events on the menu
|
||||
this.$menu.on( 'keypress', $.proxy( this.keypress, this ) )
|
||||
.on( 'keyup', $.proxy( this.keyup, this ) );
|
||||
|
||||
if ( this.eventSupported( 'keydown' ) ) {
|
||||
this.$menu.on( 'keydown', $.proxy( this.keypress, this ) );
|
||||
}
|
||||
this.$menu.on( 'keydown', $.proxy( this.keypress, this ) );
|
||||
|
||||
languagesCount = Object.keys( this.options.languages ).length;
|
||||
lcd = this.$resultsView.lcd( {
|
||||
@@ -275,18 +270,6 @@
|
||||
this.hide();
|
||||
},
|
||||
|
||||
keyup: function ( e ) {
|
||||
if ( !this.shown ) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ( e.keyCode === 27 ) { // escape
|
||||
this.cancel();
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
}
|
||||
},
|
||||
|
||||
keypress: function ( e ) {
|
||||
if ( !this.shown ) {
|
||||
return;
|
||||
@@ -307,17 +290,6 @@
|
||||
}
|
||||
},
|
||||
|
||||
eventSupported: function ( eventName ) {
|
||||
var isSupported = eventName in this.$menu;
|
||||
|
||||
if ( !isSupported ) {
|
||||
this.$element.setAttribute( eventName, 'return;' );
|
||||
isSupported = typeof this.$element[ eventName ] === 'function';
|
||||
}
|
||||
|
||||
return isSupported;
|
||||
},
|
||||
|
||||
/**
|
||||
* Get the panel menu width parameter
|
||||
* @return {string}
|
||||
|
||||
@@ -67,12 +67,8 @@
|
||||
},
|
||||
|
||||
listen: function () {
|
||||
this.$element.on( 'keypress', $.proxy( this.keyup, this ) )
|
||||
.on( 'keyup', $.proxy( this.keyup, this ) );
|
||||
|
||||
if ( this.eventSupported( 'keydown' ) ) {
|
||||
this.$element.on( 'keydown', $.proxy( this.keyup, this ) );
|
||||
}
|
||||
this.$element.on( 'keydown', $.proxy( this.keypress, this ) );
|
||||
|
||||
if ( this.$clear.length ) {
|
||||
this.$clear.on( 'click', $.proxy( this.clear, this ) );
|
||||
@@ -81,7 +77,7 @@
|
||||
this.toggleClear();
|
||||
},
|
||||
|
||||
keyup: function ( e ) {
|
||||
keypress: function ( e ) {
|
||||
var suggestion, query, languageFilter;
|
||||
|
||||
switch ( e.keyCode ) {
|
||||
@@ -106,11 +102,11 @@
|
||||
query = $.trim( this.$element.val() ).toLowerCase();
|
||||
|
||||
if ( this.selectedLanguage ) {
|
||||
// this.selectLanguage will be populated from a matching search
|
||||
// this.selectLanguage will be populated from a matching search
|
||||
this.options.onSelect( this.selectedLanguage );
|
||||
} else if ( this.options.languages[ query ] ) {
|
||||
// Search is yet to happen (in timeout delay),
|
||||
// but we have a matching language code.
|
||||
// Search is yet to happen (in timeout delay),
|
||||
// but we have a matching language code.
|
||||
this.options.onSelect( query );
|
||||
}
|
||||
|
||||
@@ -119,9 +115,9 @@
|
||||
languageFilter = this;
|
||||
|
||||
if ( e.which < 32 &&
|
||||
e.which !== 8 // Backspace
|
||||
e.which !== 8 // Backspace
|
||||
) {
|
||||
// ignore any ASCII control characters
|
||||
// ignore any ASCII control characters
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -314,17 +310,6 @@
|
||||
matcher.test( $.uls.data.getAutonym( langCode ) ) ||
|
||||
matcher.test( langCode ) ||
|
||||
matcher.test( $.uls.data.getScript( langCode ) );
|
||||
},
|
||||
|
||||
eventSupported: function ( eventName ) {
|
||||
var isSupported = eventName in this.$element;
|
||||
|
||||
if ( !isSupported ) {
|
||||
this.$element.setAttribute( eventName, 'return;' );
|
||||
isSupported = typeof this.$element[ eventName ] === 'function';
|
||||
}
|
||||
|
||||
return isSupported;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user