Fix the webfonts preferences

Disabling was not working actually. If disabled donot call
webfonts() on body. Also addresses Bug 39992.

Change-Id: I8e4d466dd9271604be6ae722c49357b192651950
This commit is contained in:
Santhosh Thottingal
2012-11-28 10:47:13 +05:30
committed by Amir E. Aharoni
parent ab086a847a
commit 086ee5ff1d
2 changed files with 77 additions and 56 deletions

View File

@@ -293,7 +293,11 @@
// Get the language code from the right property -
// uiLanguage or contentLanguage
language = this[ target + 'Language' ];
fonts = this.$webfonts.list( language );
if ( this.isWebFontsEnabled() ) {
fonts = this.$webfonts.list( language );
} else {
fonts = [];
}
// Possible classes:
// uls-ui-fonts
// uls-content-fonts
@@ -414,11 +418,19 @@
if ( this.checked ) {
mw.webfonts.preferences.enable();
$contentFontSelector.prop( 'disabled', false );
mw.webfonts.setup();
that.$webfonts = $( 'body' ).data( 'webfonts' );
$contentFontSelector.removeAttr( 'disabled' );
$uiFontSelector.prop( 'disabled', false );
displaySettings.prepareContentFonts();
displaySettings.prepareUIFonts();
displaySettings.i18n();
displaySettings.$webfonts.apply( $uiFontSelector.find( 'option:selected' ) );
displaySettings.$webfonts.refresh();
} else {
mw.webfonts.preferences.disable();
mw.webfonts.preferences.setFont( that.uiLanguage, 'system' );
that.$webfonts.refresh();
$contentFontSelector.prop( 'disabled', true );
$uiFontSelector.prop( 'disabled', true );
displaySettings.$webfonts.reset();