diff options
author | 0neGal <mail@0negal.com> | 2022-02-07 23:02:49 +0100 |
---|---|---|
committer | 0neGal <mail@0negal.com> | 2022-02-07 23:02:49 +0100 |
commit | dbe50019e760d78e2f0749fd32ed1abbac739936 (patch) | |
tree | 3e0f6a706cab55e637b5eec962c698d78c525100 /src/app/browser.js | |
parent | a6aa28fa405b0ce1692e2b9ff7a42910ee948e77 (diff) | |
download | Viper-dbe50019e760d78e2f0749fd32ed1abbac739936.tar.gz Viper-dbe50019e760d78e2f0749fd32ed1abbac739936.zip |
all mods should now have proper install status
We now directly check the manifest file info as well therefore in all
cases even if the folder name for the mod is completely obscure, we
should now finally still get an installed status, both on removal and
install.
Diffstat (limited to 'src/app/browser.js')
-rw-r--r-- | src/app/browser.js | 35 |
1 files changed, 25 insertions, 10 deletions
diff --git a/src/app/browser.js b/src/app/browser.js index 69db6de..5062d86 100644 --- a/src/app/browser.js +++ b/src/app/browser.js @@ -66,7 +66,6 @@ var Browser = { }, setbutton: (mod, string) => { mod = normalize(mod); - console.log(mod) if (document.getElementById(mod)) { let elems = document.querySelectorAll(`#${mod}`); @@ -74,19 +73,27 @@ var Browser = { elems[i].querySelector(".text button").innerHTML = string; } } else { + let make = (str) => { + if (document.getElementById(str)) { + return Browser.setbutton(str, string); + } else { + return false; + } + } + setTimeout(() => { for (let i = 0; i < modsobj.all.length; i++) { let modname = normalize(modsobj.all[i].Name); let modfolder = normalize(modsobj.all[i].FolderName); + if (mod.includes(modname)) { - if (document.getElementById(modname)) { - Browser.setbutton(modname, string); - } - } else if (mod.includes(modfolder)) { - if (document.getElementById(modfolder)) { - Browser.setbutton(modfolder, string); + if (! make(modname)) { + if (modsobj.all[i].ManifestName) { + make(normalize(modsobj.all[i].ManifestName)); + } } } + else if (mod.includes(modfolder)) {make(modfolder);break} } }, 1501) } @@ -145,7 +152,12 @@ function BrowserEl(properties) { for (let i = 0; i < modsobj.all.length; i++) { let title = normalize(properties.title); let folder = normalize(modsobj.all[i].FolderName); - if (title.includes(folder)) { + let manifestname = null; + if (modsobj.all[i].ManifestName) { + manifestname = normalize(modsobj.all[i].ManifestName); + } + + if (title.includes(folder) || title.includes(manifestname)) { installstr = lang("gui.browser.reinstall"); if (folder == title @@ -174,9 +186,12 @@ function BrowserEl(properties) { ` } -ipcRenderer.on("removedmod", (event, modname) => { +ipcRenderer.on("removedmod", (event, mod) => { setButtons(true); - Browser.setbutton(modname, lang("gui.browser.install")); + Browser.setbutton(mod.name, lang("gui.browser.install")); + if (mod.manifestname) { + Browser.setbutton(mod.manifestname, lang("gui.browser.install")); + } }) ipcRenderer.on("installedmod", (event, modname) => { |