From e666a607a66b560036c853b3a163aedc1b5ab638 Mon Sep 17 00:00:00 2001 From: 0neGal Date: Sun, 5 Mar 2023 22:54:35 +0100 Subject: fixed not being able to toggle mods with updates --- src/app/js/browser.js | 4 ++++ src/app/js/mods.js | 6 ++++++ 2 files changed, 10 insertions(+) (limited to 'src') diff --git a/src/app/js/browser.js b/src/app/js/browser.js index c35d31a..c6c74c9 100644 --- a/src/app/js/browser.js +++ b/src/app/js/browser.js @@ -124,13 +124,16 @@ var Browser = { let normalized = normalize(packages[i].name); let has_update = false; + let local_name = false; let local_version = false; let remote_version = packages[i].versions[0].version_number; remote_version = version.format(remote_version); for (let ii = 0; ii < modsobj.all.length; ii++) { let mod = modsobj.all[ii]; + if (normalize(mod.Name) === normalized) { + local_name = mod.Name; local_version = version.format(mod.Version); if (version.is_newer(remote_version, local_version)) { has_update = true; @@ -150,6 +153,7 @@ var Browser = { mod_versions[normalized] = { install: install, has_update: has_update, + local_name: local_name, local_version: local_version, package: packages[i] diff --git a/src/app/js/mods.js b/src/app/js/mods.js index 19c5bda..4ea3428 100644 --- a/src/app/js/mods.js +++ b/src/app/js/mods.js @@ -119,6 +119,12 @@ mods.load = (mods_obj) => { let mod_el = mod_els[i].cloneNode(true); mod_el.classList.add("no-animation"); + + mod_el.querySelector(".switch").addEventListener("click", () => { + if (mod_versions[mod].local_name) { + mods.toggle(mod_versions[mod].local_name); + } + }) mod_els[i].remove(); modsdiv.querySelector(".line").after(mod_el); -- cgit v1.2.3