Avoid loading of jquery.i18n and messages until trigger clicked

Use RL for trigger tooltip messages to avoid using jquery.i18n just
to display the triggers. Reordered dependencies so that messages
are loaded for the setting panels and ime menu.

Change-Id: Ic9518f7b63699542deb02a413e03c28344c99fa4
This commit is contained in:
Niklas Laxström
2014-01-23 23:01:09 +00:00
committed by Nikerabbit
parent 9df061c692
commit 15b3c31029
5 changed files with 22 additions and 41 deletions

View File

@@ -40,11 +40,6 @@
}() );
}
var jsonLoader = null,
initialized = false,
currentLang = mw.config.get( 'wgUserLanguage' );
mw.uls = mw.uls || {};
mw.uls.previousLanguagesCookie = 'uls-previous-languages';
mw.uls.previousLanguageAutonymCookie = 'uls-previous-language-autonym';
@@ -230,33 +225,19 @@
}
/**
* Initialize ULS front-end and its i18n.
* Initialize ULS front-end if browser is supported.
*
* @param {Function} callback callback function to be called after initialization.
*/
mw.uls.init = function ( callback ) {
callback = callback || $.noop;
if ( initialized ) {
callback.call( this );
return;
}
if ( !isBrowserSupported() ) {
$( '#pt-uls' ).hide();
return;
}
if ( !jsonLoader ) {
jsonLoader = mw.uls.loadLocalization( currentLang );
} else {
jsonLoader.done( function () {
initialized = true;
} );
jsonLoader.done( callback );
if ( callback ) {
callback.call( this );
}
};