From c903f60f85c143cf9234b88e2106f16d0a5fead1 Mon Sep 17 00:00:00 2001 From: Devaev Maxim Date: Wed, 14 Jul 2021 16:26:56 +0300 Subject: save pak settings --- web/share/js/kvm/hid.js | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'web/share/js/kvm/hid.js') diff --git a/web/share/js/kvm/hid.js b/web/share/js/kvm/hid.js index 8e6d3fd0..933590e6 100644 --- a/web/share/js/kvm/hid.js +++ b/web/share/js/kvm/hid.js @@ -74,6 +74,15 @@ export function Hid(__getResolution) { window.addEventListener("pagehide", __releaseAll); window.addEventListener("blur", __releaseAll); + $("hid-pak-ask-switch").checked = parseInt(tools.storage.get("hid.pak.ask", "1")); + tools.setOnClick($("hid-pak-ask-switch"), function() { + tools.storage.set("hid.pak.ask", ($("hid-pak-ask-switch").checked ? 1 : 0)); + }, false); + + $("hid-pak-keymap-selector").addEventListener("change", function() { + tools.storage.set("hid.pak.keymap", $("hid-pak-keymap-selector").value); + }); + tools.setOnClick($("hid-pak-button"), __clickPasteAsKeysButton); tools.setOnClick($("hid-connect-switch"), __clickConnectSwitch); tools.setOnClick($("hid-reset-button"), __clickResetButton); @@ -163,9 +172,10 @@ export function Hid(__getResolution) { }; self.setKeymaps = function(state) { + let selected = tools.storage.get("hid.pak.keymap", state.keymaps["default"]); let html = ""; for (let variant of state.keymaps.available) { - html += ``; + html += ``; } $("hid-pak-keymap-selector").innerHTML = html; }; -- cgit v1.2.3