mirror of
https://github.com/chylex/Discord-History-Tracker.git
synced 2025-04-13 15:27:16 +03:00
Add support for animated emoji (w/ option to turn them off) in the viewer
This commit is contained in:
parent
8153166840
commit
cf8a0dd0da
@ -8,6 +8,8 @@ enableImagePreviews
|
||||
_enableImagePreviews
|
||||
enableFormatting
|
||||
_enableFormatting
|
||||
enableAnimatedEmoji
|
||||
_enableAnimatedEmoji
|
||||
DHT_LOADED
|
||||
DHT_EMBEDDED
|
||||
meta
|
||||
|
@ -15,7 +15,8 @@ var DISCORD = (function(){
|
||||
mentionRole: /<@&(\d+?)>/g,
|
||||
mentionUser: /<@!?(\d+?)>/g,
|
||||
mentionChannel: /<#(\d+?)>/g,
|
||||
customEmoji: /<:([^:]+):(\d+?)>/g
|
||||
customEmojiStatic: /<:([^:]+):(\d+?)>/g,
|
||||
customEmojiAnimated: /<a:([^:]+):(\d+?)>/g
|
||||
};
|
||||
|
||||
var isImageAttachment = function(attachment){
|
||||
@ -119,11 +120,14 @@ var DISCORD = (function(){
|
||||
.replace(REGEX.formatStrike, "<s>$1</s>");
|
||||
}
|
||||
|
||||
var animatedEmojiExtension = STATE.settings.enableAnimatedEmoji ? "gif" : "png";
|
||||
|
||||
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.customEmoji, "<img src='https://cdn.discordapp.com/emojis/$2.png' alt=':$1:' title=':$1:' class='emoji'>");
|
||||
.replace(REGEX.customEmojiStatic, "<img src='https://cdn.discordapp.com/emojis/$2.png' alt=':$1:' title=':$1:' class='emoji'>")
|
||||
.replace(REGEX.customEmojiAnimated, "<img src='https://cdn.discordapp.com/emojis/$2."+animatedEmojiExtension+"' alt=':$1:' title=':$1:' class='emoji'>");
|
||||
|
||||
return "<p>"+processed+"</p>";
|
||||
}
|
||||
|
@ -34,7 +34,8 @@ var GUI = (function(){
|
||||
var showSettingsModal = function(){
|
||||
showModal(560, `
|
||||
<label><input id='dht-cfg-imgpreviews' type='checkbox'> Image Previews</label><br>
|
||||
<label><input id='dht-cfg-formatting' type='checkbox'> Message Formatting</label><br>`);
|
||||
<label><input id='dht-cfg-formatting' type='checkbox'> Message Formatting</label><br>
|
||||
<label><input id='dht-cfg-animemoji' type='checkbox'> Animated Emoji</label><br>`);
|
||||
|
||||
var setupCheckBox = function(id, settingName){
|
||||
var ele = DOM.id(id);
|
||||
@ -44,6 +45,7 @@ var GUI = (function(){
|
||||
|
||||
setupCheckBox("dht-cfg-imgpreviews", "enableImagePreviews");
|
||||
setupCheckBox("dht-cfg-formatting", "enableFormatting");
|
||||
setupCheckBox("dht-cfg-animemoji", "enableAnimatedEmoji");
|
||||
};
|
||||
|
||||
var showInfoModal = function(){
|
||||
|
@ -256,6 +256,7 @@ var STATE = (function(){
|
||||
|
||||
defineSettingProperty("enableImagePreviews", true);
|
||||
defineSettingProperty("enableFormatting", true);
|
||||
defineSettingProperty("enableAnimatedEmoji", true);
|
||||
|
||||
// End
|
||||
return ROOT;
|
||||
|
Loading…
x
Reference in New Issue
Block a user