Added site-wide emote support.
This commit is contained in:
parent
41d0302ded
commit
97717b525c
11 changed files with 122 additions and 22 deletions
|
|
@ -1,5 +1,6 @@
|
|||
class chatPostprocessor{
|
||||
constructor(){
|
||||
constructor(client){
|
||||
this.client = client;
|
||||
}
|
||||
|
||||
preprocess(chatEntry, rawData){
|
||||
|
|
@ -91,6 +92,15 @@ class chatPostprocessor{
|
|||
img.classList.add('chat-img');
|
||||
img.src = wordObj.link;
|
||||
|
||||
//Look for an emote by link since emotes are tx'd as bare links
|
||||
const emote = this.client.chatBox.commandPreprocessor.getEmoteByLink(wordObj.link);
|
||||
|
||||
//If this is a known emote
|
||||
if(emote != null){
|
||||
//Set the hover text to the emote's name
|
||||
img.title = `[${emote.name}]`;
|
||||
}
|
||||
|
||||
//Append node to chatBody
|
||||
injectNode(wordObj, img);
|
||||
}else if(wordObj.type == 'video'){
|
||||
|
|
@ -103,6 +113,15 @@ class chatPostprocessor{
|
|||
vid.loop = true;
|
||||
vid.muted = true;
|
||||
|
||||
//Look for an emote by link since emotes are tx'd as bare links
|
||||
const emote = this.client.chatBox.commandPreprocessor.getEmoteByLink(wordObj.link);
|
||||
|
||||
//If this is a known emote
|
||||
if(emote != null){
|
||||
//Set the hover text to the emote's name
|
||||
vid.title = `[${emote.name}]`;
|
||||
}
|
||||
|
||||
injectNode(wordObj, vid);
|
||||
}
|
||||
});
|
||||
|
|
@ -216,7 +235,7 @@ class chatPostprocessor{
|
|||
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"){
|
||||
}else if(this.rawData.type == "toke"){
|
||||
//Squash the high-level
|
||||
this.chatEntry.querySelector('.high-level').remove();
|
||||
|
||||
|
|
@ -224,7 +243,16 @@ class chatPostprocessor{
|
|||
this.chatEntry.querySelector('.chat-entry-username').remove();
|
||||
|
||||
//Add toke/tokewhisper class
|
||||
this.chatBody.classList.add(this.rawData.type);
|
||||
this.chatBody.classList.add("toke");
|
||||
}else if(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.chatBody.classList.add("tokewhisper","serverwhisper");
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue