Compare commits

..

2 Commits

Author SHA1 Message Date
David Siaw aebdc801d8
Merge 868d3a4b68 into 4c437efb5d 2024-05-20 15:14:07 +00:00
Calvin Montgomery 4c437efb5d Fix #981 2024-04-18 20:08:59 -07:00
1 changed files with 11 additions and 5 deletions

View File

@ -2702,8 +2702,7 @@ function execEmotes(msg) {
} }
CHANNEL.emotes.forEach(function (e) { CHANNEL.emotes.forEach(function (e) {
msg = msg.replace(e.regex, '$1<img class="channel-emote" src="' + msg = msg.replace(e.regex, '$1' + emoteToImg(e).outerHTML);
e.image + '" title="' + e.name + '">');
}); });
return msg; return msg;
@ -2711,13 +2710,12 @@ function execEmotes(msg) {
function execEmotesEfficient(msg) { function execEmotesEfficient(msg) {
CHANNEL.badEmotes.forEach(function (e) { CHANNEL.badEmotes.forEach(function (e) {
msg = msg.replace(e.regex, '$1<img class="channel-emote" src="' + msg = msg.replace(e.regex, '$1' + emoteToImg(e).outerHTML);
e.image + '" title="' + e.name + '">');
}); });
msg = msg.replace(/[^\s]+/g, function (m) { msg = msg.replace(/[^\s]+/g, function (m) {
if (CHANNEL.emoteMap.hasOwnProperty(m)) { if (CHANNEL.emoteMap.hasOwnProperty(m)) {
var e = CHANNEL.emoteMap[m]; var e = CHANNEL.emoteMap[m];
return '<img class="channel-emote" src="' + e.image + '" title="' + e.name + '">'; return emoteToImg(e).outerHTML;
} else { } else {
return m; return m;
} }
@ -2725,6 +2723,14 @@ function execEmotesEfficient(msg) {
return msg; return msg;
} }
function emoteToImg(e) {
var img = document.createElement('img');
img.className = 'channel-emote';
img.title = e.name;
img.src = e.image;
return img;
}
function initPm(user) { function initPm(user) {
if ($("#pm-" + user).length > 0) { if ($("#pm-" + user).length > 0) {
return $("#pm-" + user); return $("#pm-" + user);