mirror of
https://github.com/mofeng-git/One-KVM.git
synced 2026-01-31 18:11:54 +08:00
mouse support
This commit is contained in:
@@ -1,10 +1,4 @@
|
||||
var hid = new function() {
|
||||
var __install_timer = null;
|
||||
var __installed = false;
|
||||
|
||||
var __hidden_attr = null;
|
||||
var __visibility_change_attr = null;
|
||||
|
||||
this.init = function() {
|
||||
keyboard.init();
|
||||
mouse.init();
|
||||
@@ -32,32 +26,12 @@ var hid = new function() {
|
||||
};
|
||||
|
||||
this.installCapture = function(ws) {
|
||||
var http = tools.makeRequest("GET", "/kvmd/hid", function() {
|
||||
if (http.readyState === 4) {
|
||||
if (http.status === 200) {
|
||||
features = JSON.parse(http.responseText).result.features;
|
||||
if (features.mouse) {
|
||||
mouse.setSocket(ws);
|
||||
}
|
||||
keyboard.setSocket(ws);
|
||||
__installed = true;
|
||||
} else {
|
||||
tools.error("Can't resolve HID features:", http.responseText);
|
||||
__install_timer = setTimeout(() => hid.installCapture(ws), 1000);
|
||||
}
|
||||
}
|
||||
});
|
||||
keyboard.setSocket(ws);
|
||||
mouse.setSocket(ws);
|
||||
};
|
||||
|
||||
this.clearCapture = function() {
|
||||
if (__install_timer) {
|
||||
clearTimeout(__install_timer);
|
||||
__install_timer = null;
|
||||
}
|
||||
if (__installed) {
|
||||
mouse.setSocket(null);
|
||||
keyboard.setSocket(null);
|
||||
__installed = false;
|
||||
}
|
||||
mouse.setSocket(null);
|
||||
keyboard.setSocket(null);
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user