aboutsummaryrefslogtreecommitdiff
path: root/src/app/js/settings.js
diff options
context:
space:
mode:
author0neGal <mail@0negal.com>2024-01-20 02:20:05 +0100
committer0neGal <mail@0negal.com>2024-01-20 02:20:05 +0100
commiteec515f2b09accf225bbaf6a0625bb0d5924314c (patch)
tree80d58e93e799541de35244f4f1b58d1a6e414a55 /src/app/js/settings.js
parentbc34025c7341bdbc9a31e8a16040e7ec6b89fe9b (diff)
downloadViper-eec515f2b09accf225bbaf6a0625bb0d5924314c.tar.gz
Viper-eec515f2b09accf225bbaf6a0625bb0d5924314c.zip
fixed settings cog sometimes not moving
If the settings popup was opened or closed through other means than clicking the settings button itself, "Save" button or "Discord" button, then the cog wouldn't update/rotate accordingly.
Diffstat (limited to 'src/app/js/settings.js')
-rw-r--r--src/app/js/settings.js27
1 files changed, 14 insertions, 13 deletions
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);