Update jquery.ime from upstream

Change-Id: I1eabfcda79be85c8c28c11472ddc17b2e90c061d
This commit is contained in:
Amir E. Aharoni
2013-07-15 15:59:29 +03:00
parent 482a7488bf
commit 95c23085ff
11 changed files with 154 additions and 155 deletions

View File

@@ -7,7 +7,6 @@
background-image: linear-gradient(transparent, transparent), url('../images/ime-active.svg');
background-color: rgba(255,255,255,0.75);
background-position: left 3px center;
cursor: pointer;
height: 15px;
font-size: small;
padding: 2px 2px 1px 20px;
@@ -19,13 +18,15 @@
z-index: 9999;
}
div.imeselector:hover {
.imeselector:hover {
box-shadow: 0 1px 3px 0 #565656;
border-top: none;
background-color: rgba(255,255,255,0.85);
}
.imeselector a {
.imeselector a,
.ime-disable {
cursor: pointer;
text-decoration: none;
outline: none;
color: #222222;
@@ -49,11 +50,7 @@ div.imeselector:hover {
}
span.ime-disable-link {
color: #222222;
line-height: 1em;
padding-top: 4px;
padding-left: 20px;
padding-bottom: 4px;
white-space: nowrap;
}
@@ -110,7 +107,7 @@ span.ime-disable-shortcut {
text-align: left;
}
.imeselector-menu.right {
.imeselector-menu.ime-right {
right: auto;
}
@@ -133,7 +130,7 @@ span.ime-disable-shortcut {
top: -7px;
}
.imeselector-menu.right:before {
.imeselector-menu.ime-right:before {
right: auto;
left: 9px;
}
@@ -150,26 +147,26 @@ span.ime-disable-shortcut {
}
.imeselector-menu.right:after {
.imeselector-menu.ime-right:after {
right: auto;
left: 10px;
}
.imeselector-menu.position-top:before {
.imeselector-menu.ime-position-top:before {
border-bottom: 0 none;
border-top: 7px solid #888;
top: auto;
bottom: -7px;
}
.imeselector-menu.position-top:after {
.imeselector-menu.ime-position-top:after {
border-bottom: 0 none;
border-top: 6px solid #FFFFFF;
top: auto;
bottom: -6px;
}
.imeselector-menu .checked {
.imeselector-menu .ime-checked {
/* @embed */
background: url(../images/tick.png) left 4px center no-repeat;
background-image: -webkit-linear-gradient(transparent, transparent), url('../images/tick.svg');
@@ -191,24 +188,26 @@ span.ime-disable-shortcut {
color: #000;
}
.imeselector-menu a {
.imeselector-menu .selectable-row-item {
display: block;
padding-left: 20px;
padding-right: 20px;
clear: both;
font-weight: normal;
color: #333333;
outline: none;
white-space: nowrap;
position: relative;
}
.imeselector-menu li > a:hover {
text-decoration: none;
color: #ffffff;
background-color: #5089e8;
.imeselector-menu .selectable-row {
cursor: pointer;
}
.open {
.imeselector-menu .selectable-row:hover {
background-color: #f0f0f0;
}
.ime-open {
*z-index: 1000;
display: block;
}

View File

@@ -1,9 +1,15 @@
/*! jquery.ime - v0.1.0+20130708
/*! jquery.ime - v0.1.0+20130715
* https://github.com/wikimedia/jquery.ime
* Copyright (c) 2013 Santhosh Thottingal; Licensed GPL, MIT */
( function ( $ ) {
'use strict';
/**
* @TODO: document
* @param {Function} [options.helpHandler] Called for each input method row in the selector
* @param {Object} options.helpHandler.imeSelector
* @param {String} options.helpHandler.ime Id of the input method
*/
function IME( element, options ) {
this.$element = $( element );
// This needs to be delayed here since extending language list happens at DOM ready
@@ -99,9 +105,9 @@
altGr = true;
}
// Don't process ASCII control characters (except linefeed),
// as well as anything involving
// Alt (except for extended keymaps), Ctrl and Meta
// Don't process ASCII control characters except linefeed,
// as well as anything involving Ctrl, Meta and Alt,
// but do process extended keymaps
if ( ( e.which < 32 && e.which !== 13 && !altGr ) || e.ctrlKey || e.metaKey ) {
// Blank the context
this.context = '';
@@ -121,9 +127,11 @@
// Get the last few characters before the one the user just typed,
// to provide context for the transliteration regexes.
// We need to append c because it hasn't been added to $this.val() yet
input = this.lastNChars( this.$element.val() || this.$element.text(), startPos,
this.inputmethod.maxKeyLength )
+ c;
input = this.lastNChars(
this.$element.val() || this.$element.text(),
startPos,
this.inputmethod.maxKeyLength
) + c;
replacement = this.transliterate( input, this.context, altGr );
@@ -132,8 +140,9 @@
if ( this.context.length > this.inputmethod.contextLength ) {
// The buffer is longer than needed, truncate it at the front
this.context = this.context.substring( this.context.length
- this.inputmethod.contextLength );
this.context = this.context.substring(
this.context.length - this.inputmethod.contextLength
);
}
// If replacement equals to input, no replacement is made, because
@@ -310,7 +319,8 @@
// default options
$.ime.defaults = {
imePath: '../', // Relative/Absolute path for the rules folder of jquery.ime
languages: [] // Languages to be used- by default all languages
languages: [], // Languages to be used- by default all languages
helpHandler: null // Called for each ime option in the menu
};
// private function for debugging
@@ -562,13 +572,13 @@
focus: function () {
// Hide all other IME settings and collapse open menus
$( 'div.imeselector' ).hide();
$( 'div.imeselector-menu' ).removeClass( 'open' );
$( 'div.imeselector-menu' ).removeClass( 'ime-open' );
this.$imeSetting.show();
this.resetTimer();
},
show: function () {
this.$menu.addClass( 'open' );
this.$menu.addClass( 'ime-open' );
this.stopTimer();
this.$imeSetting.show();
@@ -576,14 +586,14 @@
},
hide: function () {
this.$menu.removeClass( 'open' );
this.$menu.removeClass( 'ime-open' );
this.resetTimer();
return false;
},
toggle: function () {
if ( this.$menu.hasClass( 'open' ) ) {
if ( this.$menu.hasClass( 'ime-open' ) ) {
this.hide();
} else {
this.show();
@@ -607,7 +617,7 @@
} );
imeselector.$element.on( 'blur.ime', function () {
if ( !imeselector.$imeSetting.hasClass( 'onfocus' ) ) {
if ( !imeselector.$imeSetting.hasClass( 'ime-onfocus' ) ) {
imeselector.$imeSetting.hide();
imeselector.hide();
}
@@ -617,10 +627,10 @@
// We don't want the selector to disappear
// while the user is trying to click it
imeselector.stopTimer();
imeselector.$imeSetting.addClass( 'onfocus' );
imeselector.$imeSetting.addClass( 'ime-onfocus' );
} ).mouseleave( function () {
imeselector.resetTimer();
imeselector.$imeSetting.removeClass( 'onfocus' );
imeselector.$imeSetting.removeClass( 'ime-onfocus' );
} );
imeselector.$menu.on( 'click.ime', 'li', function() {
@@ -757,7 +767,7 @@
// Flip the menu to the top only if it can fit in the space there
if ( menutop < top ) {
this.$menu
.addClass( 'position-top' )
.addClass( 'ime-position-top' )
.css( 'top', -menutop );
}
}
@@ -780,11 +790,11 @@
if ( this.$element.css( 'direction' ) === 'rtl' ) {
this.$menu
.css( 'left', 0 )
.addClass( 'left' );
.addClass( 'ime-left' );
} else {
this.$menu
.css( 'left', position.left )
.addClass( 'right' );
.addClass( 'ime-right' );
}
}
},
@@ -861,10 +871,10 @@
return;
}
this.$menu.find( '.checked' ).removeClass( 'checked' );
this.$menu.find( 'li.ime-disable' ).removeClass( 'checked' );
this.$menu.find( '.ime-checked' ).removeClass( 'ime-checked' );
this.$menu.find( 'li.ime-disable' ).removeClass( 'ime-checked' );
this.$menu.find( 'li[data-ime-inputmethod=' + inputmethodId + ']' )
.addClass( 'checked' );
.addClass( 'ime-checked' );
ime = this.$element.data( 'ime' );
if ( inputmethodId === 'system' ) {
@@ -893,8 +903,8 @@
* Disable the inputmethods (Use the system input method)
*/
disableIM: function () {
this.$menu.find( '.checked' ).removeClass( 'checked' );
this.$menu.find( 'div.ime-disable' ).addClass( 'checked' );
this.$menu.find( '.ime-checked' ).removeClass( 'ime-checked' );
this.$menu.find( 'div.ime-disable' ).addClass( 'ime-checked' );
this.$element.data( 'ime' ).disable();
this.$imeSetting.find( 'a.ime-name' ).text( '' );
this.hide();
@@ -936,8 +946,11 @@
continue;
}
$languageItem = $( '<a>' ).attr( 'href', '#' ).text( language.autonym );
$language = $( '<li class="ime-lang">' ).attr( 'lang', languageCode );
$languageItem = $( '<a>' )
.attr( 'href', '#' )
.text( language.autonym )
.addClass( 'selectable-row-item' );
$language = $( '<li class="ime-lang selectable-row">' ).attr( 'lang', languageCode );
$language.append( $languageItem );
$languageList.append( $language );
}
@@ -953,32 +966,41 @@
/**
* Prepare input methods in menu for the given language code
*
* @param languageCode
* @param {String} languageCode
*/
prepareInputMethods: function ( languageCode ) {
var language = $.ime.languages[languageCode],
$imeList = this.$menu.find( '.ime-list' );
$imeList = this.$menu.find( '.ime-list' ),
imeSelector = this;
$imeList.empty();
$.each( language.inputmethods, function ( index, inputmethod ) {
var name = $.ime.sources[inputmethod].name,
$imeItem = $( '<a>' ).attr( 'href', '#' ).text( name ),
$inputMethod = $( '<li data-ime-inputmethod=' + inputmethod + '>' );
var $imeItem, $inputMethod,
name = $.ime.sources[inputmethod].name;
$imeItem = $( '<a>' )
.attr( 'href', '#' )
.text( name )
.addClass( 'selectable-row-item' );
$inputMethod = $( '<li>' )
.attr( 'data-ime-inputmethod', inputmethod )
.addClass( 'ime-im selectable-row' )
.append( '<span class="ime-im-check"></span>', $imeItem );
if ( imeSelector.options.helpHandler ) {
$inputMethod.append( imeSelector.options.helpHandler.call( imeSelector, inputmethod ) );
}
$inputMethod
.append(
'<span class="ime-im-check">',
$imeItem
)
.addClass( 'ime-im' );
$imeList.append( $inputMethod );
} );
},
helpLink: function () {
return $( '<div class="ime-help-link">' )
return $( '<div class="ime-help-link selectable-row">' )
.append( $( '<a>' ).text( 'Help' )
.addClass( 'selectable-row-item' )
.attr( {
'href': 'http://github.com/wikimedia/jquery.ime',
'target': '_blank',
@@ -1029,7 +1051,7 @@
}
function toggleMenuItem() {
return $( '<div class="ime-disable">' ).append(
return $( '<div class="ime-disable selectable-row">' ).append(
$( '<span>' )
.attr( {
'class': 'ime-disable-link',
@@ -1424,9 +1446,9 @@
name: 'ปัตตะโชติ',
source: 'rules/th/th-pattachote.js'
},
'de': {
'de-transliteration': {
name: 'Deutsch',
source: 'rules/de/de.js'
source: 'rules/de/de-transliteration.js'
},
'el-kbd': {
name: 'Τυπική πληκτρολόγιο',
@@ -1785,7 +1807,7 @@
},
'de': {
autonym: 'Deutsch',
inputmethods: [ 'de' ]
inputmethods: [ 'de-transliteration' ]
},
'doi': {
autonym: 'डोगरी',

View File

@@ -2,7 +2,7 @@
'use strict';
var de = {
id: 'de',
id: 'de-transliteration',
name: 'Deutsch',
description: 'German input method',
date: '2012-11-20',

View File

@@ -43,6 +43,8 @@
['5', '°'], // Degree
['6', '֫'], // Ole
['8', '×'], // Multiplication
['9', '\u200e'], // LRM
['0', '\u200f'], // RLM
['\\.', '÷'], // Division
['\u05D8', 'װ'], // Double vav, ט

View File

@@ -94,6 +94,8 @@
[ '5', '°' ], // Degree
[ '6', '֫' ], // Ole
[ '8', '×' ], // Multiplication
[ '9', '\u200e' ], // LRM
[ '0', '\u200f' ], // RLM
[ '/', '÷' ], // Division
[ 'y', 'װ' ], // Double vav

View File

@@ -111,7 +111,7 @@
['H', 'ೞ'],
['j', 'ೲ'],
['\\>', 'ಽ'],
['.', '॥']
['\\.', '॥']
]
};

View File

@@ -97,13 +97,13 @@
['\\<', 'ऩ'],
[',', ','],
['\\>', '़'],
['.', '।'],
['\\?', 'ऐ'],
['/', 'ए'],
['\\^', 'ज्ञ'],
['X', 'क्ष'],
['\\*', 'श्र'],
['ff', '्‌']]
['ff', '्‌']
]
};
$.ime.register( mrPhonetic );

View File

@@ -3,7 +3,7 @@
var orLekhani = {
id: 'or-lekhani',
name: 'Odia Lekhani',
name: 'ଫୋନେଟିକ',
description: 'Odia Lekhani phonetic input method',
date: '2012-10-14',
URL: 'http://github.com/wikimedia/jquery.ime',

View File

@@ -3,8 +3,8 @@
var orTransliteration = {
id: 'or-transliteration',
name: 'Odia Transliteration',
description: 'ଟ୍ରାନ୍ସଲି ଟରେସନ',
name: 'ଟ୍ରାନ୍ସଲିଟରେସନ',
description: 'Odia Transliteration',
date: '2012-10-14',
URL: 'http://github.com/wikimedia/jquery.ime',
author: 'Junaid P V and Subhashish Panigrahi',

View File

@@ -5,83 +5,12 @@
id: 'sk-kbd',
name: 'Slovak kbd',
description: 'Slovak kbd keyboard layout',
date: '2013-02-12',
date: '2013-06-26',
URL: 'http://github.com/wikimedia/jquery.ime',
author: 'Parag Nemade',
license: 'GPLv3',
version: '1.0',
version: '1.1',
patterns: [
['+\'a', 'ä'],
['+\'o', 'ö'],
['+\'u', 'ü'],
['+\'A', 'Ä'],
['+\'O', 'Ö'],
['+\'U', 'Ü'],
['\'a', 'á'],
['+a', 'ä'],
['+c', 'č'],
['+d', 'ď'],
['\'e', 'é'],
['+e', 'ě'],
['\'i', 'í'],
['\'l', 'ĺ'],
['+l', 'ľ'],
['+n', 'ň'],
['\'o', 'ó'],
['+o', 'ô'],
['^o', 'ô'],
['\'r', 'ŕ'],
['+r', 'ř'],
['\'s', 'ß'],
['+s', 'š'],
['+t', 'ť'],
['\'u', 'ú'],
['+u', 'ů'],
['\'z', 'ý'],
['+y', 'ž'],
['\'A', 'Á'],
['+A', 'Ä'],
['+C', 'Č'],
['+D', 'Ď'],
['\'E', 'É'],
['+E', 'Ě'],
['\'I', 'Í'],
['\'L', 'Ĺ'],
['+L', 'Ľ'],
['+N', 'Ň'],
['\'O', 'Ó'],
['+O', 'Ô'],
['~O', 'Ô'],
['\'R', 'Ŕ'],
['+R', 'Ř'],
['\'S', 'ß'],
['+S', 'Š'],
['+T', 'Ť'],
['\'U', 'Ú'],
['+U', 'Ů'],
['\'Z', 'Ý'],
['+Y', 'Ž'],
['\'q', '`'],
['\'2', '@'],
['\'3', '#'],
['\'4', '$'],
['\'5', '%'],
['\'6', '^'],
['\'7', '&'],
['\'8', '*'],
['\'9', '('],
['\'0', ')'],
['+1', '!'],
['+2', '@'],
['+3', '#'],
['+4', '$'],
['+5', '%'],
['+6', '^'],
['+7', '&'],
['+8', '*'],
['+9', '('],
['+0', ')'],
['1', '+'],
['2', 'ľ'],
['3', 'š'],
@@ -92,19 +21,20 @@
['8', 'á'],
['9', 'í'],
['0', 'é'],
['\\!', '1'],
['\\@', '2'],
['\\#', '3'],
['!', '1'],
['@', '2'],
['#', '3'],
['\\$', '4'],
['\\%', '5'],
['%', '5'],
['\\^', '6'],
['\\&', '7'],
['&', '7'],
['\\*', '8'],
['\\(', '9'],
['\\)', '0'],
['\\-', '='],
['\\_', '%'],
['\\=', '\''],
['-', '='],
['_', '%'],
['=', '´'],
['\\+', 'ˇ'],
['\\[', 'ú'],
['\\{', '/'],
['\\]', 'ä'],
@@ -120,11 +50,55 @@
['/', '-'],
['\\?', '_'],
['`', ';'],
['\\~', '^'],
['~', '°'],
['´a', 'á'],
['´A', 'Á'],
['´e', 'é'],
['´E', 'É'],
['´i', 'í'],
['´I', 'Í'],
['´l', 'ĺ'],
['´L', 'Ĺ'],
['´o', 'ó'],
['´O', 'Ó'],
['´r', 'ŕ'],
['´R', 'Ŕ'],
['´u', 'ú'],
['´U', 'Ú'],
['´y', 'ý'],
['´Y', 'Ý'],
['¨a', 'ä'],
['¨A', 'Ä'],
['\\^o', 'ô'],
['\\^O', 'Ô'],
['ˇc', 'č'],
['ˇC', 'Č'],
['ˇd', 'ď'],
['ˇD', 'Ď'],
['ˇl', 'ľ'],
['ˇL', 'Ľ'],
['ˇn', 'ň'],
['ˇN', 'Ň'],
['ˇs', 'š'],
['ˇS', 'Š'],
['ˇt', 'ť'],
['ˇT', 'Ť'],
['ˇz', 'ž'],
['ˇZ', 'Ž'],
// It's QWERTZ
['y', 'z'],
['z', 'y'],
['Y', 'Z'],
['Z', 'Y']]
['Z', 'Y']
],
patterns_x: [
['3', '^'],
['=', '¨']
]
};
$.ime.register( skKbd );

View File

@@ -99,7 +99,7 @@
['v', '௳'],
['b', '௵'],
[',', '௹'],
['.', '॥']
['\\.', '॥']
]
};