From 65908e0c7d55a87d2a1a0cf521413faf19df7db8 Mon Sep 17 00:00:00 2001 From: Jon Robson Date: Thu, 30 Nov 2023 14:44:11 -0800 Subject: [PATCH] Put font size control before limited width control Bug: T351867 Change-Id: Ieab31c875ab87d3ffc103805e3012089ab118a28 --- .../clientPreferences.js | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/resources/skins.vector.clientPreferences/clientPreferences.js b/resources/skins.vector.clientPreferences/clientPreferences.js index 49ac4d047..231d60638 100644 --- a/resources/skins.vector.clientPreferences/clientPreferences.js +++ b/resources/skins.vector.clientPreferences/clientPreferences.js @@ -13,6 +13,8 @@ let /** @type {MwApi} */ api; */ /** + * Get the list of client preferences that are active on the page, including hidden. + * * @return {string[]} of active client preferences */ function getClientPreferences() { @@ -21,6 +23,17 @@ function getClientPreferences() { ).map( ( className ) => className.split( '-clientpref-' )[ 0 ] ); } +/** + * Get the list of client preferences that are active on the page and not hidden. + * + * @return {string[]} of user facing client preferences + */ +function getVisibleClientPreferences() { + const active = getClientPreferences(); + // Order should be based on key in config.json + return Object.keys( config ).filter( ( key ) => active.indexOf( key ) > -1 ); +} + /** * @param {string} featureName * @param {string} value @@ -175,7 +188,7 @@ function render( selector ) { if ( mw.user.isAnon() ) { throw new Error( 'T335317: Unexpected state expected. This will cause a performance problem.' ); } - getClientPreferences().forEach( ( pref ) => { + getVisibleClientPreferences().forEach( ( pref ) => { mw.loader.using( 'codex-styles' ).then( () => { mw.requestIdleCallback( () => { makeClientPreference( node, pref );