diff options
author | 0neGal <mail@0negal.com> | 2024-08-02 15:04:35 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-08-02 15:04:35 +0200 |
commit | 5d6ab8e481fe6df98f0bb345589d0b1ccb291f88 (patch) | |
tree | fd5389b3ffdbfcb185cee29685edabb100a90ca5 /src/app/js | |
parent | fe04a8e36790e8278f875f22d39ce06c2329bc63 (diff) | |
parent | 9c7c8adcf1f9b8ce48d8aeeb34929c9e3ba7e3fc (diff) | |
download | Viper-5d6ab8e481fe6df98f0bb345589d0b1ccb291f88.tar.gz Viper-5d6ab8e481fe6df98f0bb345589d0b1ccb291f88.zip |
Merge pull request #241 from Jan200101/PR/vp-disable
feat: Handle VanillaPlus differently in the mod browser
Diffstat (limited to 'src/app/js')
-rw-r--r-- | src/app/js/browser.js | 29 |
1 files changed, 20 insertions, 9 deletions
diff --git a/src/app/js/browser.js b/src/app/js/browser.js index 7dc84d9..3415ebf 100644 --- a/src/app/js/browser.js +++ b/src/app/js/browser.js @@ -1,5 +1,5 @@ const Fuse = require("fuse.js"); -const ipcRenderer = require("electron").ipcRenderer; +const { ipcRenderer, shell } = require("electron"); const lang = require("../../lang"); @@ -414,13 +414,22 @@ browser.mod_el = (properties) => { let installicon = "downloads"; let installstr = lang("gui.browser.install"); - let normalized_mods = []; + let installcallback = () => {}; + let normalized_title = mods.normalize(properties.title) - for (let i = 0; i < mods.list().all; i++) { - normalized_mods.push(mods.normalize(mods_list[i].name)); + let nondefault_install = { + "vanillaplus": "https://github.com/Zayveeo5e/NP.VanillaPlus/blob/main/README.md" } - if (properties.pkg.local_version) { + if (normalized_title in nondefault_install) { + installicon = "open"; + installstr = lang("gui.browser.guide"); + + installcallback = () => { + shell.openExternal(nondefault_install[normalized_title]) + } + } + else if (properties.pkg.local_version) { installicon = "redo"; installstr = lang("gui.browser.reinstall"); @@ -428,11 +437,15 @@ browser.mod_el = (properties) => { installicon = "downloads"; installstr = lang("gui.browser.update"); } + + installcallback = () => { + browser.install(properties); + } } let entry = document.createElement("div"); entry.classList.add("el"); - entry.id = `mod-${mods.normalize(properties.title)}`; + entry.id = `mod-${normalized_title}`; entry.innerHTML = ` <div class="image"> @@ -459,9 +472,7 @@ browser.mod_el = (properties) => { </div> ` - entry.querySelector("button.install").addEventListener("click", () => { - browser.install(properties); - }) + entry.querySelector("button.install").addEventListener("click", installcallback) browserEntries.appendChild(entry); } |