fix comment previews for pat emojis (#233)
This commit is contained in:
parent
1bf86d2288
commit
5beb5a2411
2 changed files with 13 additions and 16 deletions
|
@ -4468,7 +4468,7 @@ blockquote p {
|
|||
margin: 1.75rem auto !important;
|
||||
}
|
||||
}
|
||||
.in-comment-image:not(img[src*="/uid/"]):not(img[src*="/pp/"]), .preview img, .img:not(img[src*="/uid/"]):not(img[src*="/pp/"]), img[alt^=":not(img[src*="/pp/"]), .img:not(img[src*="/uid/"]):not(img[src*="/pp/"]), img[alt^=":not(.pat-hand) {
|
||||
max-height: 150px !important;
|
||||
max-width: 100% !important;
|
||||
border-radius: 0.2rem !important;
|
||||
|
@ -4601,7 +4601,7 @@ img[pat] {
|
|||
text-align: center;
|
||||
object-fit: cover;
|
||||
}
|
||||
img[pat][src^="/pp/"] {
|
||||
img[pat][src^="/pp/"], img[pat][src$="/pic"] {
|
||||
border-radius: 50%;
|
||||
}
|
||||
.pat-hand {
|
||||
|
|
|
@ -4,23 +4,20 @@ function markdown(first, second) {
|
|||
var input = document.getElementById(first).value;
|
||||
input = input.replace(/\|\|(.*?)\|\|/g, '<span class="spoiler">$1</span>')
|
||||
|
||||
var emojis = Array.from(input.matchAll(/:([#!A-Za-z0-9]{1,30}?):/gi))
|
||||
var emojis = Array.from(input.matchAll(/:([^\s]{1,31}):/gi))
|
||||
if(emojis != null){
|
||||
for(i = 0; i < emojis.length; i++){
|
||||
var emoji = emojis[i][0];
|
||||
if (emoji.includes('marseyrandom')) continue
|
||||
var remoji = emoji.replace(/:/g,'').toLowerCase();
|
||||
if (remoji.startsWith("!#") || remoji.startsWith("#!"))
|
||||
{
|
||||
input = input.replace(emoji, "<img class='emoji-lg mirrored' src='/e/" + remoji.substring(2) + ".webp'>")
|
||||
} else if (remoji.startsWith("#"))
|
||||
{
|
||||
input = input.replace(emoji, "<img class='emoji-lg' src='/e/" + remoji.substring(1) + ".webp'>")
|
||||
} else if (remoji.startsWith("!"))
|
||||
{
|
||||
input = input.replace(emoji, "<img height=30 class='emoji mirrored' src='/e/" + remoji.substring(1) + ".webp'>")
|
||||
var old = emojis[i][0];
|
||||
if (old.includes('marseyrandom')) continue
|
||||
var emoji = old.replace(/[:!@#]/g,'').toLowerCase();
|
||||
var mirroredClass = old.indexOf('!') == -1 ? '' : 'mirrored';
|
||||
var emojiClass = old.indexOf('#') == -1 ? 'emoji' : 'emoji-lg';
|
||||
if (emoji.endsWith('pat')) {
|
||||
emoji = emoji.substr(0, emoji.length - 3);
|
||||
var url = old.indexOf('@') != -1 ? `/@${emoji}/pic` : `/e/${emoji}.webp`;
|
||||
input = input.replace(old, `<span class="pat-container ${mirroredClass}"><img class="pat-hand" src="/assets/images/hand.webp"><img pat class="${emojiClass}" src="${url}"></span>`);
|
||||
} else {
|
||||
input = input.replace(emoji, "<img height=30 class='emoji' src='/e/" + remoji + ".webp'>")
|
||||
input = input.replace(old, `<img class="${emojiClass} ${mirroredClass}" src="/e/${emoji}.webp">`);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue