From 84cc46018664cee9d89d71ea75ba687a9171ab28 Mon Sep 17 00:00:00 2001 From: 0neGal Date: Mon, 30 Jan 2023 23:22:41 +0100 Subject: added: toggles for toggling mods in modlist The new modlist now uses the same toggles found in the settings popup, only here they're used to disable/enable mods. On top of this I also fixed the "Toggle All" button not working. Forgot to change some stuff, breaking it... oops... --- src/app/js/browser.js | 2 +- src/app/js/mods.js | 18 +++++++++++++++++- 2 files changed, 18 insertions(+), 2 deletions(-) (limited to 'src/app/js') diff --git a/src/app/js/browser.js b/src/app/js/browser.js index fcb79a2..05bf01d 100644 --- a/src/app/js/browser.js +++ b/src/app/js/browser.js @@ -362,7 +362,7 @@ function BrowserEl(properties) {
${properties.title}
${properties.description}
- + diff --git a/src/app/js/mods.js b/src/app/js/mods.js index 39e904e..6c2fc22 100644 --- a/src/app/js/mods.js +++ b/src/app/js/mods.js @@ -11,7 +11,14 @@ mods.load = (mods_obj) => { normalized_names.push(normalized_name); - if (document.getElementById(normalized_name)) { + let el = document.getElementById(normalized_name); + if (el) { + if (mod.Disabled) { + el.querySelector(".switch").classList.remove("on"); + } else { + el.querySelector(".switch").classList.add("on"); + } + return; } @@ -27,12 +34,21 @@ mods.load = (mods_obj) => {
${mod.Name}
${mod.Description}
+
`; + if (mod.Disabled) { + div.querySelector(".switch").classList.remove("on"); + } + + div.querySelector(".switch").addEventListener("click", () => { + mods.toggle(mod.Name); + }) + if (! image_url) { div.querySelector(".image").remove(); } -- cgit v1.2.3