diff options
author | GitExample <git@example.com> | 2022-02-05 17:14:46 +0100 |
---|---|---|
committer | GitExample <git@example.com> | 2022-02-05 17:14:46 +0100 |
commit | 651c0b32d37dd03c581dc5c9cac8ec293816a636 (patch) | |
tree | 0905a44b87cc523c54cc5a1ca8b674bbdb2f2c24 /src/app/browser.js | |
parent | 633433e14f0e6d489090aac81cbb27d05284055c (diff) | |
download | Viper-651c0b32d37dd03c581dc5c9cac8ec293816a636.tar.gz Viper-651c0b32d37dd03c581dc5c9cac8ec293816a636.zip |
button now updates when mod is removed
I also fixed the archive not being extracted properly for some reason,
the setTimeout() seems to solve it, no clue if it needs to be adjusted
in the future or replaced with something that works 100% of the time,
I'm not even quite sure why it happens in the first place.
Diffstat (limited to 'src/app/browser.js')
-rw-r--r-- | src/app/browser.js | 23 |
1 files changed, 18 insertions, 5 deletions
diff --git a/src/app/browser.js b/src/app/browser.js index a9a36f9..ff9ec87 100644 --- a/src/app/browser.js +++ b/src/app/browser.js @@ -55,6 +55,17 @@ var Browser = { for (let i = 0; i < res.length; i++) { new BrowserElFromObj(res[i].item); } + }, + setbutton: (mod, string) => { + mod = normalize(mod); + console.log(mod) + if (document.getElementById(mod)) { + let elems = document.querySelectorAll(`#${mod}`); + + for (let i = 0; i < elems.length; i++) { + elems[i].querySelector(".text button").innerHTML = string; + } + } } }; Browser.toggle() Browser.loadfront() @@ -123,13 +134,15 @@ function BrowserEl(properties) { ` } -ipcRenderer.on("installedmod", (event, modname) => { +ipcRenderer.on("removedmod", (event, modname) => { setButtons(true); - modname = normalize(modname); + console.log("test" + modname) + Browser.setbutton(modname, lang("gui.browser.install")); +}) - if (document.getElementById(modname)) { - document.getElementById(modname).querySelector(".text button").innerHTML = lang("gui.browser.reinstall"); - } +ipcRenderer.on("installedmod", (event, modname) => { + setButtons(true); + Browser.setbutton(modname, lang("gui.browser.reinstall")); }) function normalize(items) { |