Use single entry point mw.uls.init for all ULS ui initialization
Change-Id: I485ea27deebb530eb89e4b0935eda01a5276f884
This commit is contained in:
committed by
Amire80
parent
ea50b8216c
commit
8ddff0b2fc
@@ -203,17 +203,14 @@
|
||||
};
|
||||
|
||||
$( document ).ready( function () {
|
||||
if ( !mw.uls.isBrowserSupported() ) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Load the ime preferences
|
||||
$.ime.preferences.load();
|
||||
|
||||
if ( $.ime.preferences.isEnabled() ) {
|
||||
mw.ime.setup();
|
||||
}
|
||||
mw.uls.init( function () {
|
||||
// Load the ime preferences
|
||||
$.ime.preferences.load();
|
||||
|
||||
if ( $.ime.preferences.isEnabled() ) {
|
||||
mw.ime.setup();
|
||||
}
|
||||
} );
|
||||
} );
|
||||
|
||||
function imeNotification () {
|
||||
|
||||
@@ -31,7 +31,8 @@
|
||||
this.$languageFilter.addClass( 'noime' );
|
||||
};
|
||||
|
||||
var currentLang = mw.config.get( 'wgUserLanguage' );
|
||||
var initialized = false,
|
||||
currentLang = mw.config.get( 'wgUserLanguage' );
|
||||
mw.uls = mw.uls || {};
|
||||
mw.uls.previousLanguagesCookie = 'uls-previous-languages';
|
||||
/**
|
||||
@@ -139,10 +140,10 @@
|
||||
* Browse support policy: http://www.mediawiki.org/wiki/Browser_support#Grade_A
|
||||
* @return boolean
|
||||
*/
|
||||
mw.uls.isBrowserSupported = function () {
|
||||
function isBrowserSupported() {
|
||||
// Blacklist Grade B browsers IE 6, 7 and IE60-IE79
|
||||
return !/MSIE [67]/i.test( navigator.userAgent );
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Local wrapper for 'mw.eventLog.logEvent' which handles default params
|
||||
@@ -187,8 +188,14 @@
|
||||
.load( jsonLoader + currentLang, currentLang );
|
||||
}
|
||||
|
||||
$( document ).ready( function () {
|
||||
if ( !mw.uls.isBrowserSupported() ) {
|
||||
mw.uls.init = function( callback ) {
|
||||
callback = callback || $.noop;
|
||||
|
||||
if ( initialized ) {
|
||||
callback.call( this, false );
|
||||
return;
|
||||
}
|
||||
if ( !isBrowserSupported() ) {
|
||||
$( '#pt-uls' ).hide();
|
||||
return;
|
||||
}
|
||||
@@ -205,5 +212,11 @@
|
||||
|
||||
// JavaScript side i18n initialization
|
||||
i18nInit();
|
||||
initialized = true;
|
||||
callback.call( this, true );
|
||||
};
|
||||
|
||||
$( document ).ready( function () {
|
||||
mw.uls.init();
|
||||
} );
|
||||
}( jQuery, mediaWiki ) );
|
||||
|
||||
@@ -223,6 +223,7 @@
|
||||
}
|
||||
|
||||
$( document ).ready( function () {
|
||||
mw.uls.init( function () {
|
||||
var $ulsTrigger = $( '.uls-trigger' ),
|
||||
$ulsSettingsTrigger,
|
||||
$pLang,
|
||||
@@ -232,10 +233,6 @@
|
||||
!mw.config.get( 'wgULSAnonCanChangeLanguage' ) ),
|
||||
ulsPosition = mw.config.get( 'wgULSPosition' );
|
||||
|
||||
if ( !mw.uls.isBrowserSupported() ) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ( ulsPosition === 'interlanguage' ) {
|
||||
// The interlanguage links section
|
||||
$pLang = $( '#p-lang' );
|
||||
@@ -330,4 +327,5 @@
|
||||
|
||||
showULSTooltip();
|
||||
} );
|
||||
} );
|
||||
}( jQuery, mediaWiki ) );
|
||||
|
||||
@@ -81,17 +81,16 @@
|
||||
};
|
||||
|
||||
$( document ).ready( function () {
|
||||
if ( !mw.uls.isBrowserSupported() ) {
|
||||
return;
|
||||
}
|
||||
// MediaWiki specific overrides for jquery.webfonts
|
||||
$.extend( $.fn.webfonts.defaults, {
|
||||
repository: mediawikiFontRepository,
|
||||
fontStack: new Array( $( 'body' ).css( 'font-family' ) )
|
||||
mw.uls.init( function () {
|
||||
|
||||
// MediaWiki specific overrides for jquery.webfonts
|
||||
$.extend( $.fn.webfonts.defaults, {
|
||||
repository: mediawikiFontRepository,
|
||||
fontStack: new Array( $( 'body' ).css( 'font-family' ) )
|
||||
} );
|
||||
|
||||
mw.webfonts.preferences.load();
|
||||
mw.webfonts.setup();
|
||||
} );
|
||||
|
||||
mw.webfonts.preferences.load();
|
||||
mw.webfonts.setup();
|
||||
} );
|
||||
|
||||
}( jQuery, mediaWiki ) );
|
||||
|
||||
Reference in New Issue
Block a user