From 90890de53fe56884fdbe470784128283e7398020 Mon Sep 17 00:00:00 2001 From: alistair3149 Date: Mon, 27 Mar 2023 14:08:38 -0400 Subject: [PATCH] =?UTF-8?q?feat(core):=20=E2=9C=A8=20add=20config=20flag?= =?UTF-8?q?=20to=20disable=20preferences=20menu?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 1 + includes/Hooks/ResourceLoaderHooks.php | 1 + resources/skins.citizen.scripts/skin.js | 7 ++++++- skin.json | 6 ++++++ 4 files changed, 14 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index fcd84e48..a4779447 100644 --- a/README.md +++ b/README.md @@ -110,6 +110,7 @@ Name | Description | Values | Default `$wgCitizenUseNumberFormatter` | Use NumberFormatter for site statistics, which allows formatting number in a localized way | `true` - enable; `false` - disable | `true` `$wgCitizenThemeColor` | The color defined in the `theme-color` meta tag | Hex color code | `#131a21` `$wgCitizenEnableCJKFonts` | Enable included Noto Sans CJK for wikis that serves CJK languages | `true` - enable; `false` - disable | `false` +`$wgCitizenEnablePreferences` | Enable the preferences menu | `true` - enable; `false` - disable | `true` ### Search suggestions Name | Description | Values | Default diff --git a/includes/Hooks/ResourceLoaderHooks.php b/includes/Hooks/ResourceLoaderHooks.php index 0c79abf8..446623f7 100644 --- a/includes/Hooks/ResourceLoaderHooks.php +++ b/includes/Hooks/ResourceLoaderHooks.php @@ -45,6 +45,7 @@ class ResourceLoaderHooks { Config $config ) { return [ + 'wgCitizenEnablePreferences' => $config->get( 'CitizenEnablePreferences' ), 'wgCitizenSearchModule' => $config->get( 'CitizenSearchModule' ), ]; } diff --git a/resources/skins.citizen.scripts/skin.js b/resources/skins.citizen.scripts/skin.js index 01e90d42..d957e666 100644 --- a/resources/skins.citizen.scripts/skin.js +++ b/resources/skins.citizen.scripts/skin.js @@ -78,6 +78,7 @@ function registerServiceWorker() { */ function main( window ) { const + config = require( './config.json' ), search = require( './search.js' ), checkbox = require( './checkbox.js' ); @@ -101,7 +102,11 @@ function main( window ) { sections.init(); } - mw.loader.load( 'skins.citizen.preferences' ); + // Preference module + if ( config.wgCitizenEnablePreferences === true ) { + mw.loader.load( 'skins.citizen.preferences' ); + } + registerServiceWorker(); window.addEventListener( 'beforeunload', () => { diff --git a/skin.json b/skin.json index 303ddf0b..99c5597e 100644 --- a/skin.json +++ b/skin.json @@ -595,6 +595,12 @@ "description": "Enable included Noto Sans CJK for wikis that serves CJK languages", "descriptionmsg": "citizen-config-enablecjkfonts", "public": true + }, + "EnablePreferences": { + "value": true, + "description": "Enables or disable preferences module", + "descriptionmsg": "citizen-config-enablepreferences", + "public": true } }, "manifest_version": 2