master
Aevann1 2021-12-05 00:43:39 +02:00
parent 8d4fad12f5
commit 7edabe847f
1 changed files with 33 additions and 39 deletions

View File

@ -831,29 +831,27 @@
</div> </div>
<script> <script>
window.addEventListener("load",function(event) { (() => {
(() => { {% if (not v or v.highlightcomments) %}
{% if (not v or v.highlightcomments) %} showNewCommentCounts('{{p.id}}', {{p.comment_count}})
showNewCommentCounts('{{p.id}}', {{p.comment_count}}) {% endif %}
{% endif %}
{% if "?context" not in request.full_path %} {% if "?context" not in request.full_path %}
const comments = JSON.parse(localStorage.getItem("comment-counts")) || {} const comments = JSON.parse(localStorage.getItem("comment-counts")) || {}
const newTotal = {{p.comment_count}} || ((comments['{{p.id}}'] || { c: 0 }).c + 1) const newTotal = {{p.comment_count}} || ((comments['{{p.id}}'] || { c: 0 }).c + 1)
comments['{{p.id}}'] = { c: newTotal, t: Date.now() } comments['{{p.id}}'] = { c: newTotal, t: Date.now() }
window.localStorage.setItem("comment-counts", JSON.stringify(comments)) window.localStorage.setItem("comment-counts", JSON.stringify(comments))
{% endif %} {% endif %}
{% if p.stickied %} {% if p.stickied %}
const pinned_info = document.getElementById('pinned-{{p.id}}') const pinned_info = document.getElementById('pinned-{{p.id}}')
{% if p.stickied.startswith('t:') %} {% if p.stickied.startswith('t:') %}
pinned_info.setAttribute("data-bs-original-title", `Pinned until ${new Date({{p.stickied[2:]}} * 1000).toString()}`) pinned_info.setAttribute("data-bs-original-title", `Pinned until ${new Date({{p.stickied[2:]}} * 1000).toString()}`)
{% else %} {% else %}
pinned_info.setAttribute("data-bs-original-title", "Pinned by @{{p.stickied}}") pinned_info.setAttribute("data-bs-original-title", "Pinned by @{{p.stickied}}")
{%endif%} {%endif%}
{%endif%} {%endif%}
})() })()
});
</script> </script>
{% if v and v.id==p.author_id %} {% if v and v.id==p.author_id %}
@ -878,7 +876,7 @@
{% include "ban_modal.html" %} {% include "ban_modal.html" %}
{% endif %} {% endif %}
{% endif %} {% endif %}
<script src="/assets/js/comments.js?v=7"></script> <script src="/assets/js/comments.js?v=8"></script>
{% include "expanded_image_modal.html" %} {% include "expanded_image_modal.html" %}
{% endif %} {% endif %}
@ -887,14 +885,12 @@
{% set minbugs = 10*p.award_count("shit") if p.award_count("shit") < 3 else 20 %} {% set minbugs = 10*p.award_count("shit") if p.award_count("shit") < 3 else 20 %}
{% set maxbugs = 20*p.award_count("shit") if p.award_count("shit") < 3 else 40 %} {% set maxbugs = 20*p.award_count("shit") if p.award_count("shit") < 3 else 40 %}
<script> <script>
window.addEventListener("load",function(event) { new BugController({
new BugController({ imageSprite: "/assets/images/fly-sprite.webp",
imageSprite: "/assets/images/fly-sprite.webp", canDie: false,
canDie: false, minBugs: {{minbugs}},
minBugs: {{minbugs}}, maxBugs: {{maxbugs}},
maxBugs: {{maxbugs}}, mouseOver: "multiply"
mouseOver: "multiply"
});
}); });
{% if not v %} {% if not v %}
function poll_vote(cid, parentid) { function poll_vote(cid, parentid) {
@ -912,16 +908,14 @@
{% set minbugs = 10*p.award_count("fireflies") if p.award_count("fireflies") < 3 else 20 %} {% set minbugs = 10*p.award_count("fireflies") if p.award_count("fireflies") < 3 else 20 %}
{% set maxbugs = 20*p.award_count("fireflies") if p.award_count("fireflies") < 3 else 40 %} {% set maxbugs = 20*p.award_count("fireflies") if p.award_count("fireflies") < 3 else 40 %}
<script> <script>
window.addEventListener("load",function(event) { new BugController({
new BugController({ imageSprite: "/assets/images/fireflies.webp",
imageSprite: "/assets/images/fireflies.webp", canDie: false,
canDie: false, minBugs: {{minbugs}},
minBugs: {{minbugs}}, maxBugs: {{maxbugs}},
maxBugs: {{maxbugs}}, mouseOver: "multiply"
mouseOver: "multiply"
});
}); });
</script> </script>
{% endif %} {% endif %}