remove unnecessary arrow functions

master
Aevann1 2022-11-18 21:34:38 +02:00
parent 446ef58c2c
commit b4448ae926
2 changed files with 12 additions and 16 deletions

View File

@ -180,7 +180,6 @@ function smoothScrollTop()
} }
// Click navbar to scroll back to top // Click navbar to scroll back to top
(() => {
for (const i of document.querySelectorAll('nav')) for (const i of document.querySelectorAll('nav'))
{ {
i.addEventListener('click', (e) => { i.addEventListener('click', (e) => {
@ -192,7 +191,6 @@ function smoothScrollTop()
smoothScrollTop(); smoothScrollTop();
}, false); }, false);
} }
})();
// Dynamic shadow when the user scrolls // Dynamic shadow when the user scrolls
document.addEventListener('scroll',function (event) { document.addEventListener('scroll',function (event) {

View File

@ -569,21 +569,19 @@
{% endif %} {% endif %}
<script> <script>
(() => { {% if not v or v.highlightcomments %}
{% if not v or v.highlightcomments %} document.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 %}
{% if "?context" not in request.full_path %} localStorage.setItem("old-comment-counts", localStorage.getItem("comment-counts"))
localStorage.setItem("old-comment-counts", localStorage.getItem("comment-counts"))
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()}
localStorage.setItem("comment-counts", JSON.stringify(comments)) localStorage.setItem("comment-counts", JSON.stringify(comments))
{% endif %} {% endif %}
}) })
{% endif %} {% endif %}
})()
</script> </script>
{% if success %} {% if success %}