Update jquery.ime from upstream
Change-Id: I37d3f1e6b0ebff3ddfd46b2c155e4f5fe590cb4b Version: 0.1.0+20130708
This commit is contained in:
1 parent
e4cefe06fd
commit
2f61970301
6 files changed
+54
-34
No files matched your search
@@ -1,4 +1,4 @@
|
|||||||
/*! jquery.ime - v0.1.0+20130707
|
/*! jquery.ime - v0.1.0+20130708
|
||||||
* 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 ( $ ) {
|
||||||
@@ -486,7 +486,7 @@
|
|||||||
|
|
||||||
var selectorTemplate, MutationObserver;
|
var selectorTemplate, MutationObserver;
|
||||||
|
|
||||||
function IMESelector ( element, options ) {
|
function IMESelector( element, options ) {
|
||||||
this.$element = $( element );
|
this.$element = $( element );
|
||||||
this.options = $.extend( {}, IMESelector.defaults, options );
|
this.options = $.extend( {}, IMESelector.defaults, options );
|
||||||
this.active = false;
|
this.active = false;
|
||||||
@@ -508,20 +508,24 @@
|
|||||||
},
|
},
|
||||||
|
|
||||||
prepareSelectorMenu: function () {
|
prepareSelectorMenu: function () {
|
||||||
|
|
||||||
// TODO: In this approach there is a menu for each editable area.
|
// TODO: In this approach there is a menu for each editable area.
|
||||||
// With correct event mapping we can probably reduce it to one menu.
|
// With correct event mapping we can probably reduce it to one menu.
|
||||||
this.$imeSetting = $( selectorTemplate );
|
this.$imeSetting = $( selectorTemplate );
|
||||||
this.$menu = $( '<div class="imeselector-menu" role="menu">' );
|
this.$menu = $( '<div class="imeselector-menu" role="menu">' );
|
||||||
this.$menu.append( imeListTitle() )
|
this.$menu.append(
|
||||||
.append( imeList() )
|
imeListTitle(),
|
||||||
.append( toggleMenuItem() )
|
imeList(),
|
||||||
.append( languageListTitle() );
|
toggleMenuItem(),
|
||||||
|
languageListTitle()
|
||||||
|
);
|
||||||
|
|
||||||
this.prepareLanguageList();
|
this.prepareLanguageList();
|
||||||
this.$menu.append( this.helpLink() );
|
this.$menu.append( this.helpLink() );
|
||||||
|
|
||||||
if ( $.i18n ) {
|
if ( $.i18n ) {
|
||||||
this.$menu.i18n();
|
this.$menu.i18n();
|
||||||
}
|
}
|
||||||
|
|
||||||
this.$imeSetting.append( this.$menu );
|
this.$imeSetting.append( this.$menu );
|
||||||
$( 'body' ).append( this.$imeSetting );
|
$( 'body' ).append( this.$imeSetting );
|
||||||
},
|
},
|
||||||
@@ -551,7 +555,8 @@
|
|||||||
imeselector.$imeSetting.css( 'opacity', 1 );
|
imeselector.$imeSetting.css( 'opacity', 1 );
|
||||||
imeselector.$imeSetting.css( 'margin-top', 0 );
|
imeselector.$imeSetting.css( 'margin-top', 0 );
|
||||||
} );
|
} );
|
||||||
}, 2500 );
|
}, 2500
|
||||||
|
);
|
||||||
},
|
},
|
||||||
|
|
||||||
focus: function () {
|
focus: function () {
|
||||||
@@ -597,6 +602,7 @@
|
|||||||
if ( t.hasClass( 'imeselector-toggle' ) ) {
|
if ( t.hasClass( 'imeselector-toggle' ) ) {
|
||||||
imeselector.toggle();
|
imeselector.toggle();
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
} );
|
} );
|
||||||
|
|
||||||
@@ -619,24 +625,33 @@
|
|||||||
|
|
||||||
imeselector.$menu.on( 'click.ime', 'li', function() {
|
imeselector.$menu.on( 'click.ime', 'li', function() {
|
||||||
imeselector.$element.focus();
|
imeselector.$element.focus();
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
} );
|
} );
|
||||||
|
|
||||||
imeselector.$menu.on( 'click.ime', 'li.ime-im', function () {
|
imeselector.$menu.on( 'click.ime', 'li.ime-im', function () {
|
||||||
imeselector.selectIM( $( this ).data( 'ime-inputmethod' ) );
|
imeselector.selectIM( $( this ).data( 'ime-inputmethod' ) );
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
} );
|
} );
|
||||||
|
|
||||||
imeselector.$menu.on( 'click.ime', 'li.ime-lang', function () {
|
imeselector.$menu.on( 'click.ime', 'li.ime-lang', function () {
|
||||||
imeselector.selectLanguage( $( this ).attr( 'lang' ) );
|
imeselector.selectLanguage( $( this ).attr( 'lang' ) );
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
} );
|
} );
|
||||||
|
|
||||||
imeselector.$menu.on( 'click.ime', 'div.ime-disable', function () {
|
imeselector.$menu.on( 'click.ime', 'div.ime-disable', function () {
|
||||||
imeselector.disableIM();
|
imeselector.disableIM();
|
||||||
|
|
||||||
return false;
|
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.$element.on( 'focus.ime', function ( e ) {
|
||||||
imeselector.selectLanguage( imeselector.decideLanguage() );
|
imeselector.selectLanguage( imeselector.decideLanguage() );
|
||||||
imeselector.focus();
|
imeselector.focus();
|
||||||
@@ -683,10 +698,12 @@
|
|||||||
} else {
|
} else {
|
||||||
languageCode = this.decideLanguage();
|
languageCode = this.decideLanguage();
|
||||||
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.
|
// Check if there is a previously used input method.
|
||||||
previousInputMethods = $.ime.preferences.getPreviousInputMethods();
|
previousInputMethods = $.ime.preferences.getPreviousInputMethods();
|
||||||
|
|
||||||
if ( previousInputMethods[0] ) {
|
if ( previousInputMethods[0] ) {
|
||||||
this.selectIM( previousInputMethods[0] );
|
this.selectIM( previousInputMethods[0] );
|
||||||
} else {
|
} else {
|
||||||
@@ -812,9 +829,8 @@
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Decide on initial language to select
|
* Decide on initial language to select
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
decideLanguage : function () {
|
decideLanguage: function () {
|
||||||
if ( $.ime.preferences.getLanguage() ) {
|
if ( $.ime.preferences.getLanguage() ) {
|
||||||
// There has been an override by the user,
|
// There has been an override by the user,
|
||||||
// so return the language selected by user
|
// so return the language selected by user
|
||||||
@@ -824,7 +840,7 @@
|
|||||||
if ( this.$element.attr('lang' ) &&
|
if ( this.$element.attr('lang' ) &&
|
||||||
$.ime.languages[ 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
|
// There is either no IMs for the given language attr
|
||||||
@@ -892,7 +908,7 @@
|
|||||||
* Prepare language list
|
* Prepare language list
|
||||||
*/
|
*/
|
||||||
prepareLanguageList: function () {
|
prepareLanguageList: function () {
|
||||||
var languageCodeIndex = 0,
|
var languageCodeIndex,
|
||||||
$languageListWrapper,
|
$languageListWrapper,
|
||||||
$languageList,
|
$languageList,
|
||||||
languageList,
|
languageList,
|
||||||
@@ -950,8 +966,12 @@
|
|||||||
$imeItem = $( '<a>' ).attr( 'href', '#' ).text( name ),
|
$imeItem = $( '<a>' ).attr( 'href', '#' ).text( name ),
|
||||||
$inputMethod = $( '<li data-ime-inputmethod=' + inputmethod + '>' );
|
$inputMethod = $( '<li data-ime-inputmethod=' + inputmethod + '>' );
|
||||||
|
|
||||||
$inputMethod.append( '<span class="ime-im-check">' ).append( $imeItem );
|
$inputMethod
|
||||||
$inputMethod.addClass( 'ime-im' );
|
.append(
|
||||||
|
'<span class="ime-im-check">',
|
||||||
|
$imeItem
|
||||||
|
)
|
||||||
|
.addClass( 'ime-im' );
|
||||||
$imeList.append( $inputMethod );
|
$imeList.append( $inputMethod );
|
||||||
} );
|
} );
|
||||||
},
|
},
|
||||||
@@ -993,33 +1013,33 @@
|
|||||||
|
|
||||||
$.fn.imeselector.Constructor = IMESelector;
|
$.fn.imeselector.Constructor = IMESelector;
|
||||||
|
|
||||||
function languageListTitle () {
|
function languageListTitle() {
|
||||||
return $( '<h3>' )
|
return $( '<h3>' )
|
||||||
.addClass( 'ime-lang-title' )
|
.addClass( 'ime-lang-title' )
|
||||||
.attr( 'data-i18n', 'jquery-ime-other-languages' )
|
.attr( 'data-i18n', 'jquery-ime-other-languages' )
|
||||||
.text( 'Other languages' );
|
.text( 'Other languages' );
|
||||||
}
|
}
|
||||||
|
|
||||||
function imeList () {
|
function imeList() {
|
||||||
return $( '<ul>' ).addClass( 'ime-list' );
|
return $( '<ul>' ).addClass( 'ime-list' );
|
||||||
}
|
}
|
||||||
|
|
||||||
function imeListTitle () {
|
function imeListTitle() {
|
||||||
return $( '<h3>' ).addClass( 'ime-list-title' );
|
return $( '<h3>' ).addClass( 'ime-list-title' );
|
||||||
}
|
}
|
||||||
|
|
||||||
function toggleMenuItem () {
|
function toggleMenuItem() {
|
||||||
return $( '<div class="ime-disable">' )
|
return $( '<div class="ime-disable">' ).append(
|
||||||
.append( $( '<span>' )
|
$( '<span>' )
|
||||||
.attr( {
|
.attr( {
|
||||||
'class': 'ime-disable-link',
|
'class': 'ime-disable-link',
|
||||||
'data-i18n': 'jquery-ime-disable-text'
|
'data-i18n': 'jquery-ime-disable-text'
|
||||||
} )
|
} )
|
||||||
.text( 'System input method' )
|
.text( 'System input method' ),
|
||||||
).append( $( '<span>' )
|
$( '<span>' )
|
||||||
.addClass( 'ime-disable-shortcut' )
|
.addClass( 'ime-disable-shortcut' )
|
||||||
.text( 'CTRL+M' )
|
.text( 'CTRL+M' )
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
selectorTemplate = '<div class="imeselector imeselector-toggle">' +
|
selectorTemplate = '<div class="imeselector imeselector-toggle">' +
|
||||||
@@ -1036,13 +1056,13 @@
|
|||||||
* @param event Event object
|
* @param event Event object
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
function isShortcutKey ( event ) {
|
function isShortcutKey( event ) {
|
||||||
// 77 - The letter M, for Ctrl-M
|
// 77 - The letter M, for Ctrl-M
|
||||||
// 13 - The Enter key
|
// 13 - The Enter key
|
||||||
return event.ctrlKey && !event.altKey && ( event.which === 77 || event.which === 13 );
|
return event.ctrlKey && !event.altKey && ( event.which === 77 || event.which === 13 );
|
||||||
}
|
}
|
||||||
|
|
||||||
function isDOMAttrModifiedSupported () {
|
function isDOMAttrModifiedSupported() {
|
||||||
var p = document.createElement( 'p' ),
|
var p = document.createElement( 'p' ),
|
||||||
flag = false;
|
flag = false;
|
||||||
|
|
||||||
@@ -1557,15 +1577,15 @@
|
|||||||
source: 'rules/no/no-tildeforms.js'
|
source: 'rules/no/no-tildeforms.js'
|
||||||
},
|
},
|
||||||
'or-transliteration': {
|
'or-transliteration': {
|
||||||
name: 'ଟରନସଲିତେରତିଓନ',
|
name: 'ଟ୍ରାନ୍ସଲି ଟରେସନ',
|
||||||
source: 'rules/or/or-transliteration.js'
|
source: 'rules/or/or-transliteration.js'
|
||||||
},
|
},
|
||||||
'or-inscript': {
|
'or-inscript': {
|
||||||
name: 'ଈନସକରିପତ',
|
name: 'ଇନସ୍କ୍ରିପ୍ଟ',
|
||||||
source: 'rules/or/or-inscript.js'
|
source: 'rules/or/or-inscript.js'
|
||||||
},
|
},
|
||||||
'or-inscript2': {
|
'or-inscript2': {
|
||||||
name: 'ଈନସକରିପତ2',
|
name: 'ଇନସ୍କ୍ରିପ୍ଟ2',
|
||||||
source: 'rules/or/or-inscript2.js'
|
source: 'rules/or/or-inscript2.js'
|
||||||
},
|
},
|
||||||
'or-lekhani': {
|
'or-lekhani': {
|
||||||
@@ -1573,7 +1593,7 @@
|
|||||||
source: 'rules/or/or-lekhani.js'
|
source: 'rules/or/or-lekhani.js'
|
||||||
},
|
},
|
||||||
'or-phonetic': {
|
'or-phonetic': {
|
||||||
name: 'ହୋନେତିକ',
|
name: 'ଫୋନେଟିକ',
|
||||||
source: 'rules/or/or-phonetic.js'
|
source: 'rules/or/or-phonetic.js'
|
||||||
},
|
},
|
||||||
'sd-inscript2': {
|
'sd-inscript2': {
|
||||||
@@ -1917,7 +1937,7 @@
|
|||||||
},
|
},
|
||||||
'or': {
|
'or': {
|
||||||
autonym: 'ଓଡ଼ିଆ',
|
autonym: 'ଓଡ଼ିଆ',
|
||||||
inputmethods: [ 'or-transliteration', 'or-lekhani', 'or-inscript', 'or-phonetic', 'or-inscript2' ]
|
inputmethods: [ 'or-phonetic', 'or-transliteration', 'or-inscript', 'or-inscript2', 'or-lekhani' ]
|
||||||
},
|
},
|
||||||
'pa': {
|
'pa': {
|
||||||
autonym: 'ਪੰਜਾਬੀ',
|
autonym: 'ਪੰਜਾਬੀ',
|
||||||
|
|||||||
Executable → Regular
File mode changed.
@@ -3,7 +3,7 @@
|
|||||||
|
|
||||||
var orInScript = {
|
var orInScript = {
|
||||||
id: 'or-inscript',
|
id: 'or-inscript',
|
||||||
name: 'Odia InScript',
|
name: 'ଇନସ୍କ୍ରିପ୍ଟ',
|
||||||
description: 'InScript keyboard for Odia script',
|
description: 'InScript keyboard for Odia script',
|
||||||
date: '2012-10-14',
|
date: '2012-10-14',
|
||||||
author: 'Junaid P V',
|
author: 'Junaid P V',
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
|
|
||||||
var orInScript2 = {
|
var orInScript2 = {
|
||||||
id: 'or-inscript2',
|
id: 'or-inscript2',
|
||||||
name: 'InScript2',
|
name: 'ଇନସ୍କ୍ରିପ୍ଟ2',
|
||||||
description: 'Enhanced InScript keyboard for Odia language',
|
description: 'Enhanced InScript keyboard for Odia language',
|
||||||
date: '2013-02-09',
|
date: '2013-02-09',
|
||||||
author: 'Parag Nemade',
|
author: 'Parag Nemade',
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
|
|
||||||
var orPhonetic = {
|
var orPhonetic = {
|
||||||
id: 'or-phonetic',
|
id: 'or-phonetic',
|
||||||
name: 'Odia Phonetic',
|
name: 'ଫୋନେଟିକ',
|
||||||
description: 'Phonetic keyboard for Odia script',
|
description: 'Phonetic keyboard for Odia script',
|
||||||
date: '2013-02-09',
|
date: '2013-02-09',
|
||||||
URL: 'http://github.com/wikimedia/jquery.ime',
|
URL: 'http://github.com/wikimedia/jquery.ime',
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
var orTransliteration = {
|
var orTransliteration = {
|
||||||
id: 'or-transliteration',
|
id: 'or-transliteration',
|
||||||
name: 'Odia Transliteration',
|
name: 'Odia Transliteration',
|
||||||
description: 'Odia transliteration',
|
description: 'ଟ୍ରାନ୍ସଲି ଟରେସନ',
|
||||||
date: '2012-10-14',
|
date: '2012-10-14',
|
||||||
URL: 'http://github.com/wikimedia/jquery.ime',
|
URL: 'http://github.com/wikimedia/jquery.ime',
|
||||||
author: 'Junaid P V and Subhashish Panigrahi',
|
author: 'Junaid P V and Subhashish Panigrahi',
|
||||||
|
|||||||
Reference in new issue
Block a user