diff --git a/resources/js/ext.uls.displaysettings.js b/resources/js/ext.uls.displaysettings.js
index 08709ed8..a7acb794 100644
--- a/resources/js/ext.uls.displaysettings.js
+++ b/resources/js/ext.uls.displaysettings.js
@@ -56,17 +56,7 @@
+ ''
+ ''
- // Webfonts enabling chechbox with label
- + '
'
+ + ''
// Menus font selection dropdown with label
+ '
'
@@ -84,6 +74,20 @@
+ ''
+ '
'
+ + '
' // End font selectors
+
+ // Webfonts enabling chechbox with label
+ + ''
+
+ '' // End font settings section
// Separator
@@ -128,7 +132,15 @@
},
prepareWebfontsCheckbox: function () {
- $( '#webfonts-enable-checkbox' ).prop( 'checked', this.isWebFontsEnabled() );
+ var webFontsEnabled = this.isWebFontsEnabled();
+
+ if ( !webFontsEnabled ) {
+ this.$template.find(
+ '#uls-display-settings-font-selectors'
+ ).addClass( 'hide' );
+ }
+
+ $( '#webfonts-enable-checkbox' ).prop( 'checked', webFontsEnabled );
},
isWebFontsEnabled: function () {
@@ -432,9 +444,14 @@
} );
displaySettings.$template.find( '#webfonts-enable-checkbox' ).on( 'click', function () {
+ var $fontSelectors = displaySettings.$template.find(
+ '#uls-display-settings-font-selectors'
+ );
+
displaySettings.enableApplyButton();
if ( this.checked ) {
+ $fontSelectors.removeClass( 'hide' );
mw.webfonts.preferences.enable();
mw.webfonts.setup();
displaySettings.$webfonts = $( 'body' ).data( 'webfonts' );
@@ -446,6 +463,7 @@
displaySettings.$webfonts.apply( $uiFontSelector.find( 'option:selected' ) );
displaySettings.$webfonts.refresh();
} else {
+ $fontSelectors.addClass( 'hide' );
mw.webfonts.preferences.disable();
mw.webfonts.preferences.setFont( displaySettings.uiLanguage, 'system' );
displaySettings.$webfonts.refresh();