summaryrefslogtreecommitdiff
path: root/web/share/js/tools.js
diff options
context:
space:
mode:
authorDevaev Maxim <[email protected]>2020-07-19 14:25:54 +0300
committerDevaev Maxim <[email protected]>2020-07-19 14:25:54 +0300
commitab13399a2afa07346f635f9c70fca93ec9201e5e (patch)
tree4aac943d5409459ab4123f3b701b8b7528a27142 /web/share/js/tools.js
parentfaedb829b95df47147442b784e4583ddfc4db252 (diff)
drive mode radio switch
Diffstat (limited to 'web/share/js/tools.js')
-rw-r--r--web/share/js/tools.js16
1 files changed, 16 insertions, 0 deletions
diff --git a/web/share/js/tools.js b/web/share/js/tools.js
index 5bd41548..92a701d2 100644
--- a/web/share/js/tools.js
+++ b/web/share/js/tools.js
@@ -135,6 +135,22 @@ export var tools = new function() {
};
};
+ this.setOnClickRadio = function(name, callback) {
+ for (let el of $$$(`input[type="radio"][name="${name}"]`)) {
+ this.setOnClick(el, callback)
+ }
+ };
+
+ this.getRadioValue = function(name, value) {
+ return document.querySelector(`input[type="radio"][name="${name}"]:checked`).value;
+ };
+
+ this.setRadioValue = function(name, value) {
+ for (let el of $$$(`input[type="radio"][name="${name}"]`)) {
+ el.checked = (el.value === value);
+ }
+ };
+
this.setProgressPercent = function(el, title, percent) {
el.setAttribute("data-label", title);
$(`${el.id}-value`).style.width = `${percent}%`;