summaryrefslogtreecommitdiff
path: root/kvmd/web/js/tools.js
diff options
context:
space:
mode:
Diffstat (limited to 'kvmd/web/js/tools.js')
-rw-r--r--kvmd/web/js/tools.js19
1 files changed, 19 insertions, 0 deletions
diff --git a/kvmd/web/js/tools.js b/kvmd/web/js/tools.js
index 67149085..76f27b7d 100644
--- a/kvmd/web/js/tools.js
+++ b/kvmd/web/js/tools.js
@@ -10,6 +10,25 @@ var tools = new function() {
return http;
};
+ this.setOnClick = function(el, callback) {
+ el.onclick = el.ontouchend = function(event) {
+ event.preventDefault();
+ callback();
+ };
+ };
+ this.setOnDown = function(el, callback) {
+ el.onmousedown = el.ontouchstart = function(event) {
+ event.preventDefault();
+ callback();
+ };
+ };
+ this.setOnUp = function(el, callback) {
+ el.onmouseup = el.ontouchend = function(event) {
+ event.preventDefault();
+ callback();
+ };
+ };
+
this.debug = function(...args) {
if (__debug) {
console.log("LOG/DEBUG", ...args); // eslint-disable-line no-console