Add pixelated image rendering to Classic emojis

pull/207/head
transbitch 2023-08-29 08:55:27 -04:00
parent 25a33b5538
commit 07448a18f4
2 changed files with 9 additions and 2 deletions

View File

@ -5517,8 +5517,7 @@ input[type=radio] ~ .custom-control-label::before {
height: 150px;
width: 150px;
}
.emj, .emoji, .bigemoji, .emoji-md, .emoji-lg, img[alt^=":"]
{
.emj, .emoji, .bigemoji, .emoji-md, .emoji-lg, img[alt^=":"] {
max-width: 150px !important;
max-height: 150px !important;
max-width: min(150px,25vw) !important;
@ -5526,6 +5525,9 @@ input[type=radio] ~ .custom-control-label::before {
display: inline-block;
object-fit: contain;
}
.emoji, .emoji-lg, img[data-kind=Classic] {
image-rendering: pixelated;
}
span[data-bs-toggle], .pat-preview {
position: relative;

View File

@ -83,6 +83,7 @@ def allowed_attributes(tag, name, value):
if name in {'alt','title'}: return True
if name == 'class' and value == 'img': return True
if name == 'data-user-submitted' and not value: return True
if name == 'data-kind' and value in EMOJI_KINDS: return True
if tag == 'lite-youtube':
if name == 'params' and value.startswith('autoplay=1&modestbranding=1'): return True
@ -338,6 +339,10 @@ def old_render_emoji(html, regexp, golden, emojis_used, b=False, is_title=False)
if(is_loved):
modifier_html = f'{modifier_html}{loved_html}'
kind = g.db.query(Emoji.kind).filter(Emoji.name==emoji).one_or_none()
if kind:
attrs += ' data-kind="' + kind[0].replace('"', '') + '"'
if (is_patted and emoji != 'marseyunpettable') or is_talking or is_genocided or is_loved:
if path.isfile(f"files/assets/images/emojis/{emoji}.webp"):
emoji_html = f'<span alt=":{old}:" data-bs-toggle="tooltip" title=":{old}:"{genocide_attr}>{modifier_html}{emoji_partial_pat.format(old, f"{SITE_FULL_IMAGES}/e/{emoji}.webp", attrs)}</span>'