diff options
author | Devaev Maxim <[email protected]> | 2018-10-09 16:20:41 +0300 |
---|---|---|
committer | Devaev Maxim <[email protected]> | 2018-10-09 16:20:41 +0300 |
commit | a449b39c52392d0d8b043934a15792f21d54e06d (patch) | |
tree | c8ff6a67baea441b61ea14f0363ba4b22c0cd116 /web/js | |
parent | 2c241fab4409eac3b40762d2c23d42ac6e3f8df1 (diff) |
refactoring
Diffstat (limited to 'web/js')
-rw-r--r-- | web/js/atx.js | 8 | ||||
-rw-r--r-- | web/js/hid.js | 4 | ||||
-rw-r--r-- | web/js/keyboard.js | 4 | ||||
-rw-r--r-- | web/js/mouse.js | 4 | ||||
-rw-r--r-- | web/js/msd.js | 6 | ||||
-rw-r--r-- | web/js/session.js | 10 | ||||
-rw-r--r-- | web/js/stream.js | 6 |
7 files changed, 21 insertions, 21 deletions
diff --git a/web/js/atx.js b/web/js/atx.js index f4b4811a..b75b901b 100644 --- a/web/js/atx.js +++ b/web/js/atx.js @@ -28,13 +28,13 @@ function Atx() { self.setState = function(state) { __setButtonsBusy(state.busy); - $("atx-power-led").className = (state.leds.power ? "led-on" : "led-off"); - $("atx-hdd-led").className = (state.leds.hdd ? "led-hdd-busy" : "led-off"); + $("atx-power-led").className = (state.leds.power ? "led-green" : "led-gray"); + $("atx-hdd-led").className = (state.leds.hdd ? "led-red" : "led-gray"); }; self.clearState = function() { - $("atx-power-led").className = "led-off"; - $("atx-hdd-led").className = "led-off"; + $("atx-power-led").className = "led-gray"; + $("atx-hdd-led").className = "led-gray"; }; var __clickButton = function(button, timeout, confirm_msg) { diff --git a/web/js/hid.js b/web/js/hid.js index 27c53966..77bb865b 100644 --- a/web/js/hid.js +++ b/web/js/hid.js @@ -153,7 +153,7 @@ function Hid() { if (ok) { $("hid-pak-text").disabled = true; $("hid-pak-button").disabled = true; - $("hid-pak-led").className = "led-hid-pak-typing"; + $("hid-pak-led").className = "led-yellow-rotating-fast"; $("hid-pak-led").title = "Autotyping..."; tools.debug("Paste-as-keys:", text); @@ -168,7 +168,7 @@ function Hid() { $("hid-pak-text").value = ""; $("hid-pak-text").disabled = false; $("hid-pak-button").disabled = false; - $("hid-pak-led").className = "led-off"; + $("hid-pak-led").className = "led-gray"; $("hid-pak-led").title = ""; } }); diff --git a/web/js/keyboard.js b/web/js/keyboard.js index b8c4797b..42e92ecd 100644 --- a/web/js/keyboard.js +++ b/web/js/keyboard.js @@ -71,10 +71,10 @@ function Keyboard() { var __updateLeds = function() { if (__ws && (document.activeElement === $("stream-window") || document.activeElement === $("keyboard-window"))) { - $("hid-keyboard-led").className = "led-on"; + $("hid-keyboard-led").className = "led-green"; $("hid-keyboard-led").title = "Keyboard captured"; } else { - $("hid-keyboard-led").className = "led-off"; + $("hid-keyboard-led").className = "led-gray"; $("hid-keyboard-led").title = "Keyboard free"; } }; diff --git a/web/js/mouse.js b/web/js/mouse.js index d1c45118..460e2945 100644 --- a/web/js/mouse.js +++ b/web/js/mouse.js @@ -55,10 +55,10 @@ function Mouse() { var __updateLeds = function() { if (__ws && __stream_hovered) { - $("hid-mouse-led").className = "led-on"; + $("hid-mouse-led").className = "led-green"; $("hid-mouse-led").title = "Mouse tracked"; } else { - $("hid-mouse-led").className = "led-off"; + $("hid-mouse-led").className = "led-gray"; $("hid-mouse-led").title = "Mouse free"; } }; diff --git a/web/js/msd.js b/web/js/msd.js index 9adb7495..bbc86370 100644 --- a/web/js/msd.js +++ b/web/js/msd.js @@ -103,18 +103,18 @@ function Msd() { var __applyState = function() { if (__state.connected_to === "server") { $("msd-another-another-user-uploads").style.display = "none"; - $("msd-led").className = "led-on"; + $("msd-led").className = "led-green"; $("msd-status").innerHTML = $("msd-led").title = "Connected to Server"; $("msd-another-another-user-uploads").style.display = "none"; } else if (__state.busy) { if (!__upload_http) { $("msd-another-another-user-uploads").style.display = "block"; } - $("msd-led").className = "led-msd-writing"; + $("msd-led").className = "led-yellow-rotating-fast"; $("msd-status").innerHTML = $("msd-led").title = "Uploading new image"; } else { $("msd-another-another-user-uploads").style.display = "none"; - $("msd-led").className = "led-off"; + $("msd-led").className = "led-gray"; if (__state.in_operate) { $("msd-status").innerHTML = $("msd-led").title = "Connected to KVM"; } else { diff --git a/web/js/session.js b/web/js/session.js index 3169c8c1..19df05cc 100644 --- a/web/js/session.js +++ b/web/js/session.js @@ -33,12 +33,12 @@ function Session(atx, hid, msd) { }; var __startPoller = function() { - $("link-led").className = "led-link-connecting"; + $("link-led").className = "led-yellow"; $("link-led").title = "Connecting..."; var http = tools.makeRequest("GET", "/wsauth", function() { if (http.readyState === 4) { if (http.status === 200) { - __ws = new WebSocket((location.protocol == "https:" ? "wss" : "ws") + "://" + location.host + "/kvmd/ws"); + __ws = new WebSocket((location.protocol === "https:" ? "wss" : "ws") + "://" + location.host + "/kvmd/ws"); __ws.onopen = __wsOpenHandler; __ws.onmessage = __wsMessageHandler; __ws.onerror = __wsErrorHandler; @@ -51,7 +51,7 @@ function Session(atx, hid, msd) { }; var __wsOpenHandler = function(event) { - $("link-led").className = "led-on"; + $("link-led").className = "led-green"; $("link-led").title = "Connected"; tools.debug("WebSocket opened:", event); atx.loadInitialState(); @@ -85,7 +85,7 @@ function Session(atx, hid, msd) { }; var __wsCloseHandler = function(event) { - $("link-led").className = "led-off"; + $("link-led").className = "led-gray"; tools.debug("WebSocket closed:", event); if (__ping_timer) { clearInterval(__ping_timer); @@ -95,7 +95,7 @@ function Session(atx, hid, msd) { atx.clearState(); __ws = null; setTimeout(function() { - $("link-led").className = "led-link-connecting"; + $("link-led").className = "led-yellow"; setTimeout(__startPoller, 500); }, 500); }; diff --git a/web/js/stream.js b/web/js/stream.js index 10388ca1..fe054e47 100644 --- a/web/js/stream.js +++ b/web/js/stream.js @@ -46,7 +46,7 @@ function Stream() { tools.info("Refreshing stream ..."); $("stream-image").className = "stream-image-inactive"; $("stream-box").classList.add("stream-box-inactive"); - $("stream-led").className = "led-off"; + $("stream-led").className = "led-gray"; $("stream-led").title = "Stream inactive"; $("stream-screenshot-button").disabled = true; $("stream-quality-slider").disabled = true; @@ -56,7 +56,7 @@ function Stream() { __prev_state = false; } else if (http.status === 200) { - if ($("stream-quality-slider").value != response.source.quality && !__quality_timer) { + if ($("stream-quality-slider").value !== response.source.quality && !__quality_timer) { $("stream-quality-slider").value = response.source.quality; $("stream-quality-value").innerHTML = response.source.quality + "%"; } @@ -88,7 +88,7 @@ function Stream() { $("stream-image").src = "/streamer/stream?t=" + new Date().getTime(); $("stream-image").className = "stream-image-active"; $("stream-box").classList.remove("stream-box-inactive"); - $("stream-led").className = "led-on"; + $("stream-led").className = "led-green"; $("stream-led").title = "Stream is active"; $("stream-screenshot-button").disabled = false; $("stream-quality-slider").disabled = false; |