diff --git a/html/realtimechat.js b/html/realtimechat.js index ce777c8..e84ad2c 100644 --- a/html/realtimechat.js +++ b/html/realtimechat.js @@ -55,7 +55,7 @@ function toAJAX() xhttp.onload = function() { if (reqIsFailed) { reqIsFailed = false; - appendMessage("", "Fine: you are online again") + objPath.removeAttribute("style", "color: red"); } const answer = JSON.parse(xhttp.responseText); @@ -65,10 +65,10 @@ function toAJAX() } if (answer.serverStatusChanged) { if (answer.serverStatus) { - appendMessage("***", "Connected to server. Ready to handle new messages!") + objPath.removeAttribute("style", "color: red"); objCurrentServerStatus.innerText = HTML_SERVER_ONLINE_MARKER; } else { - appendMessage("***", "Disconnected from server. Reconnecting...") + objPath.setAttribute("style", "color: red"); objCurrentServerStatus.innerText = HTML_SERVER_OFFLINE_MARKER; } } @@ -88,7 +88,7 @@ function toAJAX() xhttp.onerror = function() { if (!reqIsFailed) { reqIsFailed = true; - appendMessage("", "Request is failed: no response from server") + objPath.setAttribute("style", "color: red"); } }