mirror of
https://github.com/mofeng-git/One-KVM.git
synced 2025-12-12 09:10:30 +08:00
refactoring
This commit is contained in:
parent
68897c94ac
commit
d7f65ad788
@ -36,9 +36,9 @@ export function Atx() {
|
||||
$("atx-power-led").title = "Power Led";
|
||||
$("atx-hdd-led").title = "Disk Activity Led";
|
||||
|
||||
$("atx-ask-switch").checked = parseInt(tools.storage.get("atx.ask", "1"));
|
||||
$("atx-ask-switch").checked = tools.storage.getBool("atx.ask", true);
|
||||
tools.el.setOnClick($("atx-ask-switch"), function() {
|
||||
tools.storage.set("atx.ask", ($("atx-ask-switch").checked ? 1 : 0));
|
||||
tools.storage.setBool("atx.ask", $("atx-ask-switch").checked);
|
||||
}, false);
|
||||
|
||||
|
||||
|
||||
@ -74,9 +74,9 @@ 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"));
|
||||
$("hid-pak-ask-switch").checked = tools.storage.getBool("hid.pak.ask", true);
|
||||
tools.el.setOnClick($("hid-pak-ask-switch"), function() {
|
||||
tools.storage.set("hid.pak.ask", ($("hid-pak-ask-switch").checked ? 1 : 0));
|
||||
tools.storage.setBool("hid.pak.ask", $("hid-pak-ask-switch").checked);
|
||||
}, false);
|
||||
|
||||
$("hid-pak-keymap-selector").addEventListener("change", function() {
|
||||
|
||||
@ -277,6 +277,9 @@ export var tools = new function() {
|
||||
return (value !== null ? value : default_value);
|
||||
},
|
||||
"set": (key, value) => window.localStorage.setItem(key, value),
|
||||
|
||||
"getBool": (key, default_value) => !!parseInt(self.storage.get(key, (default_value ? "1" : "0"))),
|
||||
"setBool": (key, value) => self.storage.set(key, (value ? "1" : "0")),
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user