diff options
Diffstat (limited to 'web/share/js/kvm')
-rw-r--r-- | web/share/js/kvm/hid.js | 2 | ||||
-rw-r--r-- | web/share/js/kvm/keyboard.js | 20 | ||||
-rw-r--r-- | web/share/js/kvm/mouse.js | 2 |
3 files changed, 12 insertions, 12 deletions
diff --git a/web/share/js/kvm/hid.js b/web/share/js/kvm/hid.js index 49d659ab..1c60b099 100644 --- a/web/share/js/kvm/hid.js +++ b/web/share/js/kvm/hid.js @@ -46,7 +46,7 @@ function Hid() { tools.setOnClick($("hid-pak-button"), __clickPasteAsKeysButton); tools.setOnClick($("hid-reset-button"), __clickResetButton); - Array.prototype.forEach.call(document.querySelectorAll("[data-shortcut]"), function(el_shortcut) { + tools.forEach($$$("[data-shortcut]"), function(el_shortcut) { tools.setOnClick(el_shortcut, () => __emitShortcut(el_shortcut.getAttribute("data-shortcut").split(" "))); }); }; diff --git a/web/share/js/kvm/keyboard.js b/web/share/js/kvm/keyboard.js index 3c821406..c424c659 100644 --- a/web/share/js/kvm/keyboard.js +++ b/web/share/js/kvm/keyboard.js @@ -5,8 +5,8 @@ function Keyboard() { var __ws = null; - var __keys = [].slice.call(document.querySelectorAll("div#keyboard-desktop div.keyboard-block div.keyboard-row div.key")); - var __modifiers = [].slice.call(document.querySelectorAll("div#keyboard-desktop div.keyboard-block div.keyboard-row div.modifier")); + var __keys = [].slice.call($$$("div#keyboard-desktop div.keyboard-block div.keyboard-row div.key")); + var __modifiers = [].slice.call($$$("div#keyboard-desktop div.keyboard-block div.keyboard-row div.modifier")); var __init__ = function() { $("hid-keyboard-led").title = "Keyboard free"; @@ -24,7 +24,7 @@ function Keyboard() { window.addEventListener("focusin", __updateLeds); window.addEventListener("focusout", __updateLeds); - Array.prototype.forEach.call($$("key"), function(el_key) { + tools.forEach($$("key"), function(el_key) { tools.setOnDown(el_key, () => __clickHandler(el_key, true)); tools.setOnUp(el_key, () => __clickHandler(el_key, false)); el_key.onmouseout = function() { @@ -34,7 +34,7 @@ function Keyboard() { }; }); - Array.prototype.forEach.call($$("modifier"), function(el_key) { + tools.forEach($$("modifier"), function(el_key) { tools.setOnDown(el_key, () => __toggleModifierHandler(el_key)); }); @@ -134,7 +134,7 @@ function Keyboard() { var __isPressed = function(el_key) { var is_pressed = false; - Array.prototype.forEach.call(__resolveKeys(el_key), function(el_key) { + tools.forEach(__resolveKeys(el_key), function(el_key) { is_pressed = (is_pressed || el_key.classList.contains("pressed")); }); return is_pressed; @@ -142,7 +142,7 @@ function Keyboard() { var __isHolded = function(el_key) { var is_holded = false; - Array.prototype.forEach.call(__resolveKeys(el_key), function(el_key) { + tools.forEach(__resolveKeys(el_key), function(el_key) { is_holded = (is_holded || el_key.classList.contains("holded")); }); return is_holded; @@ -150,20 +150,20 @@ function Keyboard() { var __isActive = function(el_key) { var is_active = false; - Array.prototype.forEach.call(__resolveKeys(el_key), function(el_key) { + tools.forEach(__resolveKeys(el_key), function(el_key) { is_active = (is_active || el_key.classList.contains("pressed") || el_key.classList.contains("holded")); }); return is_active; }; var __activate = function(el_key, cls) { - Array.prototype.forEach.call(__resolveKeys(el_key), function(el_key) { + tools.forEach(__resolveKeys(el_key), function(el_key) { el_key.classList.add(cls); }); }; var __deactivate = function(el_key) { - Array.prototype.forEach.call(__resolveKeys(el_key), function(el_key) { + tools.forEach(__resolveKeys(el_key), function(el_key) { el_key.classList.remove("pressed"); el_key.classList.remove("holded"); }); @@ -171,7 +171,7 @@ function Keyboard() { var __resolveKeys = function(el_key) { var code = el_key.getAttribute("data-key"); - return document.querySelectorAll(`[data-key='${code}']`); + return $$$(`[data-key='${code}']`); }; var __sendKey = function(el_key, state) { diff --git a/web/share/js/kvm/mouse.js b/web/share/js/kvm/mouse.js index 58e46d15..59b3fc73 100644 --- a/web/share/js/kvm/mouse.js +++ b/web/share/js/kvm/mouse.js @@ -23,7 +23,7 @@ function Mouse() { $("stream-box").onwheel = __wheelHandler; $("stream-box").ontouchstart = (event) => __touchMoveHandler(event); - Array.prototype.forEach.call(document.querySelectorAll("[data-mouse-button]"), function(el_button) { + tools.forEach($$$("[data-mouse-button]"), function(el_button) { var button = el_button.getAttribute("data-mouse-button"); tools.setOnDown(el_button, () => __sendButton(button, true)); tools.setOnUp(el_button, () => __sendButton(button, false)); |