Update jquery.ime from upstream
Version: v0.1.0+20130914 Changes: 1. Improved Persian keyboard. 2. Show the menu correctly if it goes off-screen. 3. Removed unneeded code. 4. Ability to customise time out for IME selector widget. Bug: 52154 Change-Id: Id87dee11456de0499450083f434b64e188b6d33f
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
/*! jquery.ime - v0.1.0+20130904
|
||||
/*! jquery.ime - v0.1.0+20130914
|
||||
* https://github.com/wikimedia/jquery.ime
|
||||
* Copyright (c) 2013 Santhosh Thottingal; Licensed GPL, MIT */
|
||||
( function ( $ ) {
|
||||
@@ -797,7 +797,7 @@
|
||||
imeselector.$imeSetting.css( 'opacity', 1 );
|
||||
imeselector.$imeSetting.css( 'margin-top', 0 );
|
||||
} );
|
||||
}, 2500
|
||||
}, this.options.timeout
|
||||
);
|
||||
},
|
||||
|
||||
@@ -985,19 +985,21 @@
|
||||
* Position the im selector relative to the edit area
|
||||
*/
|
||||
position: function () {
|
||||
var imeSelector = this,
|
||||
dir = this.$element.css( 'direction' ),
|
||||
menutop, position, top, left, room;
|
||||
var menuWidth, menuTop, menuLeft, elementPosition,
|
||||
top, left, verticalRoom, overflowsOnRight,
|
||||
imeSelector = this,
|
||||
rtlElement = this.$element.css( 'direction' ) === 'rtl',
|
||||
$window = $( window );
|
||||
|
||||
this.focus(); // shows the trigger in case it is hidden
|
||||
|
||||
position = this.$element.offset();
|
||||
top = position.top + this.$element.outerHeight();
|
||||
left = position.left;
|
||||
elementPosition = this.$element.offset();
|
||||
top = elementPosition.top + this.$element.outerHeight();
|
||||
left = elementPosition.left;
|
||||
|
||||
// RTL element position fix
|
||||
if ( this.$element.css( 'direction' ) === 'ltr' ) {
|
||||
left = position.left + this.$element.outerWidth() -
|
||||
if ( !rtlElement ) {
|
||||
left = elementPosition.left + this.$element.outerWidth() -
|
||||
this.$imeSetting.outerWidth();
|
||||
}
|
||||
|
||||
@@ -1005,18 +1007,18 @@
|
||||
// take into account the value of scrollTop, to avoid the selector from always
|
||||
// getting placed above the input box since window.height would be less than top
|
||||
// if the page has been scrolled.
|
||||
room = $( window ).height() + $( document ).scrollTop() - top;
|
||||
verticalRoom = $window.height() + $( document ).scrollTop() - top;
|
||||
|
||||
if ( room < this.$imeSetting.outerHeight() ) {
|
||||
top = position.top - this.$imeSetting.outerHeight();
|
||||
menutop = this.$menu.outerHeight() +
|
||||
if ( verticalRoom < this.$imeSetting.outerHeight() ) {
|
||||
top = elementPosition.top - this.$imeSetting.outerHeight();
|
||||
menuTop = this.$menu.outerHeight() +
|
||||
this.$imeSetting.outerHeight();
|
||||
|
||||
// Flip the menu to the top only if it can fit in the space there
|
||||
if ( menutop < top ) {
|
||||
if ( menuTop < top ) {
|
||||
this.$menu
|
||||
.addClass( 'ime-position-top' )
|
||||
.css( 'top', -menutop );
|
||||
.css( 'top', -menuTop );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1033,11 +1035,27 @@
|
||||
left: left
|
||||
} );
|
||||
|
||||
if ( this.$menu.width() > left ) {
|
||||
// not enough space in the left
|
||||
this.$menu
|
||||
.addClass( 'ime-right' )
|
||||
.css( 'left', dir === 'rtl' ? 0 : position.left );
|
||||
menuWidth = this.$menu.width();
|
||||
overflowsOnRight = ( left + menuWidth ) > $window.width();
|
||||
|
||||
// Adjust horizontal position if there's
|
||||
// not enough space on any side
|
||||
if ( menuWidth > left ||
|
||||
rtlElement && overflowsOnRight
|
||||
) {
|
||||
if ( rtlElement ) {
|
||||
if ( overflowsOnRight ) {
|
||||
this.$menu.addClass( 'ime-right' );
|
||||
menuLeft = this.$imeSetting.outerWidth() - menuWidth;
|
||||
} else {
|
||||
menuLeft = 0;
|
||||
}
|
||||
} else {
|
||||
this.$menu.addClass( 'ime-right' );
|
||||
menuLeft = elementPosition.left;
|
||||
}
|
||||
|
||||
this.$menu.css( 'left', menuLeft );
|
||||
}
|
||||
},
|
||||
|
||||
@@ -1135,7 +1153,6 @@
|
||||
}
|
||||
|
||||
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( 'ime-checked' );
|
||||
ime = this.$element.data( 'ime' );
|
||||
@@ -1278,7 +1295,8 @@
|
||||
};
|
||||
|
||||
IMESelector.defaults = {
|
||||
defaultLanguage: 'en'
|
||||
defaultLanguage: 'en',
|
||||
timeout: 2500 // Milliseconds after which IME widget hides itself.
|
||||
};
|
||||
|
||||
/*
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
name: 'kbd',
|
||||
description: 'Persian standard (ISIRI 9147) keyboard layout',
|
||||
date: '2013-08-30',
|
||||
URL: 'http://behnam.esfahbod.info/standards/isiri-keyboard-9147.pdf',
|
||||
URL: 'http://www.isiri.org/portal/files/std/9147.pdf',
|
||||
author: 'Ebrahim Byagowi',
|
||||
license: 'GPLv3',
|
||||
version: '1.0',
|
||||
@@ -131,8 +131,8 @@
|
||||
['i', '\u202d'],
|
||||
['o', '\u202e'],
|
||||
['p', '\u202c'],
|
||||
['\\[', '\u200a'],
|
||||
['\\]', '\u200b'],
|
||||
['\\[', '\u202a'],
|
||||
['\\]', '\u202b'],
|
||||
|
||||
['a', ''],
|
||||
['s', ''],
|
||||
|
||||
Reference in New Issue
Block a user