mirror of
https://github.com/mofeng-git/One-KVM.git
synced 2026-01-29 09:01:54 +08:00
shortcuts menu
This commit is contained in:
@@ -6,6 +6,23 @@ var hid = new function() {
|
||||
mouse.init();
|
||||
}
|
||||
|
||||
this.emitShortcut = function(...codes) {
|
||||
console.log(codes);
|
||||
var delay = 0;
|
||||
[[codes, true], [codes.slice().reverse(), false]].forEach(function(op) {
|
||||
var [op_codes, state] = op;
|
||||
op_codes.forEach(function(code) {
|
||||
setTimeout(function() {
|
||||
document.dispatchEvent(new KeyboardEvent(
|
||||
(state ? "keydown" : "keyup"),
|
||||
{code: code},
|
||||
));
|
||||
}, delay);
|
||||
delay += 100;
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
this.installCapture = function(ws) {
|
||||
var http = tools.makeRequest("GET", "/kvmd/hid", function() {
|
||||
if (http.readyState === 4) {
|
||||
|
||||
Reference in New Issue
Block a user