mirror of
https://github.com/mofeng-git/One-KVM.git
synced 2025-12-12 01:00:29 +08:00
pikvm/pikvm#616: secure text switch
This commit is contained in:
parent
6d6630a4dd
commit
f04617ac4f
@ -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>
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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);
|
||||
|
||||
@ -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);
|
||||
},
|
||||
};
|
||||
};
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user