diff options
Diffstat (limited to 'web/share/js/tools.js')
-rw-r--r-- | web/share/js/tools.js | 16 |
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}%`; |