This commit is contained in:
Aevann1 2021-10-05 23:07:43 +02:00
parent 6206f7bf72
commit c1cb78fdf8
3 changed files with 22 additions and 13 deletions

View file

@ -188,15 +188,19 @@ function markdown() {
var emojis = Array.from(input.matchAll(/:(.{1,30}?):/gi))
if(emojis != null){
for(i = 0; i < emojis.length; i++){
input = input.replace(emojis[i][0], "<img height=30 src='/assets/images/emojis/" + emojis[i][1] + ".webp'>")
var emoji = emojis[i][0]
if (emoji.startswith("!"))
{
style = 'style="transform: scaleX(-1)"';
var remoji = emoji.substring(1);
} else {
style = "";
var remoji = emoji;
}
input = input.replace(emoji, "<img height=30 src='/assets/images/emojis/" + remoji + ".webp' " + style + ">")
}
}
emojis = Array.from(input.matchAll(/!(.{1,30}?)!/gi))
if(emojis != null){
for(i = 0; i < emojis.length; i++){
input = input.replace(emojis[i][0], "<img height=30 style='transform: scaleX(-1)' src='/assets/images/emojis/" + emojis[i][1] + ".webp'>")
}
}
document.getElementById('preview').innerHTML = marked(input)