Santhosh has uploaded a new change for review. https://gerrit.wikimedia.org/r/72093
Change subject: Update jquery.ime from upstream ...................................................................... Update jquery.ime from upstream Bug: 50790 Change-Id: I3755581136cca9958e31b20694c4285c14646c38 --- M lib/jquery.ime/jquery.ime.js 1 file changed, 26 insertions(+), 4 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/UniversalLanguageSelector refs/changes/93/72093/1 diff --git a/lib/jquery.ime/jquery.ime.js b/lib/jquery.ime/jquery.ime.js index f050bdf..802191b 100644 --- a/lib/jquery.ime/jquery.ime.js +++ b/lib/jquery.ime/jquery.ime.js @@ -1,4 +1,4 @@ -/*! jquery.ime - v0.1.0+20130626 +/*! jquery.ime - v0.1.0+20130705 * https://github.com/wikimedia/jquery.ime * Copyright (c) 2013 Santhosh Thottingal; Licensed GPL, MIT */ ( function ( $ ) { @@ -668,6 +668,7 @@ keydown: function ( e ) { var ime = $( e.target ).data( 'ime' ), firstInputmethod, + previousInputMethods, languageCode; this.focus(); // shows the trigger in case it is hidden @@ -683,9 +684,15 @@ this.selectLanguage( languageCode ); if ( !ime.isActive() && $.ime.languages[languageCode] ) { // Even after pressing toggle shortcut again, it is still disabled - // Provide the default input method in this case. - firstInputmethod = $.ime.languages[languageCode].inputmethods[0]; - this.selectIM( firstInputmethod ); + // Check if there is a previously used input method. + previousInputMethods = $.ime.preferences.getPreviousInputMethods(); + if ( previousInputMethods[0] ) { + this.selectIM( previousInputMethods[0] ); + } else { + // Provide the default input method in this case. + firstInputmethod = $.ime.languages[languageCode].inputmethods[0]; + this.selectIM( firstInputmethod ); + } } } } @@ -1091,6 +1098,7 @@ isDirty: false, language : null, previousLanguages: [], // array of previous languages + previousInputMethods: [], // array of previous inputmethods imes: { 'en': 'system' } @@ -1111,6 +1119,7 @@ // Add to the previous languages, but avoid duplicates. if ( $.inArray( language, this.registry.previousLanguages ) === -1 ) { this.registry.previousLanguages.push( language ); + this.registry.previousLanguages = this.registry.previousLanguages.slice( 0, 5 ); } }, @@ -1126,6 +1135,10 @@ return this.registry.previousLanguages; }, + getPreviousInputMethods: function () { + return this.registry.previousInputMethods; + }, + // Set the given IM as the last used for the language setIM: function ( inputMethod ) { if ( !this.registry.imes ) { @@ -1139,6 +1152,15 @@ this.registry.imes[this.getLanguage()] = inputMethod; this.registry.isDirty = true; + if ( !this.registry.previousInputMethods ) { + this.registry.previousInputMethods = []; + } + + // Add to the previous languages, but avoid duplicates. + if ( $.inArray( inputMethod, this.registry.previousInputMethods ) === -1 ) { + this.registry.previousInputMethods.push( inputMethod ); + this.registry.previousInputMethods = this.registry.previousInputMethods.slice( 0, 5 ); + } }, // Return the last used or the default IM for language -- To view, visit https://gerrit.wikimedia.org/r/72093 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I3755581136cca9958e31b20694c4285c14646c38 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/UniversalLanguageSelector Gerrit-Branch: master Gerrit-Owner: Santhosh <santhosh.thottin...@gmail.com> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits