Skip to content

Commit

Permalink
feat(core): ✨ add config flag to disable preferences menu
Browse files Browse the repository at this point in the history
  • Loading branch information
alistair3149 committed Mar 27, 2023
1 parent b47f265 commit 90890de
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 1 deletion.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions includes/Hooks/ResourceLoaderHooks.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ public static function getCitizenResourceLoaderConfig(
Config $config
) {
return [
'wgCitizenEnablePreferences' => $config->get( 'CitizenEnablePreferences' ),
'wgCitizenSearchModule' => $config->get( 'CitizenSearchModule' ),
];
}
Expand Down
7 changes: 6 additions & 1 deletion resources/skins.citizen.scripts/skin.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ function registerServiceWorker() {
*/
function main( window ) {
const
config = require( './config.json' ),
search = require( './search.js' ),
checkbox = require( './checkbox.js' );

Expand All @@ -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', () => {
Expand Down
6 changes: 6 additions & 0 deletions skin.json
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 90890de

Please sign in to comment.