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:
committed by
Santhosh
parent
36862734f2
commit
eff459eea6
@@ -121,18 +121,20 @@
|
|||||||
$moreSettingsLink = $( '<span>' )
|
$moreSettingsLink = $( '<span>' )
|
||||||
.addClass( 'uls-ime-more-settings-link' );
|
.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',
|
defaultModule: 'input',
|
||||||
onClose: function () {
|
onClose: function () {
|
||||||
// on close of input settings, keep focus in input area.
|
// on close of input settings, keep focus in input area.
|
||||||
imeselector.$element.focus();
|
imeselector.$element.focus();
|
||||||
},
|
},
|
||||||
top: imeselector.$element.offset().top
|
top: imeselector.$element.offset().top
|
||||||
} );
|
} ).click();
|
||||||
|
}
|
||||||
// Hide the menu.
|
|
||||||
$moreSettingsLink.on( 'click', function ( e ) {
|
|
||||||
imeselector.hide();
|
|
||||||
e.stopPropagation();
|
e.stopPropagation();
|
||||||
} );
|
} );
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user