Merge "Update jquery.ime from upstream"
This commit is contained in:
@@ -7,6 +7,7 @@
|
||||
background-image: linear-gradient(transparent, transparent), url('../images/ime-active.svg');
|
||||
background-color: rgba(255,255,255,0.75);
|
||||
background-position: left 3px center;
|
||||
background-position-x: 3px;
|
||||
height: 15px;
|
||||
font-size: small;
|
||||
padding: 2px 2px 1px 20px;
|
||||
@@ -168,10 +169,12 @@ span.ime-disable-shortcut {
|
||||
|
||||
.imeselector-menu .ime-checked {
|
||||
/* @embed */
|
||||
background: url(../images/tick.png) no-repeat left 4px center;
|
||||
background: url(../images/tick.png) no-repeat left center;
|
||||
background-image: -webkit-linear-gradient(transparent, transparent), url('../images/tick.svg');
|
||||
background-image: -moz-linear-gradient(transparent, transparent), url('../images/tick.svg');
|
||||
background-image: linear-gradient(transparent, transparent), url('../images/tick.svg');
|
||||
background-position: left 4px center;
|
||||
background-position-x: 4px;
|
||||
}
|
||||
|
||||
.imeselector-menu .ime-help-link {
|
||||
|
||||
@@ -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 ) );
|
||||
|
||||
|
||||
@@ -155,7 +155,11 @@
|
||||
['m', '…'],
|
||||
[',', ','],
|
||||
['\\.', '\''],
|
||||
['/', '?']
|
||||
['/', '?'],
|
||||
[' ', '\xa0']
|
||||
],
|
||||
patterns_shift: [
|
||||
[' ', '\u200c']
|
||||
]
|
||||
};
|
||||
|
||||
|
||||
@@ -12,14 +12,14 @@
|
||||
patterns: [
|
||||
['्f', '्\u200c'],
|
||||
['\\~', 'ऎ'],
|
||||
['\\`","ॆ'],
|
||||
['\\`','ॆ'],
|
||||
['\\!', 'ऍ'],
|
||||
['1', '१'],
|
||||
['\\@', 'ॅ'],
|
||||
['2', '२'],
|
||||
['\\#', 'ऑ'],
|
||||
['3', '३'],
|
||||
['\\$","ॉ'],
|
||||
['\\$','ॉ'],
|
||||
['4', '४'],
|
||||
['\\%', 'ञ'],
|
||||
['5', '५'],
|
||||
|
||||
Reference in New Issue
Block a user