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
|
* https://github.com/wikimedia/jquery.ime
|
||||||
* Copyright (c) 2013 Santhosh Thottingal; Licensed GPL, MIT */
|
* Copyright (c) 2013 Santhosh Thottingal; Licensed GPL, MIT */
|
||||||
( function ( $ ) {
|
( function ( $ ) {
|
||||||
@@ -797,7 +797,7 @@
|
|||||||
imeselector.$imeSetting.css( 'opacity', 1 );
|
imeselector.$imeSetting.css( 'opacity', 1 );
|
||||||
imeselector.$imeSetting.css( 'margin-top', 0 );
|
imeselector.$imeSetting.css( 'margin-top', 0 );
|
||||||
} );
|
} );
|
||||||
}, 2500
|
}, this.options.timeout
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
|
|
||||||
@@ -985,19 +985,21 @@
|
|||||||
* Position the im selector relative to the edit area
|
* Position the im selector relative to the edit area
|
||||||
*/
|
*/
|
||||||
position: function () {
|
position: function () {
|
||||||
var imeSelector = this,
|
var menuWidth, menuTop, menuLeft, elementPosition,
|
||||||
dir = this.$element.css( 'direction' ),
|
top, left, verticalRoom, overflowsOnRight,
|
||||||
menutop, position, top, left, room;
|
imeSelector = this,
|
||||||
|
rtlElement = this.$element.css( 'direction' ) === 'rtl',
|
||||||
|
$window = $( window );
|
||||||
|
|
||||||
this.focus(); // shows the trigger in case it is hidden
|
this.focus(); // shows the trigger in case it is hidden
|
||||||
|
|
||||||
position = this.$element.offset();
|
elementPosition = this.$element.offset();
|
||||||
top = position.top + this.$element.outerHeight();
|
top = elementPosition.top + this.$element.outerHeight();
|
||||||
left = position.left;
|
left = elementPosition.left;
|
||||||
|
|
||||||
// RTL element position fix
|
// RTL element position fix
|
||||||
if ( this.$element.css( 'direction' ) === 'ltr' ) {
|
if ( !rtlElement ) {
|
||||||
left = position.left + this.$element.outerWidth() -
|
left = elementPosition.left + this.$element.outerWidth() -
|
||||||
this.$imeSetting.outerWidth();
|
this.$imeSetting.outerWidth();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1005,18 +1007,18 @@
|
|||||||
// take into account the value of scrollTop, to avoid the selector from always
|
// 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
|
// getting placed above the input box since window.height would be less than top
|
||||||
// if the page has been scrolled.
|
// if the page has been scrolled.
|
||||||
room = $( window ).height() + $( document ).scrollTop() - top;
|
verticalRoom = $window.height() + $( document ).scrollTop() - top;
|
||||||
|
|
||||||
if ( room < this.$imeSetting.outerHeight() ) {
|
if ( verticalRoom < this.$imeSetting.outerHeight() ) {
|
||||||
top = position.top - this.$imeSetting.outerHeight();
|
top = elementPosition.top - this.$imeSetting.outerHeight();
|
||||||
menutop = this.$menu.outerHeight() +
|
menuTop = this.$menu.outerHeight() +
|
||||||
this.$imeSetting.outerHeight();
|
this.$imeSetting.outerHeight();
|
||||||
|
|
||||||
// Flip the menu to the top only if it can fit in the space there
|
// Flip the menu to the top only if it can fit in the space there
|
||||||
if ( menutop < top ) {
|
if ( menuTop < top ) {
|
||||||
this.$menu
|
this.$menu
|
||||||
.addClass( 'ime-position-top' )
|
.addClass( 'ime-position-top' )
|
||||||
.css( 'top', -menutop );
|
.css( 'top', -menuTop );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1033,11 +1035,27 @@
|
|||||||
left: left
|
left: left
|
||||||
} );
|
} );
|
||||||
|
|
||||||
if ( this.$menu.width() > left ) {
|
menuWidth = this.$menu.width();
|
||||||
// not enough space in the left
|
overflowsOnRight = ( left + menuWidth ) > $window.width();
|
||||||
this.$menu
|
|
||||||
.addClass( 'ime-right' )
|
// Adjust horizontal position if there's
|
||||||
.css( 'left', dir === 'rtl' ? 0 : position.left );
|
// 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( '.ime-checked' ).removeClass( 'ime-checked' );
|
||||||
this.$menu.find( 'li.ime-disable' ).removeClass( 'ime-checked' );
|
|
||||||
this.$menu.find( 'li[data-ime-inputmethod=' + inputmethodId + ']' )
|
this.$menu.find( 'li[data-ime-inputmethod=' + inputmethodId + ']' )
|
||||||
.addClass( 'ime-checked' );
|
.addClass( 'ime-checked' );
|
||||||
ime = this.$element.data( 'ime' );
|
ime = this.$element.data( 'ime' );
|
||||||
@@ -1278,7 +1295,8 @@
|
|||||||
};
|
};
|
||||||
|
|
||||||
IMESelector.defaults = {
|
IMESelector.defaults = {
|
||||||
defaultLanguage: 'en'
|
defaultLanguage: 'en',
|
||||||
|
timeout: 2500 // Milliseconds after which IME widget hides itself.
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
name: 'kbd',
|
name: 'kbd',
|
||||||
description: 'Persian standard (ISIRI 9147) keyboard layout',
|
description: 'Persian standard (ISIRI 9147) keyboard layout',
|
||||||
date: '2013-08-30',
|
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',
|
author: 'Ebrahim Byagowi',
|
||||||
license: 'GPLv3',
|
license: 'GPLv3',
|
||||||
version: '1.0',
|
version: '1.0',
|
||||||
@@ -131,8 +131,8 @@
|
|||||||
['i', '\u202d'],
|
['i', '\u202d'],
|
||||||
['o', '\u202e'],
|
['o', '\u202e'],
|
||||||
['p', '\u202c'],
|
['p', '\u202c'],
|
||||||
['\\[', '\u200a'],
|
['\\[', '\u202a'],
|
||||||
['\\]', '\u200b'],
|
['\\]', '\u202b'],
|
||||||
|
|
||||||
['a', ''],
|
['a', ''],
|
||||||
['s', ''],
|
['s', ''],
|
||||||
|
|||||||
Reference in New Issue
Block a user