Update jquery.ime from upstream
Change-Id: I37d3f1e6b0ebff3ddfd46b2c155e4f5fe590cb4b Version: 0.1.0+20130708
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
/*! jquery.ime - v0.1.0+20130707
|
||||
/*! jquery.ime - v0.1.0+20130708
|
||||
* https://github.com/wikimedia/jquery.ime
|
||||
* Copyright (c) 2013 Santhosh Thottingal; Licensed GPL, MIT */
|
||||
( function ( $ ) {
|
||||
@@ -486,7 +486,7 @@
|
||||
|
||||
var selectorTemplate, MutationObserver;
|
||||
|
||||
function IMESelector ( element, options ) {
|
||||
function IMESelector( element, options ) {
|
||||
this.$element = $( element );
|
||||
this.options = $.extend( {}, IMESelector.defaults, options );
|
||||
this.active = false;
|
||||
@@ -508,20 +508,24 @@
|
||||
},
|
||||
|
||||
prepareSelectorMenu: function () {
|
||||
|
||||
// TODO: In this approach there is a menu for each editable area.
|
||||
// With correct event mapping we can probably reduce it to one menu.
|
||||
this.$imeSetting = $( selectorTemplate );
|
||||
this.$menu = $( '<div class="imeselector-menu" role="menu">' );
|
||||
this.$menu.append( imeListTitle() )
|
||||
.append( imeList() )
|
||||
.append( toggleMenuItem() )
|
||||
.append( languageListTitle() );
|
||||
this.$menu.append(
|
||||
imeListTitle(),
|
||||
imeList(),
|
||||
toggleMenuItem(),
|
||||
languageListTitle()
|
||||
);
|
||||
|
||||
this.prepareLanguageList();
|
||||
this.$menu.append( this.helpLink() );
|
||||
|
||||
if ( $.i18n ) {
|
||||
this.$menu.i18n();
|
||||
}
|
||||
|
||||
this.$imeSetting.append( this.$menu );
|
||||
$( 'body' ).append( this.$imeSetting );
|
||||
},
|
||||
@@ -551,7 +555,8 @@
|
||||
imeselector.$imeSetting.css( 'opacity', 1 );
|
||||
imeselector.$imeSetting.css( 'margin-top', 0 );
|
||||
} );
|
||||
}, 2500 );
|
||||
}, 2500
|
||||
);
|
||||
},
|
||||
|
||||
focus: function () {
|
||||
@@ -597,6 +602,7 @@
|
||||
if ( t.hasClass( 'imeselector-toggle' ) ) {
|
||||
imeselector.toggle();
|
||||
}
|
||||
|
||||
return false;
|
||||
} );
|
||||
|
||||
@@ -619,24 +625,33 @@
|
||||
|
||||
imeselector.$menu.on( 'click.ime', 'li', function() {
|
||||
imeselector.$element.focus();
|
||||
|
||||
return false;
|
||||
} );
|
||||
|
||||
imeselector.$menu.on( 'click.ime', 'li.ime-im', function () {
|
||||
imeselector.selectIM( $( this ).data( 'ime-inputmethod' ) );
|
||||
|
||||
return false;
|
||||
} );
|
||||
|
||||
imeselector.$menu.on( 'click.ime', 'li.ime-lang', function () {
|
||||
imeselector.selectLanguage( $( this ).attr( 'lang' ) );
|
||||
|
||||
return false;
|
||||
} );
|
||||
|
||||
imeselector.$menu.on( 'click.ime', 'div.ime-disable', function () {
|
||||
imeselector.disableIM();
|
||||
|
||||
return false;
|
||||
} );
|
||||
|
||||
// Just make it work as a regular link
|
||||
imeselector.$menu.on( 'click.ime', '.ime-help-link', function ( e ) {
|
||||
e.stopPropagation();
|
||||
} );
|
||||
|
||||
imeselector.$element.on( 'focus.ime', function ( e ) {
|
||||
imeselector.selectLanguage( imeselector.decideLanguage() );
|
||||
imeselector.focus();
|
||||
@@ -683,10 +698,12 @@
|
||||
} else {
|
||||
languageCode = this.decideLanguage();
|
||||
this.selectLanguage( languageCode );
|
||||
|
||||
if ( !ime.isActive() && $.ime.languages[languageCode] ) {
|
||||
// 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 {
|
||||
@@ -812,9 +829,8 @@
|
||||
|
||||
/**
|
||||
* Decide on initial language to select
|
||||
*
|
||||
*/
|
||||
decideLanguage : function () {
|
||||
decideLanguage: function () {
|
||||
if ( $.ime.preferences.getLanguage() ) {
|
||||
// There has been an override by the user,
|
||||
// so return the language selected by user
|
||||
@@ -824,7 +840,7 @@
|
||||
if ( this.$element.attr('lang' ) &&
|
||||
$.ime.languages[ this.$element.attr( 'lang' ) ]
|
||||
) {
|
||||
return this.$element.attr( 'lang' );
|
||||
return this.$element.attr( 'lang' );
|
||||
}
|
||||
|
||||
// There is either no IMs for the given language attr
|
||||
@@ -892,7 +908,7 @@
|
||||
* Prepare language list
|
||||
*/
|
||||
prepareLanguageList: function () {
|
||||
var languageCodeIndex = 0,
|
||||
var languageCodeIndex,
|
||||
$languageListWrapper,
|
||||
$languageList,
|
||||
languageList,
|
||||
@@ -950,8 +966,12 @@
|
||||
$imeItem = $( '<a>' ).attr( 'href', '#' ).text( name ),
|
||||
$inputMethod = $( '<li data-ime-inputmethod=' + inputmethod + '>' );
|
||||
|
||||
$inputMethod.append( '<span class="ime-im-check">' ).append( $imeItem );
|
||||
$inputMethod.addClass( 'ime-im' );
|
||||
$inputMethod
|
||||
.append(
|
||||
'<span class="ime-im-check">',
|
||||
$imeItem
|
||||
)
|
||||
.addClass( 'ime-im' );
|
||||
$imeList.append( $inputMethod );
|
||||
} );
|
||||
},
|
||||
@@ -993,33 +1013,33 @@
|
||||
|
||||
$.fn.imeselector.Constructor = IMESelector;
|
||||
|
||||
function languageListTitle () {
|
||||
function languageListTitle() {
|
||||
return $( '<h3>' )
|
||||
.addClass( 'ime-lang-title' )
|
||||
.attr( 'data-i18n', 'jquery-ime-other-languages' )
|
||||
.text( 'Other languages' );
|
||||
}
|
||||
|
||||
function imeList () {
|
||||
function imeList() {
|
||||
return $( '<ul>' ).addClass( 'ime-list' );
|
||||
}
|
||||
|
||||
function imeListTitle () {
|
||||
function imeListTitle() {
|
||||
return $( '<h3>' ).addClass( 'ime-list-title' );
|
||||
}
|
||||
|
||||
function toggleMenuItem () {
|
||||
return $( '<div class="ime-disable">' )
|
||||
.append( $( '<span>' )
|
||||
function toggleMenuItem() {
|
||||
return $( '<div class="ime-disable">' ).append(
|
||||
$( '<span>' )
|
||||
.attr( {
|
||||
'class': 'ime-disable-link',
|
||||
'data-i18n': 'jquery-ime-disable-text'
|
||||
} )
|
||||
.text( 'System input method' )
|
||||
).append( $( '<span>' )
|
||||
.text( 'System input method' ),
|
||||
$( '<span>' )
|
||||
.addClass( 'ime-disable-shortcut' )
|
||||
.text( 'CTRL+M' )
|
||||
);
|
||||
);
|
||||
}
|
||||
|
||||
selectorTemplate = '<div class="imeselector imeselector-toggle">' +
|
||||
@@ -1036,13 +1056,13 @@
|
||||
* @param event Event object
|
||||
* @return bool
|
||||
*/
|
||||
function isShortcutKey ( event ) {
|
||||
function isShortcutKey( event ) {
|
||||
// 77 - The letter M, for Ctrl-M
|
||||
// 13 - The Enter key
|
||||
return event.ctrlKey && !event.altKey && ( event.which === 77 || event.which === 13 );
|
||||
}
|
||||
|
||||
function isDOMAttrModifiedSupported () {
|
||||
function isDOMAttrModifiedSupported() {
|
||||
var p = document.createElement( 'p' ),
|
||||
flag = false;
|
||||
|
||||
@@ -1557,15 +1577,15 @@
|
||||
source: 'rules/no/no-tildeforms.js'
|
||||
},
|
||||
'or-transliteration': {
|
||||
name: 'ଟରନସଲିତେରତିଓନ',
|
||||
name: 'ଟ୍ରାନ୍ସଲି ଟରେସନ',
|
||||
source: 'rules/or/or-transliteration.js'
|
||||
},
|
||||
'or-inscript': {
|
||||
name: 'ଈନସକରିପତ',
|
||||
name: 'ଇନସ୍କ୍ରିପ୍ଟ',
|
||||
source: 'rules/or/or-inscript.js'
|
||||
},
|
||||
'or-inscript2': {
|
||||
name: 'ଈନସକରିପତ2',
|
||||
name: 'ଇନସ୍କ୍ରିପ୍ଟ2',
|
||||
source: 'rules/or/or-inscript2.js'
|
||||
},
|
||||
'or-lekhani': {
|
||||
@@ -1573,7 +1593,7 @@
|
||||
source: 'rules/or/or-lekhani.js'
|
||||
},
|
||||
'or-phonetic': {
|
||||
name: 'ହୋନେତିକ',
|
||||
name: 'ଫୋନେଟିକ',
|
||||
source: 'rules/or/or-phonetic.js'
|
||||
},
|
||||
'sd-inscript2': {
|
||||
@@ -1917,7 +1937,7 @@
|
||||
},
|
||||
'or': {
|
||||
autonym: 'ଓଡ଼ିଆ',
|
||||
inputmethods: [ 'or-transliteration', 'or-lekhani', 'or-inscript', 'or-phonetic', 'or-inscript2' ]
|
||||
inputmethods: [ 'or-phonetic', 'or-transliteration', 'or-inscript', 'or-inscript2', 'or-lekhani' ]
|
||||
},
|
||||
'pa': {
|
||||
autonym: 'ਪੰਜਾਬੀ',
|
||||
|
||||
Reference in New Issue
Block a user