Restore enableWebfonts pref and remove uls-enable

This patch restores the enableWebfonts preference, stored inside
the uls-preferences blob. It existed as 'enable-webfonts' in
the past and was removed in
If735a733717596fae03042c5e277bd538bd8501f

Each wiki can be configured to load the fonts by default
using the new global variable $wgULSWebfontsEnabled.
Its default value is true (to load fonts).

This also removes the preference 'uls-enable', recently added in
I71b70d8ee7c3cad7f49b32e5dc494ef4fc1bdb2f

The initialization of ext.uls.webfonts.js is changed as well,
so that minimal webfonts JS library code is loaded,
and the rest is loaded only if a user requests it.

Bug: 60304
Change-Id: I49e812eae32266f165591c75fd67b86ca06b13f0
This commit is contained in:
Santhosh Thottingal
2014-02-10 17:40:24 +05:30
parent 7b376a80c8
commit 27771fdeaf
20 changed files with 409 additions and 106 deletions

View File

@@ -35,7 +35,7 @@ class UniversalLanguageSelectorHooks {
return false;
}
return $user->getBoolOption( 'uls-enable' );
return true;
}
/**
@@ -47,11 +47,6 @@ class UniversalLanguageSelectorHooks {
public static function addModules( $out, $skin ) {
global $wgULSPosition, $wgULSGeoService, $wgULSEventLogging;
$user = $out->getUser();
if ( !$user->getBoolOption( 'uls-enable') ) {
return true;
}
// Load the style for users without JS, to hide the useless links
$out->addModuleStyles( 'ext.uls.nojs' );
@@ -71,7 +66,7 @@ class UniversalLanguageSelectorHooks {
$out->addModules( 'ext.uls.geoclient' );
}
if ( self::isToolbarEnabled( $user ) ) {
if ( self::isToolbarEnabled( $out->getUser() ) ) {
// Enable UI language selection for the user.
$out->addModules( 'ext.uls.interface' );
}
@@ -267,7 +262,9 @@ class UniversalLanguageSelectorHooks {
* @return bool
*/
public static function addConfig( &$vars ) {
global $wgULSGeoService, $wgULSIMEEnabled, $wgULSPosition, $wgULSNoWebfontsSelectors,
global $wgULSGeoService,
$wgULSIMEEnabled, $wgULSWebfontsEnabled,
$wgULSPosition, $wgULSNoWebfontsSelectors,
$wgULSAnonCanChangeLanguage, $wgULSEventLogging, $wgULSImeSelectors,
$wgULSNoImeSelectors, $wgULSFontRepositoryBasePath, $wgExtensionAssetsPath;
@@ -275,7 +272,9 @@ class UniversalLanguageSelectorHooks {
if ( is_string( $wgULSGeoService ) ) {
$vars['wgULSGeoService'] = $wgULSGeoService;
}
$vars['wgULSIMEEnabled'] = $wgULSIMEEnabled;
$vars['wgULSWebfontsEnabled'] = $wgULSWebfontsEnabled;
$vars['wgULSPosition'] = $wgULSPosition;
$vars['wgULSAnonCanChangeLanguage'] = $wgULSAnonCanChangeLanguage;
$vars['wgULSEventLogging'] = $wgULSEventLogging;
@@ -311,12 +310,6 @@ class UniversalLanguageSelectorHooks {
}
public static function onGetPreferences( $user, &$preferences ) {
$preferences['uls-enable'] = array(
'type' => 'toggle',
'label-message' => 'uls-preference',
'section' => 'personal/i18n',
);
$preferences['uls-preferences'] = array(
'type' => 'api',
);