diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/app/js/popups.js | 5 | ||||
-rw-r--r-- | src/app/js/settings.js | 27 |
2 files changed, 19 insertions, 13 deletions
diff --git a/src/app/js/popups.js b/src/app/js/popups.js index 553358a..7411180 100644 --- a/src/app/js/popups.js +++ b/src/app/js/popups.js @@ -24,6 +24,11 @@ popups.set = (popup, state, auto_close_all = true) => { overlay.classList.remove("shown"); popup_el.classList.remove("shown"); } + + events.emit("popup-changed", { + popup: popup_el, + new_state: state + }) } popups.show = (popup, auto_close_all = true) => { diff --git a/src/app/js/settings.js b/src/app/js/settings.js index a333e8b..78a951e 100644 --- a/src/app/js/settings.js +++ b/src/app/js/settings.js @@ -4,19 +4,6 @@ var Settings = { options.scrollTo(0, 0); popups.set("#options", state); - let settings_btn = document.getElementById("settings"); - - if (state) { - settings_btn.classList.add("shown"); - return; - } else if (state === false) { - if (state != undefined) { - settings_btn.classList.remove("shown"); - return; - } - } - - settings_btn.classList.toggle("shown"); }, apply: () => { settings = {...settings, ...Settings.get()}; @@ -120,6 +107,20 @@ var Settings = { } } +events.on("popup-changed", () => { + let settings_is_shown = + document.getElementById("options") + .classList.contains("shown"); + + let settings_btn = document.getElementById("settings"); + + if (settings_is_shown) { + settings_btn.classList.add("shown"); + } else { + settings_btn.classList.remove("shown"); + } +}) + document.body.addEventListener("click", (e) => { let el = document.elementFromPoint(e.clientX, e.clientY); Settings.switch(el); |