fix highlighting comments

master
Aevann 2022-12-30 16:20:09 +02:00
parent 1495dbe5d4
commit 71f4797027
2 changed files with 4 additions and 11 deletions

View File

@ -4,8 +4,9 @@ function highlight_unread(localstoragevar) {
lastCount = comments[pid]
if (lastCount)
{
const comms = document.getElementById("comms").value
for (const c of comms) {
const comms = document.getElementById("comms").value.slice(0, -1).split(',')
for (let c of comms) {
c = c.split(':')
if (c[1]*1000 > lastCount.t) {
try {document.getElementById(`comment-${c[0]}-only`).classList.add('unread')}
catch(e) {}

View File

@ -764,15 +764,7 @@
{% if p %}
{% set pid = p.id %}
<div class="d-none">
{% set comms = [] %}
{% for c in p.comments %}
{% if not (v and v.id==c.author_id) and not c.voted %}
{{comms.append([c.id, c.created_utc])}}
{% endif %}
{% endfor %}
<input hidden id="comms" value="{{comms}}">
</div>
<input hidden id="comms" value="{% for c in p.comments %}{{c.id}}:{{c.created_utc}},{% endfor %}">
{% endif %}
{% if offset %}