treappy
parent
0b99314880
commit
f4921693ec
|
@ -903,6 +903,41 @@
|
|||
{% endfor %}
|
||||
}
|
||||
{% endif %}
|
||||
|
||||
|
||||
function morecomments(cid) {
|
||||
btn = document.getElementById(`btn-${cid}`);
|
||||
btn.disabled = true;
|
||||
btn.innerHTML = "Requesting...";
|
||||
var form = new FormData();
|
||||
form.append("formkey", formkey());
|
||||
const xhr = new XMLHttpRequest();
|
||||
xhr.open("get", `/morecomments/${cid}`);
|
||||
xhr.setRequestHeader('xhr', 'xhr');
|
||||
xhr.onload=function(){
|
||||
if (xhr.status==200) {
|
||||
document.getElementById(`morecomments-${cid}`).innerHTML = xhr.response.replace(/data-src/g, 'src').replace(/data-cfsrc/g, 'src').replace(/style="display:none;visibility:hidden;"/g, '');
|
||||
bs_trigger()
|
||||
|
||||
{% if p %}
|
||||
comments = JSON.parse(localStorage.getItem("old-comment-counts")) || {}
|
||||
lastCount = comments['{{p.id}}']
|
||||
if (lastCount)
|
||||
{
|
||||
{% for c in p.comments2 %}
|
||||
{% if not (v and v.id==c[0]) %}
|
||||
if ({{c[1]*1000}} > lastCount.t)
|
||||
try {document.getElementById("comment-{{c.id}}-only").classList.add('unread2')}
|
||||
catch(e) {}
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
}
|
||||
{% endif %}
|
||||
}
|
||||
btn.disabled = false;
|
||||
}
|
||||
xhr.send(form)
|
||||
}
|
||||
</script>
|
||||
{% endif %}
|
||||
|
||||
|
|
Loading…
Reference in New Issue