Add support for CLEARCHAT clearing the entire chat

pull/317/head
ElementalAlchemist 2 years ago committed by Mike Lang
parent 832a0264bb
commit 0cad481cea

@ -1593,9 +1593,16 @@ function renderChatLog() {
removedMessageElem.classList.add("chat-replay-message-cleared");
}
} else if (chatMessage.message.command === "CLEARCHAT") {
const removedSender = chatMessage.message.params[1];
for (const childNode of document.getElementById("chat-replay").children) {
if (childNode.dataset.sender === removedSender) {
if (chatMessage.message.params.length > 1) {
const removedSender = chatMessage.message.params[1];
for (const childNode of document.getElementById("chat-replay").children) {
if (childNode.dataset.sender === removedSender) {
childNode.classList.add("chat-replay-message-cleared");
}
}
} else {
// Without a target parameter, the CLEARCHAT clears all messages in the entire chat.
for (const childNode of document.getElementById("chat-replay").children) {
childNode.classList.add("chat-replay-message-cleared");
}
}

@ -320,9 +320,15 @@ function handleChatMessage(chatReplayContainer, chatMessage) {
targetMessageElem.classList.add("chat-replay-message-cleared");
}
} else if (chatMessage.message.command === "CLEARCHAT") {
const removedSender = chatMessage.message.params[1];
for (const messageElem of chatReplayContainer.children) {
if (messageElem.dataset.sender === removedSender) {
if (chatMessage.message.params.length > 1) {
const removedSender = chatMessage.message.params[1];
for (const messageElem of chatReplayContainer.children) {
if (messageElem.dataset.sender === removedSender) {
messageElem.classList.add("chat-replay-message-cleared");
}
}
} else {
for (const messageElem of chatReplayContainer.children) {
messageElem.classList.add("chat-replay-message-cleared");
}
}

Loading…
Cancel
Save