Really quick. Code is straight forward. Will leave it below.
https://chrome.google.com/webstore/d...lchpmebcmmieii
Code:
class ZChat {
constructor(tickRate, keywords) {
this.tickRate = tickRate;
this.keywords = keywords;
this.style = 'style="height: 18px; width: 18px;"';
this.kappa = 'https://freestylersworld.com/images/smilies/1.png';
}
scanSubstrs() {
let daveZChat = document.getElementById('zchat');
this.keywords.forEach((keyword) => {
if (daveZChat.innerHTML.indexOf(keyword) > -1) {
daveZChat.innerHTML = daveZChat.innerHTML
.replace(keyword, `<img ${this.style} src="${this.kappa}">`);
}
});
}
ZChatLoop() {
setInterval(() => {
this.scanSubstrs();
}, this.tickRate);
}
}
Shoutbox = new ZChat(100, [':K', ':k', 'kappa', 'Kappa']);
Shoutbox.ZChatLoop();
Bugs
- Text after a gets replaced. Will fix it when I'm done with more important stuff. ( Fixed, but Google needs to publish the changes. Takes about an hour )