summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--kvmd/eslintrc.yaml1
-rw-r--r--kvmd/web/js/keyboard.js4
-rw-r--r--kvmd/web/js/tools.js1
-rw-r--r--kvmd/web/js/ui.js4
4 files changed, 6 insertions, 4 deletions
diff --git a/kvmd/eslintrc.yaml b/kvmd/eslintrc.yaml
index 215105b0..4880085d 100644
--- a/kvmd/eslintrc.yaml
+++ b/kvmd/eslintrc.yaml
@@ -9,6 +9,7 @@ globals:
tools: true
ui: true
"$": true
+ "$$": true
env:
browser: true
diff --git a/kvmd/web/js/keyboard.js b/kvmd/web/js/keyboard.js
index 67553159..15cab179 100644
--- a/kvmd/web/js/keyboard.js
+++ b/kvmd/web/js/keyboard.js
@@ -17,7 +17,7 @@ var keyboard = new function() {
$("stream-window").onkeydown = (event) => __keyboardHandler(event, true);
$("stream-window").onkeyup = (event) => __keyboardHandler(event, false);
- Array.prototype.forEach.call(document.getElementsByClassName("key"), function(el_key) {
+ Array.prototype.forEach.call($$("key"), function(el_key) {
el_key.onmousedown = () => __clickHandler(el_key, true);
el_key.onmouseup = () => __clickHandler(el_key, false);
el_key.onmouseout = function() {
@@ -27,7 +27,7 @@ var keyboard = new function() {
};
__keys.push(el_key);
});
- Array.prototype.forEach.call(document.getElementsByClassName("modifier"), function(el_key) {
+ Array.prototype.forEach.call($$("modifier"), function(el_key) {
el_key.onmousedown = () => __toggleModifierHandler(el_key);
__modifiers.push(el_key);
});
diff --git a/kvmd/web/js/tools.js b/kvmd/web/js/tools.js
index ea68b96a..67149085 100644
--- a/kvmd/web/js/tools.js
+++ b/kvmd/web/js/tools.js
@@ -21,3 +21,4 @@ var tools = new function() {
};
var $ = (id) => document.getElementById(id);
+var $$ = (cls) => document.getElementsByClassName(cls);
diff --git a/kvmd/web/js/ui.js b/kvmd/web/js/ui.js
index d38b36fb..b4ad9290 100644
--- a/kvmd/web/js/ui.js
+++ b/kvmd/web/js/ui.js
@@ -4,12 +4,12 @@ var ui = new function() {
var __ctl_items = [];
this.init = function() {
- Array.prototype.forEach.call(document.getElementsByClassName("ctl-item"), function(el_item) {
+ Array.prototype.forEach.call($$("ctl-item"), function(el_item) {
el_item.onclick = () => __toggleMenu(el_item);
__ctl_items.push(el_item);
});
- Array.prototype.forEach.call(document.getElementsByClassName("window"), function(el_window) {
+ Array.prototype.forEach.call($$("window"), function(el_window) {
var el_grab = el_window.querySelector(".window-header .window-grab");
__makeWindowMovable(el_grab, el_window);