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.js43
1 files changed, 0 insertions, 43 deletions
diff --git a/kvmd/web/js/tools.js b/kvmd/web/js/tools.js
deleted file mode 100644
index 76f27b7d..00000000
--- a/kvmd/web/js/tools.js
+++ /dev/null
@@ -1,43 +0,0 @@
-var tools = new function() {
- var __debug = (new URL(window.location.href)).searchParams.get("debug");
-
- this.makeRequest = function(method, url, callback, timeout=null) {
- var http = new XMLHttpRequest();
- http.open(method, url, true);
- http.onreadystatechange = callback;
- http.timeout = (timeout ? timeout : 5000);
- http.send();
- 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
- }
- };
-
- this.info = (...args) => console.log("LOG/INFO", ...args); // eslint-disable-line no-console
- this.error = (...args) => console.error("LOG/ERROR", ...args); // eslint-disable-line no-console
-};
-
-var $ = (id) => document.getElementById(id);
-var $$ = (cls) => document.getElementsByClassName(cls);