diff options
author | Devaev Maxim <[email protected]> | 2021-07-01 09:22:18 +0300 |
---|---|---|
committer | Devaev Maxim <[email protected]> | 2021-07-01 09:22:18 +0300 |
commit | 4fe20641da44e25eb394d7ce26776b7ee6ce7c10 (patch) | |
tree | 0133c3caddd3b1c1b48af11b7e7c235e21bfeb5f /web/share/js/tools.js | |
parent | 2995ca4909b171052aebf1497580cc797cb95f19 (diff) |
save video mode
Diffstat (limited to 'web/share/js/tools.js')
-rw-r--r-- | web/share/js/tools.js | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/web/share/js/tools.js b/web/share/js/tools.js index 02c6e637..6fcacf45 100644 --- a/web/share/js/tools.js +++ b/web/share/js/tools.js @@ -160,6 +160,15 @@ export var tools = new function() { el.checked = (el.value === value); } }; + this.radioClickValue = function(name, value) { + for (let el of $$$(`input[type="radio"][name="${name}"]`)) { + if (el.value === value) { + el.click(); + return; + } + } + }; + this.progressSetValue = function(el, title, percent) { el.setAttribute("data-label", title); @@ -242,6 +251,16 @@ export var tools = new function() { this.info("Browser:", this.browser); this.https = (location.protocol === "https:"); + + this.storage = new function() { + return { + "get": function(key, default_value) { + let value = window.localStorage.getItem(key); + return (value !== null ? value : default_value); + }, + "set": (key, value) => window.localStorage.setItem(key, value), + }; + }; }; export var $ = (id) => document.getElementById(id); |