add prototype emoji system

This commit is contained in:
Mystikfluu
2022-08-27 18:22:00 +02:00
parent 7ceb781f55
commit 90c69ef126
7 changed files with 72 additions and 29 deletions
+7 -1
View File
@@ -28,7 +28,12 @@ function filterMentions(text) {
return text.replace(mentionregex,`<span><a href="/users/$1" class="mention">$1</a></span> `)
}
const allregex = /(```([^```]*)```)|(\n)|(~([^~]*)~)|(\*\*([^\*]*)\*\*)|(\*([^\*]*)\*)|(@[^\s]*)/gi
const emojiregex = /:([^:\s]*):/gi
function emojify(text) {
return text.replace(emojiregex,"<img class='emoji' src='/images/emoji/$1.png' alt='$1' width=20 height=20/>")
}
const allregex = /(```([^```]*)```)|(\n)|(~([^~]*)~)|(\*\*([^\*]*)\*\*)|(\*([^\*]*)\*)|(@[^\s]*)|(:([^:\s]*):)/gi
const cdblregex = /```([^```]*)```/gi
@@ -49,6 +54,7 @@ function filterPost(text){
out = newlineify(out)
out = urlify(out)
out = emojify(out)
out = filterMentions(out)
out = crossout(out)
out = boldify(out)