diff options
Diffstat (limited to 'web')
-rw-r--r-- | web/kvm/index.html | 31 | ||||
-rw-r--r-- | web/kvm/navbar-text.pug | 6 | ||||
-rw-r--r-- | web/share/js/kvm/hid.js | 8 | ||||
-rw-r--r-- | web/share/js/tools.js | 15 |
4 files changed, 45 insertions, 15 deletions
diff --git a/web/kvm/index.html b/web/kvm/index.html index a6a5a352..92c12aa8 100644 --- a/web/kvm/index.html +++ b/web/kvm/index.html @@ -524,17 +524,26 @@ </td> </tr> </table> - <table class="kv"> - <tr> - <td>Ask paste confirmation:</td> - <td align="right"> - <div class="switch-box"> - <input checked type="checkbox" id="hid-pak-ask-switch"> - <label for="hid-pak-ask-switch"><span class="switch-inner"></span><span class="switch"></span></label> - </div> - </td> - </tr> - </table> + <table class="kv"> + <tr> + <td>Ask paste confirmation:</td> + <td align="right"> + <div class="switch-box"> + <input checked type="checkbox" id="hid-pak-ask-switch"> + <label for="hid-pak-ask-switch"><span class="switch-inner"></span><span class="switch"></span></label> + </div> + </td> + </tr> + <tr class="feature-disabled" id="hid-pak-secure"> + <td>Hide input text:</td> + <td align="right"> + <div class="switch-box"> + <input type="checkbox" id="hid-pak-secure-switch"> + <label for="hid-pak-secure-switch"><span class="switch-inner"></span><span class="switch"></span></label> + </div> + </td> + </tr> + </table> <div class="feature-disabled" id="stream-ocr"> <hr><br> <hr> diff --git a/web/kvm/navbar-text.pug b/web/kvm/navbar-text.pug index 502ec1da..acba26cd 100644 --- a/web/kvm/navbar-text.pug +++ b/web/kvm/navbar-text.pug @@ -16,7 +16,11 @@ li(class="right") td using host keymap td select(id="hid-pak-keymap-selector") - +menu_switch("hid-pak-ask-switch", "Ask paste confirmation", true, true) + table(class="kv") + tr + +menu_switch_notable("hid-pak-ask-switch", "Ask paste confirmation", true, true) + tr(id="hid-pak-secure" class="feature-disabled") + +menu_switch_notable("hid-pak-secure-switch", "Hide input text", true, false) div(id="stream-ocr" class="feature-disabled") hr br diff --git a/web/share/js/kvm/hid.js b/web/share/js/kvm/hid.js index ecf8d39f..1d7a4ff3 100644 --- a/web/share/js/kvm/hid.js +++ b/web/share/js/kvm/hid.js @@ -72,6 +72,14 @@ export function Hid(__getGeometry, __recorder) { window.addEventListener("blur", __releaseAll); tools.storage.bindSimpleSwitch($("hid-pak-ask-switch"), "hid.pak.ask", true); + tools.storage.bindSimpleSwitch($("hid-pak-secure-switch"), "hid.pak.secure", false, function(value) { + $("hid-pak-text").style.setProperty("-webkit-text-security", (value ? "disc" : "none")); + }); + tools.feature.setEnabled($("hid-pak-secure"), ( + tools.browser.is_chrome + || tools.browser.is_safari + || tools.browser.is_opera + )); $("hid-pak-keymap-selector").addEventListener("change", function() { tools.storage.set("hid.pak.keymap", $("hid-pak-keymap-selector").value); diff --git a/web/share/js/tools.js b/web/share/js/tools.js index 31e8b9b4..59b8ba13 100644 --- a/web/share/js/tools.js +++ b/web/share/js/tools.js @@ -319,9 +319,18 @@ export var tools = new function() { "getBool": (key, default_value) => !!parseInt(self.storage.get(key, (default_value ? "1" : "0"))), "setBool": (key, value) => self.storage.set(key, (value ? "1" : "0")), - "bindSimpleSwitch": function(el, key, default_value) { - el.checked = self.storage.getBool(key, default_value); - self.el.setOnClick(el, () => self.storage.setBool(key, el.checked), false); + "bindSimpleSwitch": function(el, key, default_value, callback=null) { + let value = self.storage.getBool(key, default_value); + el.checked = value; + if (callback) { + callback(value); + } + self.el.setOnClick(el, function() { + if (callback) { + callback(el.checked); + } + self.storage.setBool(key, el.checked); + }, false); }, }; }; |