WebUI: use native event listeners for keyboard events

PR #21924.
This commit is contained in:
Chocobo1
2024-12-02 13:41:19 +08:00
committed by GitHub
parent e8d8de8f19
commit 2d1c4fc809
24 changed files with 273 additions and 366 deletions

View File

@@ -16,25 +16,20 @@
const UseGlobalLimit = -2;
const NoLimit = -1;
new Keyboard({
defaultEventType: "keydown",
events: {
"Enter": function(event) {
$("save").click();
event.preventDefault();
},
"Escape": function(event) {
window.parent.qBittorrent.Client.closeFrameWindow(window);
event.preventDefault();
},
"Esc": function(event) {
window.parent.qBittorrent.Client.closeFrameWindow(window);
event.preventDefault();
}
}
}).activate();
window.addEventListener("DOMContentLoaded", () => {
window.addEventListener("keydown", (event) => {
switch (event.key) {
case "Enter":
event.preventDefault();
$("save").click();
break;
case "Escape":
event.preventDefault();
window.parent.qBittorrent.Client.closeFrameWindow(window);
break;
}
});
const hashesList = new URI().getData("hashes").split("|");
const origValues = new URI().getData("orig").split("|");