Update jquery.ime from upstream
version: v0.1.0+20131019 (commit: 4ac70e0047) upstream: https://github.com/wikimedia/jquery.ime Changes: * Language tags are case insensitive now * Fixes to Hindi and Persian input methods * Shift modifier key support * Misc CSS fixes Bug: 54117 Change-Id: I581a1006c34fd86372facdae85ea48b4ed1ffc2c
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
/*! jquery.ime - v0.1.0+20130914
|
||||
/*! jquery.ime - v0.1.0+20131019
|
||||
* https://github.com/wikimedia/jquery.ime
|
||||
* Copyright (c) 2013 Santhosh Thottingal; Licensed GPL, MIT */
|
||||
( function ( $ ) {
|
||||
@@ -19,6 +19,7 @@
|
||||
$.ime.defaults.languages = arrayKeys( $.ime.languages );
|
||||
this.options = $.extend( {}, $.ime.defaults, options );
|
||||
this.active = false;
|
||||
this.shifted = false;
|
||||
this.inputmethod = null;
|
||||
this.language = null;
|
||||
this.context = '';
|
||||
@@ -34,6 +35,8 @@
|
||||
*/
|
||||
listen: function () {
|
||||
this.$element.on( 'keypress.ime', $.proxy( this.keypress, this ) );
|
||||
this.$element.on( 'keyup.ime', $.proxy( this.keyup, this ) );
|
||||
this.$element.on( 'keydown.ime', $.proxy( this.keydown, this ) );
|
||||
this.$element.on( 'destroy.ime', $.proxy( this.destroy, this ) );
|
||||
this.$element.on( 'enable.ime', $.proxy( this.enable, this ) );
|
||||
this.$element.on( 'disable.ime', $.proxy( this.disable, this ) );
|
||||
@@ -57,6 +60,14 @@
|
||||
patterns = this.inputmethod.patterns || [];
|
||||
}
|
||||
|
||||
if ( this.shifted ) {
|
||||
// if shift is pressed give priority for the patterns_shift
|
||||
// if exists.
|
||||
// Example: Shift+space where shift does not alter the keycode
|
||||
patterns = ( this.inputmethod.patterns_shift || [] )
|
||||
.concat( patterns );
|
||||
}
|
||||
|
||||
if ( $.isFunction( patterns ) ) {
|
||||
return patterns.call( this, input, context );
|
||||
}
|
||||
@@ -88,6 +99,18 @@
|
||||
return input;
|
||||
},
|
||||
|
||||
keyup: function ( e ) {
|
||||
if ( e.which === 16 ) { // shift key
|
||||
this.shifted = false;
|
||||
}
|
||||
},
|
||||
|
||||
keydown: function ( e ) {
|
||||
if ( e.which === 16 ) { // shift key
|
||||
this.shifted = true;
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Keypress handler
|
||||
* @param {jQuery.Event} e Event
|
||||
@@ -1066,9 +1089,14 @@
|
||||
* @return {string|bool} Selected input method id or false
|
||||
*/
|
||||
selectLanguage: function ( languageCode ) {
|
||||
var ime = this.$element.data( 'ime' ),
|
||||
imePref = $.ime.preferences.getIM( languageCode ),
|
||||
language = $.ime.languages[languageCode];
|
||||
var ime, imePref, language;
|
||||
|
||||
// consider language codes case insensitive
|
||||
languageCode = languageCode && languageCode.toLowerCase();
|
||||
|
||||
ime = this.$element.data( 'ime' );
|
||||
imePref = $.ime.preferences.getIM( languageCode );
|
||||
language = $.ime.languages[languageCode];
|
||||
|
||||
this.setMenuTitle( this.getAutonym( languageCode ) );
|
||||
|
||||
|
||||
Reference in New Issue
Block a user