Update jquery.ime library

Changes:
1. build: Update eslint
2. telugu jna gunintham fixes

Updating to 6d591016d2

Change-Id: I092ae22f51bb18ef5dd23f8b1552ca7ced17face
This commit is contained in:
Santhosh Thottingal
2020-01-06 11:49:49 +05:30
committed by jenkins-bot
parent f39d684103
commit 6f1ccbd3b7
4 changed files with 43 additions and 41 deletions

View File

@@ -1,6 +1,6 @@
/*! jquery.ime - v0.2.0+20190521
/*! jquery.ime - v0.2.0+20200106
* https://github.com/wikimedia/jquery.ime
* Copyright (c) 2019 Santhosh Thottingal; License: (GPL-2.0+ OR MIT) */
* Copyright (c) 2020 Santhosh Thottingal; License: (GPL-2.0+ OR MIT) */
( function ( $ ) {
'use strict';
@@ -10,12 +10,6 @@
// rangy is defined in the rangy library
/* global rangy */
function arrayKeys( obj ) {
return $.map( obj, function ( element, index ) {
return index;
} );
}
/**
* private function for debugging
* @param {jQuery} [$obj]
@@ -67,7 +61,7 @@
this.$element = $( element );
this.textEntry = textEntry;
// This needs to be delayed here since extending language list happens at DOM ready
$.ime.defaults.languages = arrayKeys( $.ime.languages );
$.ime.defaults.languages = Object.keys( $.ime.languages );
this.options = $.extend( {}, $.ime.defaults, options );
if ( this.options.imePath ) {
// Set the global IME path from the one specified to the instance
@@ -186,7 +180,7 @@
.concat( patterns );
}
if ( $.isFunction( patterns ) ) {
if ( typeof patterns === 'function' ) {
// For backwards compatibility, allow the rule functions to return plain
// string. Determine noop by checking whether input is different from
// output. If the rule function returns object, just return it as-is.
@@ -523,6 +517,7 @@
return $element.is( 'input:not([type]), input[type=text], input[type=search], textarea' ) &&
!$element.prop( 'readonly' ) &&
!$element.prop( 'disabled' ) &&
// eslint-disable-next-line no-jquery/no-class-state
!$element.hasClass( 'noime' );
};
@@ -674,6 +669,7 @@
* @inheritdoc TextEntry
*/
ContentEditableEntry.static.canWrap = function ( $element ) {
// eslint-disable-next-line no-jquery/no-class-state
return $element.is( '[contenteditable]' ) && !$element.hasClass( 'noime' );
};
@@ -918,13 +914,11 @@
}
function toggleMenuItem() {
return $( '<div class="ime-disable selectable-row">' ).append(
return $( '<div>' ).addClass( 'ime-disable selectable-row' ).append(
$( '<span>' )
.attr( {
'class': 'ime-disable-link',
'data-i18n': 'jquery-ime-disable-text'
} )
.addClass( 'ime-disable-link' )
.addClass( 'ime-checked' )
.attr( 'data-i18n', 'jquery-ime-disable-text' )
.text( 'System input method' ),
$( '<span>' )
.addClass( 'ime-disable-shortcut' )
@@ -956,7 +950,7 @@
// 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 = $( '<div>' ).addClass( 'imeselector-menu' ).attr( 'role', 'menu' );
this.$menu.append(
imeListTitle(),
imeList(),
@@ -991,6 +985,8 @@
this.timer = setTimeout(
function () {
// TODO: Use CSS transitions
// eslint-disable-next-line no-jquery/no-animate
imeselector.$imeSetting.animate( {
opacity: 0,
marginTop: '-20px'
@@ -1006,7 +1002,9 @@
focus: function () {
// Hide all other IME settings and collapse open menus
// eslint-disable-next-line no-jquery/no-global-selector
$( 'div.imeselector' ).hide();
// eslint-disable-next-line no-jquery/no-global-selector
$( 'div.imeselector-menu' ).removeClass( 'ime-open' );
this.afterKeydown();
},
@@ -1032,6 +1030,7 @@
},
toggle: function () {
// eslint-disable-next-line no-jquery/no-class-state
if ( this.$menu.hasClass( 'ime-open' ) ) {
this.hide();
} else {
@@ -1046,9 +1045,10 @@
var imeselector = this;
imeselector.$imeSetting.on( 'click.ime', function ( e ) {
var t = $( e.target );
var $t = $( e.target );
if ( t.hasClass( 'imeselector-toggle' ) ) {
// eslint-disable-next-line no-jquery/no-class-state
if ( $t.hasClass( 'imeselector-toggle' ) ) {
imeselector.toggle();
}
@@ -1056,6 +1056,7 @@
} );
imeselector.$element.on( 'blur.ime', function () {
// eslint-disable-next-line no-jquery/no-class-state
if ( !imeselector.$imeSetting.hasClass( 'ime-onfocus' ) ) {
imeselector.$imeSetting.hide();
imeselector.hide();
@@ -1063,7 +1064,7 @@
} );
// Hide the menu when clicked outside
$( 'html' ).click( function () {
$( document.body ).on( 'click', function () {
imeselector.hide();
} );
@@ -1072,18 +1073,18 @@
event.stopPropagation();
} );
imeselector.$imeSetting.mouseenter( function () {
imeselector.$imeSetting.on( 'mouseenter', function () {
// We don't want the selector to disappear
// while the user is trying to click it
imeselector.stopTimer();
imeselector.$imeSetting.addClass( 'ime-onfocus' );
} ).mouseleave( function () {
} ).on( 'mouseleave', function () {
imeselector.resetTimer();
imeselector.$imeSetting.removeClass( 'ime-onfocus' );
} );
imeselector.$menu.on( 'click.ime', 'li', function () {
imeselector.$element.focus();
imeselector.$element.trigger( 'focus' );
return false;
} );
@@ -1121,6 +1122,7 @@
} );
imeselector.$element.attrchange( function () {
// eslint-disable-next-line no-jquery/no-sizzle
if ( imeselector.$element.is( ':hidden' ) ) {
imeselector.$imeSetting.hide();
}
@@ -1134,7 +1136,7 @@
// Update IM selector position when the window is resized
// or the browser window is zoomed in or zoomed out
$( window ).resize( function () {
$( window ).on( 'resize', function () {
imeselector.position();
} );
},
@@ -1429,10 +1431,10 @@
// Language list can be very long, so we use a container with
// overflow auto
$languageListWrapper = $( '<div class="ime-language-list-wrapper">' );
$languageList = $( '<ul class="ime-language-list">' );
$languageListWrapper = $( '<div>' ).addClass( 'ime-language-list-wrapper' );
$languageList = $( '<ul>' ).addClass( 'ime-language-list' );
if ( $.isFunction( this.options.languages ) ) {
if ( typeof this.options.languages === 'function' ) {
languageList = this.options.languages();
} else {
languageList = this.options.languages;
@@ -1450,7 +1452,7 @@
.attr( 'href', '#' )
.text( this.getAutonym( languageCode ) )
.addClass( 'selectable-row-item autonym' );
$language = $( '<li class="ime-lang selectable-row">' ).attr( 'lang', languageCode );
$language = $( '<li>' ).addClass( 'ime-lang selectable-row' ).attr( 'lang', languageCode );
$language.append( $languageItem );
$languageList.append( $language );
}
@@ -1475,7 +1477,7 @@
$imeList.empty();
$.each( language.inputmethods, function ( index, inputmethod ) {
language.inputmethods.forEach( function ( inputmethod ) {
var $imeItem, $inputMethod, source, name;
source = $.ime.sources[ inputmethod ];
@@ -1492,7 +1494,10 @@
$inputMethod = $( '<li>' )
.attr( 'data-ime-inputmethod', inputmethod )
.addClass( 'ime-im selectable-row' )
.append( '<span class="ime-im-check"></span>', $imeItem );
.append(
$( '<span>' ).addClass( 'ime-im-check' ),
$imeItem
);
if ( imeSelector.options.helpHandler ) {
$inputMethod.append( imeSelector.options.helpHandler.call( imeSelector, inputmethod ) );
@@ -1508,7 +1513,7 @@
* @return {jQuery}
*/
helpLink: function () {
return $( '<div class="ime-help-link selectable-row">' )
return $( '<div>' ).addClass( 'ime-help-link selectable-row' )
.append( $( '<a>' ).text( 'Help' )
.addClass( 'selectable-row-item' )
.attr( {
@@ -1630,7 +1635,7 @@
}
// Add to the previous languages, but avoid duplicates.
if ( $.inArray( language, this.registry.previousLanguages ) === -1 ) {
if ( this.registry.previousLanguages.indexOf( language ) === -1 ) {
this.registry.previousLanguages.unshift( language );
this.registry.previousLanguages = this.registry.previousLanguages.slice( 0, 5 );
}
@@ -2259,10 +2264,6 @@
name: 'ट्रांस्लितेरेशन',
source: 'rules/ne/ne-transliteration.js'
},
'nn-tildeforms': {
name: 'Tildemerkt transliterasjon',
source: 'rules/nb/nb-tildeforms.js'
},
'nqo-standard-qwerty': {
name: "N'Ko standard QWERTY",
source: 'rules/nqo/nqo-standard-qwerty.js'
@@ -2885,7 +2886,7 @@
},
nn: {
autonym: 'Norsk (nynorsk)',
inputmethods: [ 'nb-normforms', 'nn-tildeforms' ]
inputmethods: [ 'nb-normforms', 'nb-tildeforms' ]
},
nqo: {
autonym: 'ߒߞߏ',

View File

@@ -22,6 +22,7 @@
u: 'ŭ'
};
// eslint-disable-next-line no-jquery/no-each-util
$.each( chars, function ( ascii, accented ) {
rules.push( [ ascii + '[Xx]', ascii, accented ] );
rules.push( [ accented + '([Xx])', '[Xx]', ascii + '$1' ] );

View File

@@ -2,8 +2,8 @@
'use strict';
var ksKbd = {
id: 'ks-Kbd',
name: 'Kbd',
id: 'ks-kbd',
name: 'Kashmiri kbd',
description: 'Kbd keyboard for Kashmiri language using Arabic script',
date: '2013-02-09',
author: 'Parag Nemade',

View File

@@ -7,7 +7,7 @@
description: 'Telugu Transliteration based on RTS',
date: '2012-10-16',
URL: 'http://github.com/wikimedia/jquery.ime',
author: 'Veeven and Junaid P V',
author: 'Veeven, Junaid P V, Rahimanuddin Shaik',
license: 'GPLv3',
version: '1.0',
contextLength: 1,
@@ -160,9 +160,9 @@
[ '~l', 'ఌ' ],
[ 'l', 'ల్' ],
[ '@m', 'ఁ' ],
[ '~m', 'ఙ' ],
[ '~m', 'ఙ' ],
[ 'm', 'మ్' ],
[ '~n', 'ఞ' ],
[ '~n', 'ఞ' ],
[ 'n', 'న్' ],
[ 'o', 'ఒ' ],
[ 'p', 'ప్' ],