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.js15
1 files changed, 15 insertions, 0 deletions
diff --git a/web/share/js/tools.js b/web/share/js/tools.js
index e0b350d5..26685cb4 100644
--- a/web/share/js/tools.js
+++ b/web/share/js/tools.js
@@ -162,6 +162,21 @@ export var tools = new function() {
el.step = step;
el.value = value;
},
+ "setValue": function(el, value, callback=null) {
+ if (el.value != value) {
+ el.value = value;
+ if (callback) {
+ callback(value);
+ }
+ }
+ },
+ "getValue": function(el) {
+ if (el.step % 1 === 0) {
+ return parseInt(el.value);
+ } else {
+ return parseFloat(el.value);
+ }
+ },
};
};