mirror of
https://github.com/mofeng-git/One-KVM.git
synced 2025-12-13 01:30:31 +08:00
24 lines
642 B
JavaScript
24 lines
642 B
JavaScript
var tools = new function() {
|
|
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;
|
|
};
|
|
|
|
var __debug = (new URL(window.location.href)).searchParams.get("debug");
|
|
|
|
this.debug = function(...args) {
|
|
if (__debug) {
|
|
console.log("LOG/DEBUG", ...args);
|
|
}
|
|
};
|
|
|
|
this.info = (...args) => console.log("LOG/INFO", ...args);
|
|
this.error = (...args) => console.error("LOG/ERROR", ...args);
|
|
};
|
|
|
|
var $ = function(id) { return document.getElementById(id); };
|