mirror of https://notabug.org/acetone/ircabot.git
real time mode upgrade
parent
571322c759
commit
fc81fa6fb9
|
@ -7,8 +7,10 @@ let objOnlineList = document.getElementById("onlineList");
|
||||||
let lastMessageId = document.getElementById("LMId").innerText;
|
let lastMessageId = document.getElementById("LMId").innerText;
|
||||||
let reqIsFailed = false;
|
let reqIsFailed = false;
|
||||||
let firstLoadingWithDisconnectedServer = false;
|
let firstLoadingWithDisconnectedServer = false;
|
||||||
|
let unreadedCount = 0;
|
||||||
|
|
||||||
const ajaxUrl = document.getElementById("ajaxPath").innerText;
|
const ajaxUrl = document.getElementById("ajaxPath").innerText;
|
||||||
|
const originalTitle = document.title;
|
||||||
const audio = new Audio('/newmessage.mp3');
|
const audio = new Audio('/newmessage.mp3');
|
||||||
const HTML_SERVER_ONLINE_MARKER = "✅";
|
const HTML_SERVER_ONLINE_MARKER = "✅";
|
||||||
const HTML_SERVER_OFFLINE_MARKER = "❌";
|
const HTML_SERVER_OFFLINE_MARKER = "❌";
|
||||||
|
@ -29,6 +31,8 @@ function appendMessage(nick /* if == "***", then system message */, message)
|
||||||
nicknameContainer.innerText = nick;
|
nicknameContainer.innerText = nick;
|
||||||
nicknameContainer.setAttribute("style", "color: #1b4af5");
|
nicknameContainer.setAttribute("style", "color: #1b4af5");
|
||||||
if (document.hidden) {
|
if (document.hidden) {
|
||||||
|
unreadedCount++;
|
||||||
|
document.title = '(' + unreadedCount + ') ' + originalTitle;
|
||||||
audio.play();
|
audio.play();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -111,6 +115,10 @@ function toAJAX()
|
||||||
|
|
||||||
function loop()
|
function loop()
|
||||||
{
|
{
|
||||||
|
if (!document.hidden && unreadedCount>0) {
|
||||||
|
unreadedCount = 0;
|
||||||
|
document.title = originalTitle;
|
||||||
|
}
|
||||||
let dots = objPath.innerText;
|
let dots = objPath.innerText;
|
||||||
if (dots === "...") {
|
if (dots === "...") {
|
||||||
dots = ""
|
dots = ""
|
||||||
|
|
|
@ -208,6 +208,8 @@ void IrcClient::toTrigger(const QString& channel, const QString &nickname, const
|
||||||
void IrcClient::toChatLog(QString channel, const QString &nick, const QString &message)
|
void IrcClient::toChatLog(QString channel, const QString &nick, const QString &message)
|
||||||
{
|
{
|
||||||
channel.remove('#');
|
channel.remove('#');
|
||||||
|
emit newMessage(m_connectionData.displayName, channel, nick, message);
|
||||||
|
|
||||||
QDir dir(m_connectionData.logFolderPath);
|
QDir dir(m_connectionData.logFolderPath);
|
||||||
if (not dir.exists(channel)) {
|
if (not dir.exists(channel)) {
|
||||||
dir.mkdir(channel);
|
dir.mkdir(channel);
|
||||||
|
@ -251,7 +253,6 @@ void IrcClient::toChatLog(QString channel, const QString &nick, const QString &m
|
||||||
|
|
||||||
QString logMessage {"["+nick+"] " + message + '\n'};
|
QString logMessage {"["+nick+"] " + message + '\n'};
|
||||||
file.write(logMessage.toUtf8());
|
file.write(logMessage.toUtf8());
|
||||||
emit newMessage(m_connectionData.displayName, channel, nick, message);
|
|
||||||
file.close();
|
file.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue