Added join/leave messages a-la fore.st
This commit is contained in:
parent
a0f680c02a
commit
d0ef60dd4f
6 changed files with 119 additions and 10 deletions
|
|
@ -696,15 +696,27 @@ class chatPostprocessor{
|
|||
|
||||
//Add toke/tokewhisper class
|
||||
this.chatBody.classList.add("toke");
|
||||
}else if(this.rawData.type == "tokewhisper"){
|
||||
}else if(this.rawData.type == "tokewhisper" || this.rawData.type == "serverwhisper"){
|
||||
//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.chatBody.classList.add("tokewhisper","serverwhisper");
|
||||
//Add serverwhisper class
|
||||
this.chatBody.classList.add("serverwhisper");
|
||||
|
||||
//If this is a toke whisper
|
||||
if(this.rawData.type == "tokewhisper"){
|
||||
//Add tokewhisper class
|
||||
this.chatBody.classList.add("tokewhisper");
|
||||
}
|
||||
|
||||
//Set variable to hold chatEntry so the one after doesnt get clobbered by the killServerWhisper function
|
||||
const currentWhisper = this.chatEntry;
|
||||
|
||||
//Kill server whispers after 10s, just like fore.st XP
|
||||
setTimeout(()=>{this.killServerWhisper(currentWhisper)}, 10000);
|
||||
}else if(this.rawData.type == "spoiler"){
|
||||
//Set whole-body spoiler
|
||||
this.chatBody.classList.add("spoiler");
|
||||
|
|
@ -719,4 +731,11 @@ class chatPostprocessor{
|
|||
this.chatBody.classList.add("italics");
|
||||
}
|
||||
}
|
||||
|
||||
killServerWhisper(whisper, delay = 500){
|
||||
//Drop max height to 0 to trigger the fancy animation
|
||||
whisper.style.maxHeight = 0;
|
||||
//Remove whisper after animation is done
|
||||
setTimeout(()=>{whisper.remove()}, delay);
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue