aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
author0neGal <mail@0negal.com>2024-06-15 23:47:57 +0200
committer0neGal <mail@0negal.com>2024-06-15 23:47:57 +0200
commit0da4d19ec0d0bc0d63bb615bc1e642bb6aeecd31 (patch)
tree5df2564d41cdb26be8c15e3519065a29a7edb716 /src
parenta3665ec4b680c64acbd10761fb137cc9ac5d4fd2 (diff)
downloadViper-0da4d19ec0d0bc0d63bb615bc1e642bb6aeecd31.tar.gz
Viper-0da4d19ec0d0bc0d63bb615bc1e642bb6aeecd31.zip
prevent gamepad from toggling disabled switches
Diffstat (limited to 'src')
-rw-r--r--src/app/js/settings.js9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/app/js/settings.js b/src/app/js/settings.js
index 3addf0e..d57dfc7 100644
--- a/src/app/js/settings.js
+++ b/src/app/js/settings.js
@@ -251,6 +251,15 @@ settings.popup.load = () => {
}
settings.popup.switch = (el, state) => {
+ if (! el) {return}
+
+ // prevent switches from being switched when disabled
+ if (el.getAttribute("disabled") != null
+ || el.classList.contains("disabled")) {
+
+ return;
+ }
+
if (state) {
return el.classList.add("on");
} else if (state === false) {