dedup award classes
parent
cc68c31ca4
commit
f18efb26f6
|
@ -5717,20 +5717,11 @@ span > img[src$="/i/hand.webp"]+img[party]:not([data-src]) {
|
|||
pat-pfp-anim .3s infinite;
|
||||
}
|
||||
|
||||
.glow .post-title, .glow a, .glow .post-meta *, .glow .user-info *, .glow .comment-text, .glow .comment-actions *, .glow {
|
||||
.glow, .glow * {
|
||||
color:lightgreen !important;
|
||||
text-shadow:1px 1px 1px darkgreen, 0 0 5px green;
|
||||
text-shadow: 1px 1px 1px darkgreen, 0 0 5px green;
|
||||
}
|
||||
.glow .score-up, .glow .active.arrow-up::before, .glow .arrow-up::after, .glow .arrow-up:hover::before {
|
||||
color: lime !important;
|
||||
}
|
||||
.glow .score-down, .glow .active.arrow-down::before, .glow .arrow-down::after, .glow .arrow-down:hover::before {
|
||||
color: lime !important;
|
||||
}
|
||||
.glow .arrow-up::before, .glow .arrow-down::before, .glow .score {
|
||||
color: lightgreen;
|
||||
}
|
||||
.glow .post-body a, .glow .comment-text a {
|
||||
.glow a {
|
||||
text-decoration: underline;
|
||||
}
|
||||
|
||||
|
@ -6685,7 +6676,7 @@ g {
|
|||
}
|
||||
|
||||
.queen:not(a):not(.ectoplasm) {
|
||||
color: hotpink;
|
||||
color: hotpink !important;
|
||||
font-weight: 700 !important;
|
||||
text-transform: lowercase !important;
|
||||
}
|
||||
|
|
|
@ -186,7 +186,7 @@ body::after {
|
|||
position: relative;
|
||||
}
|
||||
|
||||
.blood .comment-text {
|
||||
.blood {
|
||||
color: #dc3545 !important;
|
||||
font-family: 'DoubleFeature';
|
||||
}
|
||||
|
@ -528,35 +528,28 @@ body::after {
|
|||
/* Ectoplasm */
|
||||
.ectoplasm {
|
||||
text-shadow: 0 0 20px #3AE63A;
|
||||
}
|
||||
|
||||
.ectoplasm .comment-text > p, .ectoplasm .post-body, h1.ectoplasm {
|
||||
font-family: 'Creepster';
|
||||
color: #90ee90;
|
||||
color: #90ee90 !important;
|
||||
letter-spacing: 0.15em;
|
||||
}
|
||||
|
||||
.ectoplasm .candy-corn {
|
||||
.ectoplasm.candy-corn {
|
||||
--color3: rgb(140, 255, 0);
|
||||
--color2: rgb(0, 111, 0);
|
||||
--color1: rgb(131, 255, 131);
|
||||
text-shadow: none;
|
||||
}
|
||||
|
||||
.ectoplasm.blood .comment-text > p {
|
||||
.ectoplasm.blood {
|
||||
font-family: 'DoubleFeature';
|
||||
letter-spacing: initial;
|
||||
}
|
||||
|
||||
.ectoplasm .rainbow-text > p {
|
||||
.ectoplasm.rainbow-text {
|
||||
color: #90ee90 !important;
|
||||
font-weight: initial;
|
||||
}
|
||||
|
||||
.ectoplasm .comment-text, .ectoplasm .post-body, h1.ectoplasm {
|
||||
overflow:visible !important;
|
||||
}
|
||||
|
||||
/* Upsidedown */
|
||||
#canvas {
|
||||
position:absolute;
|
||||
|
|
|
@ -19,6 +19,32 @@ from files.helpers.sorting_and_time import *
|
|||
|
||||
from .saves import CommentSaveRelationship
|
||||
|
||||
def get_award_classes(obj, v, title=False):
|
||||
classes = []
|
||||
|
||||
if obj.award_count('glowie', v):
|
||||
classes.append("glow")
|
||||
if obj.rainbowed:
|
||||
classes.append("rainbow-text")
|
||||
if obj.queened:
|
||||
classes.append("queen")
|
||||
if obj.chudded:
|
||||
classes.append("text-uppercase")
|
||||
if not title: classes.append(f"chud-img chud-{obj.id_last_num}")
|
||||
if obj.sharpened:
|
||||
classes.append(f"sharpen")
|
||||
if not title: classes.append(f"chud-img sharpen-{obj.id_last_num}")
|
||||
|
||||
if IS_HOMOWEEN():
|
||||
if obj.award_count('ectoplasm', v):
|
||||
classes.append("ectoplasm")
|
||||
if obj.award_count('candy-corn', v):
|
||||
classes.append("candy-corn")
|
||||
if obj.award_count('stab', v) and isinstance(obj, Comment):
|
||||
classes.append("blood")
|
||||
|
||||
return ' '.join(classes)
|
||||
|
||||
def normalize_urls_runtime(body, v):
|
||||
if v and v.reddit != 'old.reddit.com':
|
||||
body = reddit_to_vreddit_regex.sub(rf'\1https://{v.reddit}/\2/', body)
|
||||
|
@ -461,3 +487,7 @@ class Comment(Base):
|
|||
@lazy
|
||||
def num_savers(self):
|
||||
return g.db.query(CommentSaveRelationship).filter_by(comment_id=self.id).count()
|
||||
|
||||
@lazy
|
||||
def get_award_classes(self, v):
|
||||
return get_award_classes(self, v)
|
||||
|
|
|
@ -15,7 +15,7 @@ from files.helpers.lazy import lazy
|
|||
from files.helpers.regex import *
|
||||
from files.helpers.sorting_and_time import make_age_string
|
||||
|
||||
from .comment import normalize_urls_runtime, add_options
|
||||
from .comment import normalize_urls_runtime, add_options, get_award_classes
|
||||
from .polls import *
|
||||
from .sub import *
|
||||
from .subscriptions import *
|
||||
|
@ -373,3 +373,7 @@ class Post(Base):
|
|||
@lazy
|
||||
def num_savers(self):
|
||||
return g.db.query(SaveRelationship).filter_by(post_id=self.id).count()
|
||||
|
||||
@lazy
|
||||
def get_award_classes(self, v, title=False):
|
||||
return get_award_classes(self, v, title)
|
||||
|
|
|
@ -27,7 +27,7 @@
|
|||
<div id="comment-{{c.id}}" class="comment {% if not (v and v.id == author_id) and not (v and v.admin_level) and not comment_info %}collapsed{% endif %}">
|
||||
<span class="comment-collapse-desktop" style="border-color: #{{c.author.name_color}}" data-nonce="{{g.nonce}}" data-onclick="collapse_comment('{{c.id}}')"></span>
|
||||
<div class="comment-body">
|
||||
<div id="comment-{{c.id}}-only" class="{% if c.award_count('glowie', v) %}glow{% endif %} {% if c.award_count('ectoplasm', v) %}ectoplasm{% endif %} comment-{{c.id}}-only">
|
||||
<div id="comment-{{c.id}}-only" class="comment-{{c.id}}-only">
|
||||
<div class="user-info">
|
||||
<span class="comment-collapse-icon" data-nonce="{{g.nonce}}" data-onclick="collapse_comment('{{c.id}}')"></span>
|
||||
{% if standalone and c.over_18 %}<span class="badge badge-danger">18+</span> {% endif %}
|
||||
|
@ -110,7 +110,7 @@
|
|||
{% endif %}
|
||||
<div class="comment-body">
|
||||
|
||||
<div id="{% if comment_info and comment_info.id == c.id %}context{% else %}comment-{{c.id}}-only{% endif %}" class="{% if c.unread %}unread{% endif %} {% if c.award_count('ectoplasm', v) %}ectoplasm{% endif %} {% if c.award_count('stab', v) %}blood{% endif %} {% if c.award_count('glowie', v) %}glow{% endif %} comment-{{c.id}}-only comment-anchor {% if comment_info and comment_info.id == c.id %}context{% endif %}{% if c.is_banned %} banned{% endif %}{% if c.deleted_utc %} deleted{% endif %}">
|
||||
<div id="{% if comment_info and comment_info.id == c.id %}context{% else %}comment-{{c.id}}-only{% endif %}" class="{% if c.unread %}unread{% endif %} comment-{{c.id}}-only comment-anchor {% if comment_info and comment_info.id == c.id %}context{% endif %}{% if c.is_banned %} banned{% endif %}{% if c.deleted_utc %} deleted{% endif %}">
|
||||
|
||||
<div class="user-info">
|
||||
<span class="comment-collapse-icon" data-nonce="{{g.nonce}}" data-onclick="collapse_comment('{{c.id}}')"></span>
|
||||
|
@ -243,7 +243,7 @@
|
|||
{% endif %}
|
||||
|
||||
{% set realbody = c.realbody(v) %}
|
||||
<div id="comment-text-{{c.id}}" class="comment-text mb-0 {% if c.award_count('candy-corn', v) %}candy-corn{% endif %} {% if c.chudded %}text-uppercase chud-img chud-{{c.id_last_num}}{% endif %} {% if c.rainbowed %}rainbow-text{% endif %} {% if c.queened %}queen{% endif %} {% if c.sharpened %}sharpen chud-img sharpen-{{c.id_last_num}}{% endif %}" {% if c.award_count('tilt', v) %}style="transform: rotate({{c.award_count('tilt', v)}}deg)"{% endif %}>
|
||||
<div id="comment-text-{{c.id}}" class="{{c.get_award_classes(v)}} comment-text mb-0" {% if c.award_count('tilt', v) %}style="transform: rotate({{c.award_count('tilt', v)}}deg)"{% endif %}>
|
||||
{{realbody | safe}}
|
||||
</div>
|
||||
|
||||
|
|
|
@ -79,7 +79,7 @@
|
|||
<div id="post-root" class="col-12">
|
||||
|
||||
<div class="card border-0 mt-3 {% if p.stickied %}stickied{% endif %} {% if voted==1 %}upvoted{% elif voted==-1 %} downvoted{% endif %}">
|
||||
<div id="post-{{p.id}}" class="actual-post {% if p.ghost %}ghost-post{% endif %} {% if p.is_banned %}banned{% endif %} {% if p.deleted_utc %}deleted {% endif %} d-flex flex-row-reverse flex-nowrap justify-content-end {% if p.award_count('ectoplasm', v) %}ectoplasm {% endif %}{% if p.award_count('candy-corn', v) %}candy-corn {% endif %}{% if p.award_count('glowie', v) %}glow {% endif %}{% if p.rainbowed %}rainbow-text {% endif %}{% if p.queened %}queen {% endif %}{% if p.chudded %}text-uppercase {% endif %}{% if p.sharpened %}sharpen {% endif %}">
|
||||
<div id="post-{{p.id}}" class="actual-post {% if p.ghost %}ghost-post{% endif %} {% if p.is_banned %}banned{% endif %} {% if p.deleted_utc %}deleted {% endif %} d-flex flex-row-reverse flex-nowrap justify-content-end">
|
||||
|
||||
{% if p.thumb_url and not p.deleted_utc and not p.is_image and not p.is_video and not p.is_audio and not p.embed %}
|
||||
<div class="card-header bg-transparent border-0 d-none d-md-flex flex-row flex-nowrap pl-3 p-0">
|
||||
|
@ -95,7 +95,7 @@
|
|||
|
||||
{{macros.reports(p, 'post')}}
|
||||
|
||||
<h1 id="post-title" class="card-title post-title text-left mb-md-3 {% if p.award_count('ectoplasm', v) %}ectoplasm {% endif %}{% if p.award_count('candy-corn', v) %}candy-corn {% endif %}{% if p.award_count('glowie', v) %}glow {% endif %}{% if p.rainbowed %}rainbow-text {% endif %}{% if p.queened %}queen {% endif %}{% if p.chudded %}text-uppercase {% endif %}{% if p.sharpened %}sharpen {% endif %}">
|
||||
<h1 id="post-title" class="{{p.get_award_classes(v, True)}} card-title post-title text-left mb-md-3">
|
||||
{% if p.realurl(v) and not v_forbid_deleted %}
|
||||
<a class="no-visited" {% if not v or v.newtabexternal %}target="_blank"{% endif %} rel="nofollow noopener" href="{{p.realurl(v)}}">
|
||||
{% if p.flair %}<span class="patron font-weight-bolder mr-1" style="background-color:var(--primary); font-size:12px; line-height:2">{{p.flair | safe}}</span>{% endif %}
|
||||
|
@ -143,7 +143,7 @@
|
|||
{% endif %}
|
||||
{% endif %}
|
||||
|
||||
<div id="post-text" class="{% if p.chudded %}text-uppercase chud-img chud-{{p.id_last_num}}{% endif %} {% if p.sharpened %}sharpen chud-img sharpen-{{p.id_last_num}}{% endif %} {% if p.award_count('ectoplasm', v) %}ectoplasm {% endif %}{% if p.award_count('candy-corn', v) %}candy-corn {% endif %}{% if p.award_count('glowie', v) %}glow {% endif %}{% if p.rainbowed %}rainbow-text {% endif %}{% if p.queened %}queen {% endif %}">
|
||||
<div id="post-text" class="{{p.get_award_classes(v)}}">
|
||||
{% if p.is_image %}
|
||||
<div class="row no-gutters mb-4">
|
||||
<div class="col">
|
||||
|
|
|
@ -208,7 +208,7 @@
|
|||
|
||||
{% if not v_forbid_deleted %}
|
||||
{% if p.realbody(v) %}
|
||||
<div class="d-none card rounded border {% if p.chudded %}text-uppercase chud-img chud-{{p.id_last_num}}{% endif %} {% if p.rainbowed %}rainbow-text{% endif %} {% if p.queened %}queen{% endif %} {% if p.sharpened %}sharpen{% endif %} post-preview" id="post-text-{{p.id}}">
|
||||
<div class="{{p.get_award_classes(v)}} d-none card rounded border post-preview" id="post-text-{{p.id}}">
|
||||
{{p.realbody(v) | safe}}
|
||||
</div>
|
||||
{% endif %}
|
||||
|
|
Loading…
Reference in New Issue