forked from MarseyWorld/MarseyWorld
tryna fix new_comment_count
parent
1ce1410268
commit
90551bc143
|
@ -210,7 +210,7 @@
|
||||||
<script>
|
<script>
|
||||||
if (!("standalone" in window.navigator) && !(window.navigator.standalone)) {
|
if (!("standalone" in window.navigator) && !(window.navigator.standalone)) {
|
||||||
if (window.innerWidth <= 737) {
|
if (window.innerWidth <= 737) {
|
||||||
window.addEventListener('DOMContentLoaded', function() {
|
document.addEventListener('DOMContentLoaded', function() {
|
||||||
const tt = bootstrap.Tooltip.getOrCreateInstance(document.getElementById('mobile-prompt'))
|
const tt = bootstrap.Tooltip.getOrCreateInstance(document.getElementById('mobile-prompt'))
|
||||||
tt.show()
|
tt.show()
|
||||||
document.getElementsByClassName('tooltip')[0].onclick = function(event){
|
document.getElementsByClassName('tooltip')[0].onclick = function(event){
|
||||||
|
|
|
@ -1126,19 +1126,18 @@
|
||||||
<script>
|
<script>
|
||||||
(() => {
|
(() => {
|
||||||
{% if not v or v.highlightcomments %}
|
{% if not v or v.highlightcomments %}
|
||||||
window.addEventListener('DOMContentLoaded', function() {
|
document.addEventListener('DOMContentLoaded', function() {
|
||||||
showNewCommentCounts('{{p.id}}', {{p.comment_count}})
|
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 %}
|
{% 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>
|
</script>
|
||||||
|
|
||||||
|
|
|
@ -306,7 +306,7 @@
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
{% if not v or v.highlightcomments %}
|
{% if not v or v.highlightcomments %}
|
||||||
window.addEventListener('DOMContentLoaded', function() {
|
document.addEventListener('DOMContentLoaded', function() {
|
||||||
showNewCommentCounts({{p.id}}, {{p.comment_count}})
|
showNewCommentCounts({{p.id}}, {{p.comment_count}})
|
||||||
})
|
})
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
Loading…
Reference in New Issue