summaryrefslogtreecommitdiff
path: root/web/share/js/tools.js
diff options
context:
space:
mode:
Diffstat (limited to 'web/share/js/tools.js')
-rw-r--r--web/share/js/tools.js5
1 files changed, 5 insertions, 0 deletions
diff --git a/web/share/js/tools.js b/web/share/js/tools.js
index dc443517..4bc5c90b 100644
--- a/web/share/js/tools.js
+++ b/web/share/js/tools.js
@@ -280,6 +280,11 @@ export var tools = new function() {
"getBool": (key, default_value) => !!parseInt(self.storage.get(key, (default_value ? "1" : "0"))),
"setBool": (key, value) => self.storage.set(key, (value ? "1" : "0")),
+
+ "bindSimpleSwitch": function(el, key, default_value) {
+ el.checked = self.storage.getBool(key, default_value);
+ self.el.setOnClick(el, () => self.storage.setBool(key, el.checked), false);
+ },
};
};