forked from MarseyWorld/MarseyWorld
change wholesome award to emoji award
parent
b24be481d7
commit
7fced29fba
|
@ -9,8 +9,7 @@
|
|||
position: absolute;
|
||||
}
|
||||
|
||||
.stackable-container div,
|
||||
.stackable-container img, .ricardo {
|
||||
.stackable-container div, .stackable-container img, .ricardo {
|
||||
animation-iteration-count: infinite !important;
|
||||
animation-timing-function: linear !important;
|
||||
}
|
||||
|
@ -19,7 +18,7 @@
|
|||
width: min(7vw, 50px) !important;
|
||||
}
|
||||
|
||||
.wholesome img {
|
||||
.emoji-award img {
|
||||
width: min(8vw, 60px) !important;
|
||||
}
|
||||
|
||||
|
@ -28,16 +27,14 @@
|
|||
}
|
||||
|
||||
|
||||
.emoji-award:nth-child(even), .emoji-award:nth-child(n+2):nth-child(n+3) img {
|
||||
animation-direction: alternate-reverse;
|
||||
}
|
||||
|
||||
|
||||
.wholesome:nth-child(even),
|
||||
.wholesome:nth-child(n+2):nth-child(n+3) img
|
||||
{animation-direction: alternate-reverse}
|
||||
|
||||
@keyframes sealX {
|
||||
@keyframes emojiX {
|
||||
100% {transform: translateX(98vw)}
|
||||
}
|
||||
@keyframes sealY {
|
||||
@keyframes emojiY {
|
||||
100% {transform: translateY(80vh)}
|
||||
}
|
||||
|
||||
|
@ -57,14 +54,27 @@
|
|||
.scooter:nth-child(even) {animation-direction: reverse;}
|
||||
.scooter:nth-child(even) img {transform: scaleX(-1);}
|
||||
|
||||
.wholesome {animation: sealX 8s alternate}
|
||||
.wholesome img {animation: sealY 9s alternate}
|
||||
.train, .scooter {animation: train 12s;}
|
||||
.emoji-award {
|
||||
animation: emojiX 8s alternate;
|
||||
}
|
||||
.emoji-award img {
|
||||
animation: emojiY 9s alternate;
|
||||
}
|
||||
|
||||
.train, .scooter {
|
||||
animation: train 12s;
|
||||
}
|
||||
|
||||
@media (max-width: 768px) {
|
||||
.wholesome {animation: sealX 6s alternate}
|
||||
.wholesome img {animation: sealY 7s alternate}
|
||||
.train, .scooter {animation: train 6s;}
|
||||
.emoji-award {
|
||||
animation: emojiX 6s alternate;
|
||||
}
|
||||
.emoji-award img {
|
||||
animation: emojiY 7s alternate;
|
||||
}
|
||||
.train, .scooter {
|
||||
animation: train 6s;
|
||||
}
|
||||
}
|
||||
|
||||
/*confetti*/
|
||||
|
|
|
@ -137,6 +137,11 @@ function pick(kind, price, coins, marseybux) {
|
|||
document.getElementById('note').placeholder = "Insert new username here, or leave empty to add 1 day to the duration of the current username.";
|
||||
document.getElementById('note').maxLength = 25;
|
||||
}
|
||||
else if (kind == "emoji") {
|
||||
document.getElementById('notelabel').innerHTML = "Emoji name:";
|
||||
document.getElementById('note').placeholder = "Insert one site emoji here.";
|
||||
document.getElementById('note').maxLength = 33;
|
||||
}
|
||||
else {
|
||||
document.getElementById('notelabel').innerHTML = "Note (optional):";
|
||||
document.getElementById('note').placeholder = "Note to include in award notification";
|
||||
|
|
|
@ -20,6 +20,7 @@ class AwardRelationship(Base):
|
|||
awarded_utc = Column(Integer)
|
||||
created_utc = Column(Integer)
|
||||
price_paid = Column(Integer, default = 0, nullable=False)
|
||||
note = Column(String)
|
||||
|
||||
user = relationship("User", primaryjoin="AwardRelationship.user_id==User.id", back_populates="awards")
|
||||
post = relationship("Post", primaryjoin="AwardRelationship.post_id==Post.id", back_populates="awards")
|
||||
|
|
|
@ -314,6 +314,11 @@ class Comment(Base):
|
|||
def award_count(self, kind, v):
|
||||
return len([x for x in self.awards if x.kind == kind])
|
||||
|
||||
@property
|
||||
@lazy
|
||||
def emoji_award_emojis(self):
|
||||
return [x.note for x in self.awards if x.kind == "emoji"]
|
||||
|
||||
@property
|
||||
@lazy
|
||||
def json(self):
|
||||
|
|
|
@ -262,6 +262,11 @@ class Post(Base):
|
|||
return 4
|
||||
return num
|
||||
|
||||
@property
|
||||
@lazy
|
||||
def emoji_award_emojis(self):
|
||||
return [x.note for x in self.awards if x.kind == "emoji"]
|
||||
|
||||
@lazy
|
||||
def realurl(self, v):
|
||||
url = self.url
|
||||
|
|
|
@ -211,19 +211,6 @@ AWARDS = {
|
|||
"enabled": IS_HOMOWEEN(),
|
||||
"positive": True,
|
||||
},
|
||||
"pumpkin": {
|
||||
"kind": "pumpkin",
|
||||
"title": "Pumpkin",
|
||||
"description": "",
|
||||
"icon": "fas fa-jack-o-lantern",
|
||||
"color": "text-orange",
|
||||
"price": 200,
|
||||
"deflectable": False,
|
||||
"cosmetic": True,
|
||||
"ghost": True,
|
||||
"enabled": IS_HOMOWEEN(),
|
||||
"positive": True,
|
||||
},
|
||||
"candy-corn": {
|
||||
"kind": "candy-corn",
|
||||
"title": "Candy Corn",
|
||||
|
@ -476,10 +463,10 @@ AWARDS = {
|
|||
"enabled": True,
|
||||
"positive": True,
|
||||
},
|
||||
"wholesome": {
|
||||
"kind": "wholesome",
|
||||
"title": "Wholesome",
|
||||
"description": "Summons a wholesome marsey on the post.",
|
||||
"emoji": {
|
||||
"kind": "emoji",
|
||||
"title": "Emoji",
|
||||
"description": "Summons a bouncing emoji on the post.",
|
||||
"icon": "fas fa-smile-beam",
|
||||
"color": "text-yellow",
|
||||
"price": 300,
|
||||
|
|
|
@ -177,7 +177,8 @@ def award_thing(v, thing_type, id):
|
|||
|
||||
g.db.add(award)
|
||||
|
||||
note = request.values.get("note", "").strip()
|
||||
note = request.values.get("note", "").strip()[:200]
|
||||
award.note = note
|
||||
|
||||
safe_username = f"@{thing.author_name} is"
|
||||
|
||||
|
@ -554,7 +555,13 @@ def award_thing(v, thing_type, id):
|
|||
if thing_type == 'comment' and (not thing.author.deflector or v == thing.author):
|
||||
thing.rainbowed = True
|
||||
g.db.add(thing)
|
||||
elif kind == "spider":
|
||||
elif kind == "emoji":
|
||||
award.note = award.note.strip(":").lower()
|
||||
emoji = g.db.query(Emoji).filter_by(name=award.note).one_or_none()
|
||||
if not emoji:
|
||||
abort(404, f'an Emoji with the name "{award.note}" was not found!')
|
||||
elif IS_HOMOWEEN():
|
||||
if kind == "spider":
|
||||
if author.spider: author.spider += 86400
|
||||
else: author.spider = int(time.time()) + 86400
|
||||
badge_grant(user=author, badge_id=179, notify=False)
|
||||
|
|
|
@ -9,13 +9,16 @@
|
|||
</div>
|
||||
{% endmacro %}
|
||||
|
||||
{% if p.award_count("wholesome", v) %}
|
||||
{% if IS_HOMOWEEN() %}
|
||||
{% set wholesome = '/e/marseypumpkin.webp' %}
|
||||
{% else %}
|
||||
{% set wholesome = '/e/marseywholesome.webp' %}
|
||||
{% endif %}
|
||||
{{stackable_award('wholesome', wholesome, ':#marseywholesome:')}}
|
||||
{% if p.award_count("emoji", v) %}
|
||||
<div class="stackable-container">
|
||||
{% for emoji in p.emoji_award_emojis %}
|
||||
{% set src = '/e/' + emoji + '.webp' %}
|
||||
{% set alt = ':#' + emoji + ':' %}
|
||||
<div class="emoji-award">
|
||||
<img loading="lazy" alt="{{alt}}" src="{{src}}">
|
||||
</div>
|
||||
{% endfor %}
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
{% if p.award_count("train", v) %}
|
||||
|
|
|
@ -116,7 +116,11 @@
|
|||
<span class="comment-collapse-icon" data-nonce="{{g.nonce}}" data-onclick="collapse_comment('{{c.id}}')"></span>
|
||||
|
||||
{% for a in c.awards %}
|
||||
{% if a.kind == "emoji" %}
|
||||
<img alt="{{a.title}} Award given by @{{a.user.username}}" data-bs-toggle="tooltip" loading="lazy" src="{{SITE_FULL_IMAGES}}/e/{{a.note}}.webp" data-bs-toggle="tooltip" data-bs-placement="bottom" title="{{a.title}} Award given by @{{a.user.username}}" width="20px">
|
||||
{% else %}
|
||||
<i class="{{a.class_list}} px-1" data-bs-toggle="tooltip" data-bs-placement="bottom" title="{{a.title}} Award given by @{{a.user.username}}"></i>
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
|
||||
{% if c.parent_post %}
|
||||
|
|
|
@ -30,7 +30,11 @@
|
|||
{% endif %}
|
||||
|
||||
{% for a in p.awards %}
|
||||
{% if a.kind == "emoji" %}
|
||||
<img alt="{{a.title}} Award given by @{{a.user.username}}" data-bs-toggle="tooltip" loading="lazy" src="{{SITE_FULL_IMAGES}}/e/{{a.note}}.webp" data-bs-toggle="tooltip" data-bs-placement="bottom" title="{{a.title}} Award given by @{{a.user.username}}" width="20px">
|
||||
{% else %}
|
||||
<i class="{{a.class_list}} px-1" data-bs-toggle="tooltip" data-bs-placement="bottom" title="{{a.title}} Award given by @{{a.user.username}}"></i>
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
|
||||
{% if v and v.admin_level >= PERMS['USER_SHADOWBAN'] and p.author.shadowbanned %}
|
||||
|
|
|
@ -0,0 +1,4 @@
|
|||
alter table award_relationships add column note varchar(200);
|
||||
|
||||
update award_relationships set kind='emoji', note='marseywholesome' where kind='wholesome';
|
||||
update award_relationships set kind='emoji', note='marseypumpkin' where kind='pumpkin';
|
Loading…
Reference in New Issue