diff options
-rw-r--r-- | src/app/js/settings.js | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/src/app/js/settings.js b/src/app/js/settings.js index 645a9ed..20cd4b6 100644 --- a/src/app/js/settings.js +++ b/src/app/js/settings.js @@ -99,14 +99,23 @@ var Settings = { ipcRenderer.on("cant-autoupdate", () => { document.querySelector(".option[name=autoupdate]").style.display = "none"; }) + }, + switch: (el, state) => { + if (state) { + return el.classList.add("on"); + } else if (state === false) { + return el.classList.remove("on"); + } + + if (el.classList.contains("switch") && el.tagName == "BUTTON") { + el.classList.toggle("on"); + } } } document.body.addEventListener("click", (e) => { let el = document.elementFromPoint(e.clientX, e.clientY); - if (el.classList.contains("switch") && el.tagName == "BUTTON") { - el.classList.toggle("on"); - } + Settings.switch(el); }) Settings.load(); |