summaryrefslogtreecommitdiff
path: root/web
diff options
context:
space:
mode:
authorDevaev Maxim <[email protected]>2019-02-08 03:02:58 +0300
committerDevaev Maxim <[email protected]>2019-02-08 03:02:58 +0300
commite22426155dc3a05c8ce15fc7fbfd3df80aa57bfb (patch)
tree669587d077973b28145481387bff2d152d57695c /web
parent686f2a8bd4bdd9abc76aa0ebeca48e80faeef60f (diff)
hid: led-yellow preferred
Diffstat (limited to 'web')
-rw-r--r--web/share/js/kvm/keyboard.js32
-rw-r--r--web/share/js/kvm/mouse.js26
2 files changed, 36 insertions, 22 deletions
diff --git a/web/share/js/kvm/keyboard.js b/web/share/js/kvm/keyboard.js
index cdf686c7..9b898925 100644
--- a/web/share/js/kvm/keyboard.js
+++ b/web/share/js/kvm/keyboard.js
@@ -72,24 +72,30 @@ function Keyboard() {
};
var __updateLeds = function() {
- tools.debug("Keyboard: update leds");
- if (
- __ws && (
- $("stream-window").classList.contains("window-active")
- || $("keyboard-window").classList.contains("window-active")
- )
- ) {
+ var is_captured = (
+ $("stream-window").classList.contains("window-active")
+ || $("keyboard-window").classList.contains("window-active")
+ );
+ var led = "led-gray";
+ var title = "Keyboard free";
+
+ if (__ws) {
if (__ok) {
- $("hid-keyboard-led").className = "led-green";
- $("hid-keyboard-led").title = "Keyboard captured";
+ if (is_captured) {
+ led = "led-green";
+ title = "Keyboard captured";
+ }
} else {
- $("hid-keyboard-led").className = "led-yellow";
- $("hid-keyboard-led").title = "Keyboard captured, HID offline";
+ led = "led-yellow";
+ title = (is_captured ? "Keyboard captured, HID offline" : "Keyboard free, HID offline");
}
} else {
- $("hid-keyboard-led").className = "led-gray";
- $("hid-keyboard-led").title = "Keyboard free";
+ if (is_captured) {
+ title = "Keyboard captured, Pi-KVM offline";
+ }
}
+ $("hid-keyboard-led").className = led;
+ $("hid-keyboard-led").title = title;
};
var __keyboardHandler = function(event, state) {
diff --git a/web/share/js/kvm/mouse.js b/web/share/js/kvm/mouse.js
index 3f81a833..13807ec7 100644
--- a/web/share/js/kvm/mouse.js
+++ b/web/share/js/kvm/mouse.js
@@ -61,19 +61,27 @@ function Mouse() {
};
var __updateLeds = function() {
- if (__ws && (__stream_hovered || tools.browser.is_ios)) {
- // Mouse is always available on iOS via touchscreen
- if (__ok) {
- $("hid-mouse-led").className = "led-green";
- $("hid-mouse-led").title = "Mouse tracked";
+ var is_captured = (__stream_hovered || tools.browser.is_ios);
+ var led = "led-gray";
+ var title = "Mouse free";
+
+ if (__ws) {
+ if (__ok) {
+ if (is_captured) {
+ led = "led-green";
+ title = "Mouse captured";
+ }
} else {
- $("hid-mouse-led").className = "led-yellow";
- $("hid-mouse-led").title = "Mouse tracked, HID offline";
+ led = "led-yellow";
+ title = (is_captured ? "Mouse captured, HID offline" : "Mouse free, HID offline");
}
} else {
- $("hid-mouse-led").className = "led-gray";
- $("hid-mouse-led").title = "Mouse free";
+ if (is_captured) {
+ title = "Mouse captured, Pi-KVM offline";
+ }
}
+ $("hid-mouse-led").className = led;
+ $("hid-mouse-led").title = title;
};
var __buttonHandler = function(event, state) {