summaryrefslogtreecommitdiff
path: root/web/js/hid.js
diff options
context:
space:
mode:
authorDevaev Maxim <[email protected]>2018-10-05 20:30:49 +0300
committerDevaev Maxim <[email protected]>2018-10-05 20:30:49 +0300
commit125a56e5546976ae2389c1dd04ccd11f169ff66b (patch)
treeed942697b07f22743f0d9f1c3e8f0a1cf95112b6 /web/js/hid.js
parenta87963e300b489831c3809c4321c8747752fc6c6 (diff)
hid pinout
Diffstat (limited to 'web/js/hid.js')
-rw-r--r--web/js/hid.js18
1 files changed, 15 insertions, 3 deletions
diff --git a/web/js/hid.js b/web/js/hid.js
index 24f5bfbc..26529b32 100644
--- a/web/js/hid.js
+++ b/web/js/hid.js
@@ -42,7 +42,9 @@ function Hid() {
window.onblur = __releaseAll;
__chars_to_codes = __buildCharsToCodes();
- tools.setOnClick($("pak-button"), __pasteAsKeys);
+ tools.setOnClick($("pak-button"), __clickPasteAsKeysButton);
+
+ tools.setOnClick($("hid-reset-button"), __clickResetButton);
Array.prototype.forEach.call(document.querySelectorAll("[data-shortcut]"), function(el_shortcut) {
tools.setOnClick(el_shortcut, () => __emitShortcut(el_shortcut.getAttribute("data-shortcut").split(" ")));
@@ -55,7 +57,7 @@ function Hid() {
__ws = ws;
__keyboard.setSocket(ws);
__mouse.setSocket(ws);
- $("pak-text").disabled = $("pak-button").disabled = !ws;
+ $("pak-text").disabled = $("pak-button").disabled = $("hid-reset-button").disabled = !ws;
};
var __releaseAll = function() {
@@ -127,7 +129,7 @@ function Hid() {
return chars_to_codes;
};
- var __pasteAsKeys = function() {
+ var __clickPasteAsKeysButton = function() {
var text = $("pak-text").value.replace(/[^\x00-\x7F]/g, ""); // eslint-disable-line no-control-regex
if (text) {
var clipboard_codes = [];
@@ -179,5 +181,15 @@ function Hid() {
}
};
+ var __clickResetButton = function() {
+ var http = tools.makeRequest("POST", "/kvmd/hid/reset", function() {
+ if (http.readyState === 4) {
+ if (http.status !== 200) {
+ ui.error("HID reset error:<br>", http.responseText);
+ }
+ }
+ });
+ };
+
__init__();
}