mirror of
https://github.com/mofeng-git/One-KVM.git
synced 2025-12-12 01:00:29 +08:00
shortcuts menu
This commit is contained in:
parent
d1a66cb948
commit
c75d5e5352
@ -166,6 +166,27 @@
|
||||
</div>
|
||||
</div>
|
||||
</li>
|
||||
|
||||
<li class="ctl-right-actions">
|
||||
<div class="ctl-dropdown">
|
||||
<a class="ctl-item" href="#">
|
||||
Shortcuts ↴
|
||||
</a>
|
||||
<div class="ctl-dropdown-content" style="display:none">
|
||||
<button onclick="hid.emitShortcut('ControlLeft', 'AltLeft', 'Delete');">• Ctrl+Alt+Del</button>
|
||||
<hr>
|
||||
<button onclick="hid.emitShortcut('ControlLeft', 'Escape');">• Ctrl+Esc</button>
|
||||
<button onclick="hid.emitShortcut('AltLeft', 'Tab');">• Alt+Tab</button>
|
||||
<button onclick="hid.emitShortcut('AltLeft', 'Escape');">• Alt+Escape</button>
|
||||
<button onclick="hid.emitShortcut('AltLeft', 'Space');">• Alt+Space</button>
|
||||
<button onclick="hid.emitShortcut('AltLeft', 'Enter');">• Alt+Enter</button>
|
||||
<button onclick="hid.emitShortcut('AltLeft', 'F4');">• Alt+F4</button>
|
||||
<hr>
|
||||
<button onclick="hid.emitShortcut('AltLeft', 'PrintScreen');">• Alt+PrtSc</button>
|
||||
<button onclick="hid.emitShortcut('PrintScreen');">• PrtSc</button>
|
||||
</div>
|
||||
</div>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<div class="window" style="left:50%; top:70px">
|
||||
|
||||
@ -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) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user