mirror of https://notabug.org/acetone/ircabot.git
...
parent
fc34809733
commit
de342c6af8
|
@ -10,6 +10,7 @@ const HTML_SERVER_OFFLINE_MARKER = "❌";
|
|||
let ajaxUrl = document.getElementById("ajaxPath").innerText;
|
||||
let lastMessageId = document.getElementById("LMId").innerText;
|
||||
let reqIsFailed = false;
|
||||
let firstLoadingWithDisconnectedServer = false;
|
||||
|
||||
function appendMessage(nick /* if == "***", then system message */, message)
|
||||
{
|
||||
|
@ -51,14 +52,19 @@ function changeOnlineList(nicksArray)
|
|||
|
||||
function toAJAX()
|
||||
{
|
||||
loop();
|
||||
let xhttp = new XMLHttpRequest();
|
||||
xhttp.onload = function() {
|
||||
if (reqIsFailed) {
|
||||
reqIsFailed = false;
|
||||
objPath.removeAttribute("style");
|
||||
}
|
||||
|
||||
const answer = JSON.parse(xhttp.responseText);
|
||||
if (firstLoadingWithDisconnectedServer && answer.serverStatus) {
|
||||
firstLoadingWithDisconnectedServer = false;
|
||||
appendMessage("***", "<b>Connected to the server</b>. New messages will appear below!");
|
||||
objPath.removeAttribute("style");
|
||||
}
|
||||
if (!answer.status) {
|
||||
appendMessage("***", answer.message);
|
||||
return;
|
||||
|
@ -84,16 +90,14 @@ function toAJAX()
|
|||
appendMessage(singleMsg.user, singleMsg.text);
|
||||
});
|
||||
}
|
||||
loop();
|
||||
setTimeout(loop, 2000); // 2 sec
|
||||
setTimeout(toAJAX, 2000); // 2 sec
|
||||
}
|
||||
xhttp.onerror = function() {
|
||||
if (!reqIsFailed) {
|
||||
reqIsFailed = true;
|
||||
objPath.setAttribute("style", "color: red");
|
||||
}
|
||||
loop();
|
||||
setTimeout(loop, 1000); // 1 sec
|
||||
setTimeout(toAJAX, 1000); // 1 sec
|
||||
}
|
||||
|
||||
let currentServerStatus = objCurrentServerStatus.innerText === HTML_SERVER_ONLINE_MARKER;
|
||||
|
@ -116,7 +120,14 @@ function main()
|
|||
{
|
||||
objPayload.scrollBy(0,100000);
|
||||
let objHr = document.getElementById("hr");
|
||||
if (objCurrentServerStatus.innerText === HTML_SERVER_OFFLINE_MARKER) {
|
||||
firstLoadingWithDisconnectedServer = true;
|
||||
objPath.setAttribute("style", "color: red");
|
||||
hr.innerHTML = "Now the logger is disconnected from the server, so there will be no new messages.";
|
||||
} else {
|
||||
hr.innerHTML = "<b>New messages will appear below<b>";
|
||||
}
|
||||
|
||||
toAJAX();
|
||||
}
|
||||
|
||||
|
|
|
@ -102,9 +102,15 @@ body {
|
|||
.main_header__title_airplaine {
|
||||
background: url(/svg/airplane.svg);
|
||||
background-repeat: no-repeat;
|
||||
width: 4%;
|
||||
width: 6%;
|
||||
height: 50%;
|
||||
border: none;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.main_header__title_airplaine:hover {
|
||||
width: 15%;
|
||||
height: 60%;
|
||||
}
|
||||
|
||||
.main_header__search {
|
||||
|
|
|
@ -1210,8 +1210,7 @@ void HttpServer::writeRealTimeChatPage(QTcpSocket *socket, QString &urlPath, boo
|
|||
|
||||
QString channelNameForUrl {c.first};
|
||||
channelNameForUrl.remove('#');
|
||||
QString channelLink = "/" + global::toLowerAndNoSpaces(s.first) +
|
||||
"/" + channelNameForUrl + "/" + year + "/" + month + "/" + day;
|
||||
QString channelLink = "/realtime/" + global::toLowerAndNoSpaces(s.first) + "/" + channelNameForUrl;
|
||||
replaceTag(htmlChannelLine, "CHANNEL_LINK", channelLink);
|
||||
|
||||
htmlChannelLineS += htmlChannelLine;
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
#include <queue>
|
||||
|
||||
constexpr int MSECS_TO_AUTOREMOVE_MESSAGES_FROM_BUFFER {10000}; // 10 secs
|
||||
const QString HTTP_ACTUAL_ETAG {"2021-12-29"}; // Change it if svg, css or ico was modified
|
||||
const QString HTTP_ACTUAL_ETAG {"2021-12-30"}; // Change it if svg, css or ico was modified
|
||||
|
||||
class Message : public QObject
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue