add poorcel mode

remotes/1693045480750635534/spooky-22
Aevann1 2022-06-27 04:14:53 +02:00
parent 0485f52cc3
commit b1ef8e4c62
11 changed files with 89 additions and 82 deletions

View File

@ -327,7 +327,8 @@ class Comment(Base):
return data
@lazy
def award_count(self, kind):
def award_count(self, kind, v):
if v and v.poorcel: return 0
return len([x for x in self.awards if x.kind == kind])
@property
@ -435,7 +436,7 @@ class Comment(Base):
if not self.total_choice_voted(v): body += ' d-none'
body += f'"> - <a href="/votes?link=t3_{c.id}"><span id="choice-{c.id}">{c.upvotes}</span> votes</a></span></label></div>'
if self.author.sig_html and (self.author_id == MOOSE_ID or (not self.ghost and not (v and v.sigs_disabled))):
if self.author.sig_html and (self.author_id == MOOSE_ID or (not self.ghost and not (v and (v.sigs_disabled or v.poorcel)))):
body += f"<hr>{self.author.sig_html}"
return body

View File

@ -366,7 +366,8 @@ class Submission(Base):
return data
@lazy
def award_count(self, kind):
def award_count(self, kind, v):
if v and v.poorcel: return 0
return len([x for x in self.awards if x.kind == kind])
@lazy
@ -443,7 +444,7 @@ class Submission(Base):
body += "</div>"
if self.author.sig_html and (self.author_id == MOOSE_ID or (not self.ghost and not (v and v.sigs_disabled))):
if self.author.sig_html and (self.author_id == MOOSE_ID or (not self.ghost and not (v and (v.sigs_disabled or v.poorcel)))):
body += f"<hr>{self.author.sig_html}"
return body

View File

@ -82,7 +82,7 @@ class User(Base):
over_18 = Column(Boolean, default=False)
hidevotedon = Column(Boolean, default=False)
highlightcomments = Column(Boolean, default=True)
animations = Column(Boolean, default=True)
poorcel = Column(Boolean, default=False)
slurreplacer = Column(Boolean, default=True)
flairchanged = Column(Integer)
newtab = Column(Boolean, default=False)

View File

@ -61,9 +61,9 @@ def settings_profile_post(v):
updated = True
v.slurreplacer = request.values.get("slurreplacer") == 'true'
elif request.values.get("animations", v.animations) != v.animations:
elif request.values.get("poorcel", v.poorcel) != v.poorcel:
updated = True
v.animations = request.values.get("animations") == 'true'
v.poorcel = request.values.get("poorcel") == 'true'
elif request.values.get("hidevotedon", v.hidevotedon) != v.hidevotedon:
updated = True

View File

@ -70,7 +70,7 @@
<div class="comment-body">
<div id="comment-{{c.id}}-only" class="{% if c.award_count('glowie') %}glow{% endif %} comment-{{c.id}}-only">
<div id="comment-{{c.id}}-only" class="{% if c.award_count('glowie', v) %}glow{% endif %} comment-{{c.id}}-only">
<div class="user-info">
<span class="comment-collapse-icon" onclick="collapse_comment('{{c.id}}', this.parentElement.parentElement.parentElement)"></span>
@ -167,7 +167,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 and not c.voted %}unread{% endif %} {% if c.award_count('glowie') %}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 and not c.voted %}unread{% 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 class="user-info">
<span class="comment-collapse-icon" onclick="collapse_comment('{{c.id}}', this.parentElement.parentElement.parentElement.parentElement)"></span>
@ -273,19 +273,19 @@
<div id="comment-banned-warning" class="comment-text text-removed mb-0">removed by @{{c.ban_reason}}</div>
{% endif %}
{% if c.award_count("tilt") %}
{% if c.award_count("tilt", v) %}
<style>
@keyframes c{{c.id}}-tilt {
0% {transform: rotate(0deg);}
25% {transform: rotate({{c.award_count("tilt")}}deg);}
75% {transform: rotate(-{{c.award_count("tilt")}}deg);}
25% {transform: rotate({{c.award_count("tilt", v)}}deg);}
75% {transform: rotate(-{{c.award_count("tilt", v)}}deg);}
100% {transform: rotate(0deg);}
}
@media (max-width: 720px) {
@keyframes c{{c.id}}-tilt {
0% {transform: rotate(0deg);}
25% {transform: rotate({{c.award_count("tilt")/4}}deg);}
75% {transform: rotate(-{{c.award_count("tilt")/4}}deg);}
25% {transform: rotate({{c.award_count("tilt", v)/4}}deg);}
75% {transform: rotate(-{{c.award_count("tilt", v)/4}}deg);}
100% {transform: rotate(0deg);}
}
}

View File

@ -36,7 +36,7 @@
</div>
<div class="px-3">
<input disabled autocomplete="off" class="form-control px-2" type="text" id="emoji_search" placeholder="Search.." onchange="start_search()">
<input disabled autocomplete="off" class="form-control px-2" type="text" id="emoji_search" placeholder="Search.." onchange="start_search()" {% if not (v and v.poorcel) %}oninput="start_search()"{% endif %}>
</div>
<div class="px-3 d-flex flex-row">
<fieldset class="p-2">

View File

@ -303,7 +303,7 @@
</style>
{% endif %}
{% if v and not v.animations -%}
{% if v and v.poorcel -%}
<style>
* :not(img[src="/i/hand.webp"] + img):not(img.golden, img[g], img[glow]) {
animation: unset !important;

View File

@ -11,6 +11,29 @@
<div class="settings">
<h2 class="h5" name="referral">Poorcel Mode</h2>
<div class="settings-section rounded">
<div class="d-lg-flex border-bottom">
<div class="title w-lg-25">
<label for="poorcel">Poorcel Mode</label>
</div>
<div class="body w-lg-100">
<div class="custom-control custom-switch">
<input autocomplete="off" type="checkbox" class="custom-control-input" id="poorcel" name="poorcel"{% if v.poorcel %} checked{% endif %} onchange="post_toast(this,'/settings/profile?poorcel='+document.getElementById('poorcel').checked);">
<label class="custom-control-label" for="poorcel"></label>
</div>
<span class="text-small-extra text-muted">Makes the site much faster for low-end devices.</span>
</div>
</div>
</div>
<h2 class="h5" name="referral">Frontpage Size</h2>
<div class="settings-section rounded">
@ -297,24 +320,6 @@
</div>
<div class="d-lg-flex border-bottom">
<div class="title w-lg-25">
<label for="animations">Animations</label>
</div>
<div class="body w-lg-100">
<div class="custom-control custom-switch">
<input autocomplete="off" type="checkbox" class="custom-control-input" id="animations" name="animations"{% if v.animations %} checked{% endif %} onchange="post_toast(this,'/settings/profile?animations='+document.getElementById('animations').checked);">
<label class="custom-control-label" for="animations"></label>
</div>
<span class="text-small-extra text-muted">Enables animations for user interface elements. No effect on award animations.</span>
</div>
</div>
<div class="d-lg-flex border-bottom">

View File

@ -33,7 +33,7 @@
{% endif %}
{% if p.award_count("crab") %}
{% if p.award_count("crab", v) %}
<script>
let audio = new Audio('/assets/media/crab.mp3');
audio.loop=true;
@ -65,48 +65,48 @@
{% set wholesome = '/e/marseywholesome.webp' %}
{% endif %}
{% if p.award_count("confetti") %}
{% if p.award_count("confetti", v) %}
<div id="post-award-confetti"></div>
{% endif %}
{% if p.award_count("firework") %}
{% if p.award_count("firework", v) %}
<script defer src="/assets/js/fireworks.js?v=17"></script>
<div class="firework">
<img src="">
</div>
{% if p.award_count("firework") > 1 %}
{% if p.award_count("firework", v) > 1 %}
<div class="firework">
<img src="">
</div>
{% endif %}
{% if p.award_count("firework") > 2 %}
{% if p.award_count("firework", v) > 2 %}
<div class="firework">
<img src="">
</div>
{% endif %}
{% if p.award_count("firework") > 3 %}
{% if p.award_count("firework", v) > 3 %}
<div class="firework">
<img src="">
</div>
{% endif %}
{% endif %}
{% if p.award_count("ricardo") %}
{% if p.award_count("ricardo", v) %}
<script src="/assets/js/ricardo.js?v=18"></script>
<div id="ricardo1" class="ricardo ricardoleft">
<img src="/i/ricardo1.webp">
</div>
{% if p.award_count("ricardo") > 1 %}
{% if p.award_count("ricardo", v) > 1 %}
<div id="ricardo2" class="ricardo">
<img src="/i/ricardo2.webp" style="max-height:200px">
</div>
{% endif %}
{% if p.award_count("ricardo") > 2 %}
{% if p.award_count("ricardo", v) > 2 %}
<div id="ricardo3" class="ricardo">
<img src="/i/ricardo3.webp" style="max-height:150px">
</div>
@ -114,7 +114,7 @@
{% endif %}
{% if g.inferior_browser %}
{% if p.award_count("wholesome") %}
{% if p.award_count("wholesome", v) %}
<style>
.sealimg {
width: 100px !important;
@ -155,7 +155,7 @@
<img alt=":#marseywholesome:" class="sealimg seal1" src="{{wholesome}}">
</div>
{% if p.award_count("wholesome") > 1 %}
{% if p.award_count("wholesome", v) > 1 %}
<style>
.seal2 {
animation: moveX 5s linear 0s infinite alternate !important;
@ -171,7 +171,7 @@
</div>
{% endif %}
{% if p.award_count("wholesome") > 2 %}
{% if p.award_count("wholesome", v) > 2 %}
<style>
.seal3 {
animation: moveX 4s linear 0s infinite alternate !important;
@ -187,7 +187,7 @@
</div>
{% endif %}
{% if p.award_count("wholesome") > 3 %}
{% if p.award_count("wholesome", v) > 3 %}
<style>
.seal4 {
animation: moveX 5s linear 0s infinite alternate !important;
@ -204,7 +204,7 @@
{% endif %}
{% endif %}
{% if SITE_NAME == 'PCM' and p.award_count("toe") %}
{% if SITE_NAME == 'PCM' and p.award_count("toe", v) %}
<style>
.toeimg {
width: 100px !important;
@ -245,7 +245,7 @@
<img alt="Blade's toe" class="toeimg" src="/i/PCM/toe.webp?v=2000">
</div>
{% if p.award_count("toe") > 1 %}
{% if p.award_count("toe", v) > 1 %}
<style>
.toe2 {
animation: moveX 5s linear 0s infinite alternate !important;
@ -261,7 +261,7 @@
</div>
{% endif %}
{% if p.award_count("toe") > 2 %}
{% if p.award_count("toe", v) > 2 %}
<style>
.toe3 {
animation: moveX 4s linear 0s infinite alternate !important;
@ -277,7 +277,7 @@
</div>
{% endif %}
{% if p.award_count("toe") > 3 %}
{% if p.award_count("toe", v) > 3 %}
<style>
.toe4 {
animation: moveX 5s linear 0s infinite alternate !important;
@ -294,7 +294,7 @@
{% endif %}
{% endif %}
{% else %}
{% if p.award_count("wholesome") %}
{% if p.award_count("wholesome", v) %}
<style>
.seal {
position:fixed;
@ -322,7 +322,7 @@
</marquee>
</div>
{% if p.award_count("wholesome") > 1 %}
{% if p.award_count("wholesome", v) > 1 %}
<marquee class="seal" scrollamount=10 behavior="alternate" direction="down" height="100%">
<marquee direction="right" scrollamount=10 behavior="alternate" width="100%">
<img alt=":#marseywholesome:" class="sealimg" src="{{wholesome}}">
@ -330,7 +330,7 @@
</marquee>
{% endif %}
{% if p.award_count("wholesome") > 2 %}
{% if p.award_count("wholesome", v) > 2 %}
<marquee class="seal" scrollamount=10 behavior="alternate" direction="up" height="100%">
<marquee direction="left" scrollamount=10 behavior="alternate" width="100%">
<img alt=":#marseywholesome:" class="sealimg" src="{{wholesome}}">
@ -338,7 +338,7 @@
</marquee>
{% endif %}
{% if p.award_count("wholesome") > 3 %}
{% if p.award_count("wholesome", v) > 3 %}
<marquee class="seal" scrollamount=10 behavior="alternate" direction="down" height="100%">
<marquee direction="left" scrollamount=10 behavior="alternate" width="100%">
<img alt=":#marseywholesome:" class="sealimg" src="{{wholesome}}">
@ -347,7 +347,7 @@
{% endif %}
{% endif %}
{% if SITE_NAME == 'PCM' and p.award_count("toe") %}
{% if SITE_NAME == 'PCM' and p.award_count("toe", v) %}
<style>
.toe {
position:fixed;
@ -375,7 +375,7 @@
</marquee>
</div>
{% if p.award_count("toe") > 1 %}
{% if p.award_count("toe", v) > 1 %}
<marquee class="toe" scrollamount=10 behavior="alternate" direction="down" height="100%">
<marquee direction="right" scrollamount=10 behavior="alternate" width="100%">
<img alt="Blade's toe" class="toeimg" src="/i/PCM/toe.webp?v=2000">
@ -383,7 +383,7 @@
</marquee>
{% endif %}
{% if p.award_count("toe") > 2 %}
{% if p.award_count("toe", v) > 2 %}
<marquee class="toe" scrollamount=10 behavior="alternate" direction="up" height="100%">
<marquee direction="left" scrollamount=10 behavior="alternate" width="100%">
<img alt="Blade's toe" class="toeimg" src="/i/PCM/toe.webp?v=2000">
@ -391,7 +391,7 @@
</marquee>
{% endif %}
{% if p.award_count("toe") > 3 %}
{% if p.award_count("toe", v) > 3 %}
<marquee class="toe" scrollamount=10 behavior="alternate" direction="down" height="100%">
<marquee direction="left" scrollamount=10 behavior="alternate" width="100%">
<img alt="Blade's toe" class="toeimg" src="/i/PCM/toe.webp?v=2000">
@ -405,7 +405,7 @@
{% if p.award_count("train") or p.award_count("scooter") %}
{% if p.award_count("train", v) or p.award_count("scooter", v) %}
<style>
.train {
position:fixed;
@ -427,7 +427,7 @@
</style>
{% endif %}
{% if p.award_count("train") %}
{% if p.award_count("train", v) %}
<style>
.trainimg {
width: 100px !important;
@ -445,19 +445,19 @@
<img alt=":#marseytrain:" class="trainimg mirrored" src="/e/marseytrain.webp">
</marquee>
{% if p.award_count("train") > 1 %}
{% if p.award_count("train", v) > 1 %}
<marquee class="train train2" direction="right" scrollamount=10 width="100%">
<img alt=":#marseytrain:" class="trainimg" src="/e/marseytrain.webp">
</marquee>
{% endif %}
{% if p.award_count("train") > 2 %}
{% if p.award_count("train", v) > 2 %}
<marquee class="train train3" direction="left" scrollamount=10 width="100%">
<img alt=":#marseytrain:" class="trainimg mirrored" src="/e/marseytrain.webp">
</marquee>
{% endif %}
{% if p.award_count("train") > 3 %}
{% if p.award_count("train", v) > 3 %}
<marquee class="train train4" direction="right" scrollamount=10 width="100%">
<img alt=":#marseytrain:" class="trainimg" src="/e/marseytrain.webp">
</marquee>
@ -465,7 +465,7 @@
{% endif %}
{% if SITE_NAME == 'PCM' and p.award_count("croag") %}
{% if SITE_NAME == 'PCM' and p.award_count("croag", v) %}
<style>
.croag {
position:fixed;
@ -500,19 +500,19 @@
<img alt="croag" class="croagimg mirrored" src="/i/PCM/croag.webp?v=2000">
</marquee>
{% if p.award_count("croag") > 1 %}
{% if p.award_count("croag", v) > 1 %}
<marquee class="croag croag2" direction="right" scrollamount=10 width="100%">
<img alt="croag" class="croagimg" src="/i/PCM/croag.webp?v=2000">
</marquee>
{% endif %}
{% if p.award_count("croag") > 2 %}
{% if p.award_count("croag", v) > 2 %}
<marquee class="croag croag3" direction="left" scrollamount=10 width="100%">
<img alt="croag" class="croagimg mirrored" src="/i/PCM/croag.webp?v=2000">
</marquee>
{% endif %}
{% if p.award_count("croag") > 3 %}
{% if p.award_count("croag", v) > 3 %}
<marquee class="croag croag4" direction="right" scrollamount=10 width="100%">
<img alt="croag" class="croagimg" src="/i/PCM/croag.webp?v=2000">
</marquee>
@ -520,7 +520,7 @@
{% endif %}
{% if p.award_count("scooter") %}
{% if p.award_count("scooter", v) %}
<style>
.scooterimg {
width: 100px !important;
@ -537,19 +537,19 @@
<img alt=":#marseyscooter:" class="scooterimg" src="/e/marseyscooter.webp">
</marquee>
{% if p.award_count("scooter") > 1 %}
{% if p.award_count("scooter", v) > 1 %}
<marquee class="train train4" direction="left" scrollamount=10 width="100%">
<img alt=":#marseyscooter:" class="scooterimg mirrored" src="/e/marseyscooter.webp">
</marquee>
{% endif %}
{% if p.award_count("scooter") > 2 %}
{% if p.award_count("scooter", v) > 2 %}
<marquee class="train train1" direction="right" scrollamount=10 width="100%">
<img alt=":#marseyscooter:" class="scooterimg" src="/e/marseyscooter.webp">
</marquee>
{% endif %}
{% if p.award_count("scooter") > 3 %}
{% if p.award_count("scooter", v) > 3 %}
<marquee class="train train2" direction="left" scrollamount=10 width="100%">
<img alt=":#marseyscooter:" class="scooterimg mirrored" src="/e/marseyscooter.webp">
</marquee>
@ -558,19 +558,19 @@
{% if p.award_count("tilt") and not p.distinguish_level %}
{% if p.award_count("tilt", v) and not p.distinguish_level %}
<style>
@keyframes post-tilt {
0% {transform: rotate(0deg);}
25% {transform: rotate({{p.award_count("tilt")}}deg);}
75% {transform: rotate(-{{p.award_count("tilt")}}deg);}
25% {transform: rotate({{p.award_count("tilt", v)}}deg);}
75% {transform: rotate(-{{p.award_count("tilt", v)}}deg);}
100% {transform: rotate(0deg);}
}
@media (max-width: 720px) {
@keyframes post-tilt {
0% {transform: rotate(0deg);}
25% {transform: rotate({{p.award_count("tilt")/4}}deg);}
75% {transform: rotate(-{{p.award_count("tilt")/4}}deg);}
25% {transform: rotate({{p.award_count("tilt", v)/4}}deg);}
75% {transform: rotate(-{{p.award_count("tilt", v)/4}}deg);}
100% {transform: rotate(0deg);}
}
}
@ -693,7 +693,7 @@
<div id="post-root" class="col-12">
<div class="card border-0 mt-3{% if p.is_banned %} banned{% endif %}{% if p.stickied %} stickied{% endif %}{% if voted==1 %} upvoted{% elif voted==-1 %} downvoted{% endif %}">
<div id="post-{{p.id}}" class="{% if p.award_count('tilt') %}p-3{% endif %} {% if p.award_count('glowie') %}glow{% endif %} {% if p.deleted_utc %}deleted {% endif %}d-flex flex-row-reverse flex-nowrap justify-content-end">
<div id="post-{{p.id}}" class="{% if p.award_count('tilt', v) %}p-3{% endif %} {% if p.award_count('glowie', v) %}glow{% endif %} {% if p.deleted_utc %}deleted {% endif %}d-flex flex-row-reverse flex-nowrap justify-content-end">
{% if not p.is_image and p.thumb_url and not p.embed_url %}
<div class="card-header bg-transparent border-0 d-none d-md-flex flex-row flex-nowrap pl-3 p-0">
@ -1184,13 +1184,13 @@
{% include "comments.html" %}
{% endif %}
{% if p.award_count("shit") %}
{% if p.award_count("shit", v) %}
<script src="/assets/js/critters.js?v=261"></script>
<script src="/assets/js/bugs.js?v=261"></script>
{% endif %}
{% if p.award_count("fireflies") %}
{% if p.award_count("fireflies", v) %}
<script src="/assets/js/critters.js?v=261"></script>
<script src="/assets/js/fireflies.js?v=261"></script>
{% endif %}

View File

@ -23,7 +23,7 @@
<div class="col-12">
<div id="post-{{p.id}}" class="{% if p.award_count('glowie') %}glow{% endif %} card d-flex flex-row-reverse flex-nowrap justify-content-end border-0 p-0 {% if voted==1 %} upvoted{% elif voted==-1 %} downvoted{% endif %}">
<div id="post-{{p.id}}" class="{% if p.award_count('glowie', v) %}glow{% endif %} card d-flex flex-row-reverse flex-nowrap justify-content-end border-0 p-0 {% if voted==1 %} upvoted{% elif voted==-1 %} downvoted{% endif %}">
<div class="card-block my-md-auto{% if p.is_banned %} banned{% endif %}">
<div class="post-meta text-left d-md-none mb-1">{% if p.over_18 %}<span class="badge badge-danger">+18</span> {% endif %}{% if p.is_banned %}removed by @{{p.ban_reason}}{% else %}[Deleted by user]{% endif %}</div>
<h5 class="card-title post-title text-left mb-0 mb-md-1">{{p.plaintitle(v)}}</h5>

View File

@ -19,7 +19,7 @@ set CACHE_VER = {
'js/bootstrap.js': 267,
'js/comments+submission_listing.js': 261,
'js/submission_listing.js': 261,
'js/emoji_modal.js': 296,
'js/emoji_modal.js': 297,
'js/formatting.js': 240,
'js/lottery.js': 256,
'js/marked.js': 272,