diff options
author | 0neGal <mail@0negal.com> | 2024-12-20 13:18:25 +0100 |
---|---|---|
committer | 0neGal <mail@0negal.com> | 2024-12-20 13:19:30 +0100 |
commit | f3ab861bd2d45223b5d64979eb28269da834ebe1 (patch) | |
tree | 1106e0d9d64983bfdf2bcc1a55ddc609d2ef2fce /src/app/js | |
parent | 28130f46eb9c167671994b47b77b926386002ac2 (diff) | |
download | Viper-f3ab861bd2d45223b5d64979eb28269da834ebe1.tar.gz Viper-f3ab861bd2d45223b5d64979eb28269da834ebe1.zip |
don't prompt when enabling a core mod
Previously disabling or enabling a core mod would show a prompt warning
about the fact that a core mod is being toggled. This is only needed for
when disabling a core mod.
fixes #253
Diffstat (limited to 'src/app/js')
-rw-r--r-- | src/app/js/mods.js | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/src/app/js/mods.js b/src/app/js/mods.js index 2408548..755aad1 100644 --- a/src/app/js/mods.js +++ b/src/app/js/mods.js @@ -218,8 +218,22 @@ mods.remove = (mod) => { } mods.toggle = (mod) => { + // is this a core mod? if (mod.toLowerCase().match(/^northstar\./)) { - if (! confirm(lang("gui.mods.required_confirm"))) { + // keep track of whether this mod is disabled + let is_disabled = false; + + // run through disabled mods + for (let mod_obj of mods_list.disabled) { + // if `mod` is `mod_obj`, update `is_disabled` + if (mod_obj.name.toLowerCase() == mod.toLowerCase()) { + is_disabled = true; + break; + } + } + + // show prompt if the mod is enabled + if (! is_disabled && ! confirm(lang("gui.mods.required_confirm"))) { return; } } else if (mod == "allmods") { |