forked from rDrama/rDrama
1
0
Fork 0

tryna fix new_comment_count

master
Aevann1 2022-09-08 21:08:42 +02:00
parent 1ce1410268
commit 90551bc143
3 changed files with 11 additions and 12 deletions

View File

@ -210,7 +210,7 @@
<script>
if (!("standalone" in window.navigator) && !(window.navigator.standalone)) {
if (window.innerWidth <= 737) {
window.addEventListener('DOMContentLoaded', function() {
document.addEventListener('DOMContentLoaded', function() {
const tt = bootstrap.Tooltip.getOrCreateInstance(document.getElementById('mobile-prompt'))
tt.show()
document.getElementsByClassName('tooltip')[0].onclick = function(event){

View File

@ -1126,19 +1126,18 @@
<script>
(() => {
{% if not v or v.highlightcomments %}
window.addEventListener('DOMContentLoaded', function() {
document.addEventListener('DOMContentLoaded', function() {
showNewCommentCounts('{{p.id}}', {{p.comment_count}})
{% if "?context" not in request.full_path %}
localStorage.setItem("old-comment-counts", localStorage.getItem("comment-counts"))
const comments = JSON.parse(localStorage.getItem("comment-counts")) || {}
const newTotal = {{p.comment_count}} || ((comments['{{p.id}}'] || {c: 0}).c + 1)
comments['{{p.id}}'] = {c: newTotal, t: Date.now()}
localStorage.setItem("comment-counts", JSON.stringify(comments))
{% endif %}
})
{% endif %}
{% if "?context" not in request.full_path %}
localStorage.setItem("old-comment-counts", localStorage.getItem("comment-counts"))
const comments = JSON.parse(localStorage.getItem("comment-counts")) || {}
const newTotal = {{p.comment_count}} || ((comments['{{p.id}}'] || {c: 0}).c + 1)
comments['{{p.id}}'] = {c: newTotal, t: Date.now()}
localStorage.setItem("comment-counts", JSON.stringify(comments))
{% endif %}
})()
</script>

View File

@ -306,7 +306,7 @@
<script>
{% if not v or v.highlightcomments %}
window.addEventListener('DOMContentLoaded', function() {
document.addEventListener('DOMContentLoaded', function() {
showNewCommentCounts({{p.id}}, {{p.comment_count}})
})
{% endif %}