enhancment: Add ~new~ text to the header of new posts (#589)

This commit is contained in:
rudyon 2023-05-13 19:21:06 +03:00 committed by GitHub
parent e6f5271181
commit 063e8087a5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 3 deletions

View file

@ -211,7 +211,10 @@
{% for c in p.comments %}
{% if not (v and v.id==c.author_id) and not c.voted %}
if ({{c.created_utc*1000}} > lastCount.t)
try {document.getElementById("comment-{{c.id}}-only").classList.add('unread')}
try {
document.getElementById("comment-{{c.id}}-only").classList.add('unread')
document.getElementById("comment-{{c.id}}").querySelector(".comment-user-info").innerHTML += "<span>~new~</span>";
}
catch(e) {}
{% endif %}
{% endfor %}
@ -253,7 +256,10 @@
{% for c in p.comments %}
{% if not (v and v.id==c.author_id) and not c.voted %}
if ({{c.created_utc*1000}} > lastCount.t)
try {document.getElementById("comment-{{c.id}}-only").classList.add('unread')}
try {
document.getElementById("comment-{{c.id}}-only").classList.add('unread')
document.getElementById("comment-{{c.id}}").querySelector(".comment-user-info").innerHTML += "<span>~new~</span>";
}
catch(e) {}
{% endif %}
{% endfor %}

View file

@ -494,7 +494,10 @@
{% for c in p.comments %}
{% if not (v and v.id==c.author_id) and not c.voted %}
if ({{c.created_utc*1000}} > lastCount.t)
try {document.getElementById("comment-{{c.id}}-only").classList.add('unread')}
try {
document.getElementById("comment-{{c.id}}-only").classList.add('unread')
document.getElementById("comment-{{c.id}}").querySelector(".comment-user-info").innerHTML += "<span>~new~</span>";
}
catch(e) {}
{% endif %}
{% endfor %}