Update jquery.ime from upstream
Bug: 50790 Change-Id: I3755581136cca9958e31b20694c4285c14646c38
This commit is contained in:
@@ -1,4 +1,4 @@
|
|||||||
/*! jquery.ime - v0.1.0+20130626
|
/*! jquery.ime - v0.1.0+20130707
|
||||||
* https://github.com/wikimedia/jquery.ime
|
* https://github.com/wikimedia/jquery.ime
|
||||||
* Copyright (c) 2013 Santhosh Thottingal; Licensed GPL, MIT */
|
* Copyright (c) 2013 Santhosh Thottingal; Licensed GPL, MIT */
|
||||||
( function ( $ ) {
|
( function ( $ ) {
|
||||||
@@ -187,8 +187,9 @@
|
|||||||
},
|
},
|
||||||
|
|
||||||
setLanguage: function ( languageCode ) {
|
setLanguage: function ( languageCode ) {
|
||||||
if ( $.inArray( languageCode, this.options.languages ) === -1 ) {
|
if ( !$.ime.languages[languageCode] ) {
|
||||||
debug( 'Language ' + languageCode + ' is not known to jquery.ime.' );
|
debug( 'Language ' + languageCode + ' is not known to jquery.ime.' );
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -668,6 +669,7 @@
|
|||||||
keydown: function ( e ) {
|
keydown: function ( e ) {
|
||||||
var ime = $( e.target ).data( 'ime' ),
|
var ime = $( e.target ).data( 'ime' ),
|
||||||
firstInputmethod,
|
firstInputmethod,
|
||||||
|
previousInputMethods,
|
||||||
languageCode;
|
languageCode;
|
||||||
|
|
||||||
this.focus(); // shows the trigger in case it is hidden
|
this.focus(); // shows the trigger in case it is hidden
|
||||||
@@ -683,12 +685,18 @@
|
|||||||
this.selectLanguage( languageCode );
|
this.selectLanguage( languageCode );
|
||||||
if ( !ime.isActive() && $.ime.languages[languageCode] ) {
|
if ( !ime.isActive() && $.ime.languages[languageCode] ) {
|
||||||
// Even after pressing toggle shortcut again, it is still disabled
|
// Even after pressing toggle shortcut again, it is still disabled
|
||||||
|
// Check if there is a previously used input method.
|
||||||
|
previousInputMethods = $.ime.preferences.getPreviousInputMethods();
|
||||||
|
if ( previousInputMethods[0] ) {
|
||||||
|
this.selectIM( previousInputMethods[0] );
|
||||||
|
} else {
|
||||||
// Provide the default input method in this case.
|
// Provide the default input method in this case.
|
||||||
firstInputmethod = $.ime.languages[languageCode].inputmethods[0];
|
firstInputmethod = $.ime.languages[languageCode].inputmethods[0];
|
||||||
this.selectIM( firstInputmethod );
|
this.selectIM( firstInputmethod );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
e.stopPropagation();
|
e.stopPropagation();
|
||||||
@@ -1091,6 +1099,7 @@
|
|||||||
isDirty: false,
|
isDirty: false,
|
||||||
language : null,
|
language : null,
|
||||||
previousLanguages: [], // array of previous languages
|
previousLanguages: [], // array of previous languages
|
||||||
|
previousInputMethods: [], // array of previous inputmethods
|
||||||
imes: {
|
imes: {
|
||||||
'en': 'system'
|
'en': 'system'
|
||||||
}
|
}
|
||||||
@@ -1110,7 +1119,8 @@
|
|||||||
|
|
||||||
// Add to the previous languages, but avoid duplicates.
|
// Add to the previous languages, but avoid duplicates.
|
||||||
if ( $.inArray( language, this.registry.previousLanguages ) === -1 ) {
|
if ( $.inArray( language, this.registry.previousLanguages ) === -1 ) {
|
||||||
this.registry.previousLanguages.push( language );
|
this.registry.previousLanguages.unshift( language );
|
||||||
|
this.registry.previousLanguages = this.registry.previousLanguages.slice( 0, 5 );
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
@@ -1126,6 +1136,10 @@
|
|||||||
return this.registry.previousLanguages;
|
return this.registry.previousLanguages;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
getPreviousInputMethods: function () {
|
||||||
|
return this.registry.previousInputMethods;
|
||||||
|
},
|
||||||
|
|
||||||
// Set the given IM as the last used for the language
|
// Set the given IM as the last used for the language
|
||||||
setIM: function ( inputMethod ) {
|
setIM: function ( inputMethod ) {
|
||||||
if ( !this.registry.imes ) {
|
if ( !this.registry.imes ) {
|
||||||
@@ -1139,6 +1153,15 @@
|
|||||||
|
|
||||||
this.registry.imes[this.getLanguage()] = inputMethod;
|
this.registry.imes[this.getLanguage()] = inputMethod;
|
||||||
this.registry.isDirty = true;
|
this.registry.isDirty = true;
|
||||||
|
if ( !this.registry.previousInputMethods ) {
|
||||||
|
this.registry.previousInputMethods = [];
|
||||||
|
}
|
||||||
|
|
||||||
|
// Add to the previous languages,
|
||||||
|
if ( inputMethod !== 'system' ) {
|
||||||
|
this.registry.previousInputMethods.unshift( inputMethod );
|
||||||
|
this.registry.previousInputMethods = this.registry.previousInputMethods.slice( 0, 5 );
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
// Return the last used or the default IM for language
|
// Return the last used or the default IM for language
|
||||||
@@ -1397,10 +1420,6 @@
|
|||||||
name: 'עברית עם ניקוד',
|
name: 'עברית עם ניקוד',
|
||||||
source: 'rules/he/he-standard-2012-extonly.js'
|
source: 'rules/he/he-standard-2012-extonly.js'
|
||||||
},
|
},
|
||||||
'he-kbd': {
|
|
||||||
name: 'כבד',
|
|
||||||
source: 'rules/he/he-kbd.js'
|
|
||||||
},
|
|
||||||
'hr-kbd': {
|
'hr-kbd': {
|
||||||
name: 'Croatian kbd',
|
name: 'Croatian kbd',
|
||||||
source: 'rules/hr/hr-kbd.js'
|
source: 'rules/hr/hr-kbd.js'
|
||||||
@@ -1782,7 +1801,7 @@
|
|||||||
},
|
},
|
||||||
'he': {
|
'he': {
|
||||||
autonym: 'עברית',
|
autonym: 'עברית',
|
||||||
inputmethods: [ 'he-standard-2012-extonly', 'he-standard-2012', 'he-kbd' ]
|
inputmethods: [ 'he-standard-2012-extonly', 'he-standard-2012' ]
|
||||||
},
|
},
|
||||||
'hi': {
|
'hi': {
|
||||||
autonym: 'हिन्दी',
|
autonym: 'हिन्दी',
|
||||||
|
|||||||
@@ -1,58 +0,0 @@
|
|||||||
( function ( $ ) {
|
|
||||||
'use strict';
|
|
||||||
|
|
||||||
var heKbd = {
|
|
||||||
id: 'he-kbd',
|
|
||||||
name: 'Hebrew kbd',
|
|
||||||
description: 'Hebrew kbd keyboard layout',
|
|
||||||
date: '2013-02-11',
|
|
||||||
URL: 'http://github.com/wikimedia/jquery.ime',
|
|
||||||
author: 'Parag Nemade',
|
|
||||||
license: 'GPLv3',
|
|
||||||
version: '1.0',
|
|
||||||
patterns: [
|
|
||||||
['\\`', ';'],
|
|
||||||
['q', '/'],
|
|
||||||
['w', '\''],
|
|
||||||
['e', 'ק'],
|
|
||||||
['r', 'ר'],
|
|
||||||
['t', 'א'],
|
|
||||||
['y', 'ט'],
|
|
||||||
['u', 'ו'],
|
|
||||||
['i', 'ן'],
|
|
||||||
['o', 'ם'],
|
|
||||||
['p', 'פ'],
|
|
||||||
['a', 'ש'],
|
|
||||||
['s', 'ד'],
|
|
||||||
['d', 'ג'],
|
|
||||||
['f', 'כ'],
|
|
||||||
['g', 'ע'],
|
|
||||||
['h', 'י'],
|
|
||||||
['j', 'ח'],
|
|
||||||
['k', 'ל'],
|
|
||||||
['l', 'ך'],
|
|
||||||
[';', 'ף'],
|
|
||||||
['z', 'ז'],
|
|
||||||
['x', 'ס'],
|
|
||||||
['c', 'ב'],
|
|
||||||
['v', 'ה'],
|
|
||||||
['b', 'נ'],
|
|
||||||
['n', 'מ'],
|
|
||||||
['m', 'צ'],
|
|
||||||
[',', 'ת'],
|
|
||||||
['.', 'ץ'],
|
|
||||||
['/', '.'],
|
|
||||||
['\'', ','],
|
|
||||||
['\\(', ')'],
|
|
||||||
['\\)', '('],
|
|
||||||
['\\<', '>'],
|
|
||||||
['\\>', '<'],
|
|
||||||
['\\[', ']'],
|
|
||||||
['\\]', '['],
|
|
||||||
['\\{', '}'],
|
|
||||||
['\\}', '{']]
|
|
||||||
|
|
||||||
};
|
|
||||||
$.ime.register( heKbd );
|
|
||||||
|
|
||||||
}( jQuery ) );
|
|
||||||
Reference in New Issue
Block a user