1
0
mirror of https://github.com/chylex/Discord-History-Tracker.git synced 2025-04-10 17:15:43 +02:00

Add support for custom emoji in the viewer

This commit is contained in:
chylex 2019-09-06 05:52:16 +02:00
parent 4c9539d98a
commit 889403bc0d
2 changed files with 12 additions and 2 deletions

View File

@ -14,7 +14,8 @@ var DISCORD = (function(){
specialUnescaped: /([*_~\\])/g,
mentionRole: /<@&(\d+?)>/g,
mentionUser: /<@!?(\d+?)>/g,
mentionChannel: /<#(\d+?)>/g
mentionChannel: /<#(\d+?)>/g,
customEmoji: /<:([^:]+):(\d+?)>/g
};
var isImageAttachment = function(attachment){
@ -121,7 +122,8 @@ var DISCORD = (function(){
processed = processed
.replace(REGEX.formatUrl, "<a href='$1' target='_blank' rel='noreferrer'>$1</a>")
.replace(REGEX.mentionChannel, (full, match) => "<span class='link mention-chat'>#"+STATE.getChannelName(match)+"</span>")
.replace(REGEX.mentionUser, (full, match) => "<span class='link mention-user'>@"+STATE.getUserName(match)+"</span>");
.replace(REGEX.mentionUser, (full, match) => "<span class='link mention-user'>@"+STATE.getUserName(match)+"</span>")
.replace(REGEX.customEmoji, "<img src='https://cdn.discordapp.com/emojis/$2.png' alt=':$1:' title=':$1:' class='emoji'>");
return "<p>"+processed+"</p>";
}

View File

@ -119,3 +119,11 @@
margin-top: 6px;
padding: 7px;
}
.message .emoji {
width: 22px;
height: 22px;
margin: 0 1px;
vertical-align: -30%;
object-fit: contain;
}