connecting state for link led

This commit is contained in:
Devaev Maxim 2018-08-12 07:30:48 +03:00
parent 159c399fb8
commit 43fa2cc2ff
2 changed files with 12 additions and 1 deletions

View File

@ -33,6 +33,11 @@ img.led-pak-typing {
animation: spin 2s linear infinite; animation: spin 2s linear infinite;
} }
img.led-link-connecting {
-webkit-filter: invert(0.5) sepia(1) saturate(5) hue-rotate(0deg);
filter: invert(0.5) sepia(1) saturate(5) hue-rotate(0deg);
}
img.led-fan-on { img.led-fan-on {
-webkit-filter: invert(0.5) sepia(1) saturate(5) hue-rotate(100deg); -webkit-filter: invert(0.5) sepia(1) saturate(5) hue-rotate(100deg);
filter: invert(0.5) sepia(1) saturate(5) hue-rotate(100deg); filter: invert(0.5) sepia(1) saturate(5) hue-rotate(100deg);

View File

@ -20,6 +20,8 @@ var session = new function() {
}; };
this.startPoller = function() { this.startPoller = function() {
$("link-led").className = "led-link-connecting";
$("link-led").title = "Connecting...";
var http = tools.makeRequest("GET", "/wsauth", function() { var http = tools.makeRequest("GET", "/wsauth", function() {
if (http.readyState === 4) { if (http.readyState === 4) {
if (http.status === 200) { if (http.status === 200) {
@ -37,6 +39,7 @@ var session = new function() {
var __wsOpenHandler = function(event) { var __wsOpenHandler = function(event) {
$("link-led").className = "led-on"; $("link-led").className = "led-on";
$("link-led").title = "Connected";
tools.debug("WebSocket opened:", event); tools.debug("WebSocket opened:", event);
atx.loadInitialState(); atx.loadInitialState();
msd.loadInitialState(); msd.loadInitialState();
@ -80,7 +83,10 @@ var session = new function() {
hid.setSocket(null); hid.setSocket(null);
atx.clearState(); atx.clearState();
__ws = null; __ws = null;
setTimeout(session.startPoller, 1000); setTimeout(function() {
$("link-led").className = "led-link-connecting";
setTimeout(session.startPoller, 500);
}, 500);
}; };
var __pingServer = function() { var __pingServer = function() {