feat(core): add config flag to disable preferences menu

This commit is contained in:
alistair3149 2023-03-27 14:08:38 -04:00
parent b47f2658c7
commit 90890de53f
No known key found for this signature in database
4 changed files with 14 additions and 1 deletions

View file

@ -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

View file

@ -45,6 +45,7 @@ class ResourceLoaderHooks {
Config $config
) {
return [
'wgCitizenEnablePreferences' => $config->get( 'CitizenEnablePreferences' ),
'wgCitizenSearchModule' => $config->get( 'CitizenSearchModule' ),
];
}

View file

@ -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', () => {

View file

@ -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