Lazy initialization of language settings for IME menu

Initialize it only when first time user clicks on it

In a page like Special:Translate where lot of input fields
appearing, the previous approach was adding many language settings
div to the page.

Bug: 48211

Change-Id: If063df6782c6a51ac77ed5531dfa253c7f3ddbc4
This commit is contained in:
Santhosh Thottingal
2013-07-24 15:24:52 +05:30
committed by Santhosh
parent 36862734f2
commit eff459eea6

View File

@@ -121,18 +121,20 @@
$moreSettingsLink = $( '<span>' )
.addClass( 'uls-ime-more-settings-link' );
$moreSettingsLink.languagesettings( {
// Hide the menu.
$moreSettingsLink.on( 'click', function ( e ) {
var languageSettings = $( this ).data( 'languagesettings' );
imeselector.hide();
if ( !languageSettings ) {
$( this ).languagesettings( {
defaultModule: 'input',
onClose: function () {
// on close of input settings, keep focus in input area.
imeselector.$element.focus();
},
top: imeselector.$element.offset().top
} );
// Hide the menu.
$moreSettingsLink.on( 'click', function ( e ) {
imeselector.hide();
} ).click();
}
e.stopPropagation();
} );