jenkins-bot has submitted this change and it was merged.

Change subject: Update jquery.ime from upstream
......................................................................


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
---
M lib/jquery.ime/jquery.ime.js
M lib/jquery.ime/rules/fa/fa-kbd.js
2 files changed, 44 insertions(+), 26 deletions(-)

Approvals:
  Amire80: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/lib/jquery.ime/jquery.ime.js b/lib/jquery.ime/jquery.ime.js
index 8614532..c7c3153 100644
--- a/lib/jquery.ime/jquery.ime.js
+++ b/lib/jquery.ime/jquery.ime.js
@@ -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.
        };
 
        /*
diff --git a/lib/jquery.ime/rules/fa/fa-kbd.js 
b/lib/jquery.ime/rules/fa/fa-kbd.js
index 45be470..164a0c2 100644
--- a/lib/jquery.ime/rules/fa/fa-kbd.js
+++ b/lib/jquery.ime/rules/fa/fa-kbd.js
@@ -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', ''],

-- 
To view, visit https://gerrit.wikimedia.org/r/84189
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: Id87dee11456de0499450083f434b64e188b6d33f
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/UniversalLanguageSelector
Gerrit-Branch: master
Gerrit-Owner: KartikMistry <[email protected]>
Gerrit-Reviewer: Amire80 <[email protected]>
Gerrit-Reviewer: Santhosh <[email protected]>
Gerrit-Reviewer: Siebrand <[email protected]>
Gerrit-Reviewer: jenkins-bot

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to