Finished up with toke logic.

This commit is contained in:
rainbow napkin 2024-12-13 22:07:00 -05:00
parent d85f906a69
commit ffd2094f16
5 changed files with 60 additions and 14 deletions

View file

@ -80,6 +80,7 @@ class chatPostprocessor{
handleChatType(){
if(this.rawData.type == "whisper"){
//add whisper class
this.chatBody.classList.add('whisper');
}else if(this.rawData.type == "announcement"){
//Squash the high-level
@ -88,11 +89,21 @@ class chatPostprocessor{
//Get the username and make it into an announcement title (little hacky but this *IS* postprocessing)
const userNode = this.chatEntry.querySelector('.chat-entry-username');
userNode.innerHTML = `${userNode.innerHTML.slice(0,-2)} Announcement`;
//Add/remove relevant classes
userNode.classList.remove('chat-entry-username');
userNode.classList.add('announcement-title');
this.chatBody.classList.add('announcement-body');
this.chatEntry.classList.add('announcement');
}else if(this.rawData.type == "toke" || this.rawData.type == "tokewhisper"){
//Squash the high-level
this.chatEntry.querySelector('.high-level').remove();
//remove the username
this.chatEntry.querySelector('.chat-entry-username').remove();
//Add toke/tokewhisper class
this.chatEntry.classList.add(this.rawData.type);
}
}
}