Start working on emotes
This commit is contained in:
parent
0f9bfe1429
commit
53138fe1f0
5 changed files with 209 additions and 2 deletions
|
|
@ -1270,6 +1270,8 @@ function formatChatMessage(data) {
|
|||
if (data.meta.forceShowName)
|
||||
skip = false;
|
||||
|
||||
data.msg = execEmotes(data.msg);
|
||||
|
||||
LASTCHATNAME = data.username;
|
||||
LASTCHATTIME = data.time;
|
||||
var div = $("<div/>");
|
||||
|
|
@ -2180,3 +2182,24 @@ function formatUserPlaylistList() {
|
|||
});
|
||||
});
|
||||
}
|
||||
|
||||
function loadEmotes(data) {
|
||||
CHANNEL.emotes = [];
|
||||
data.forEach(function (e) {
|
||||
e.regex = new RegExp(e.source, "gi");
|
||||
CHANNEL.emotes.push(e);
|
||||
});
|
||||
}
|
||||
|
||||
function execEmotes(msg) {
|
||||
if (USEROPTS.no_emotes) {
|
||||
return msg;
|
||||
}
|
||||
|
||||
CHANNEL.emotes.forEach(function (e) {
|
||||
msg = msg.replace(e.regex, '<img class="channel-emote" src="' +
|
||||
e.image + '" title="' + e.name + '">');
|
||||
});
|
||||
|
||||
return msg;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue