forked from rDrama/rDrama
painful
parent
88f283c4a8
commit
af426407c7
|
@ -887,25 +887,10 @@
|
|||
|
||||
<script src="/static/assets/js/comments+submission_listing.js?v=253"></script>
|
||||
<script src="/static/assets/js/comments.js?v=252"></script>
|
||||
{% endif %}
|
||||
|
||||
{% if offset %}
|
||||
{% if p %}
|
||||
{% set pid = p.id %}
|
||||
{% endif %}
|
||||
<br>
|
||||
<div id="viewmore-{{offset}}"><button id="viewbtn" class="btn btn-primary" onclick="viewmore({{pid}},'{{sort}}',{{offset}},{{ids}})">VIEW MORE COMMENTS</a></div>
|
||||
{% endif %}
|
||||
|
||||
{% if p %}
|
||||
<script>
|
||||
{% if p and (not v or v.highlightcomments) %}
|
||||
{% if ajax %}
|
||||
comments = JSON.parse(localStorage.getItem("old-comment-counts")) || {}
|
||||
{% else %}
|
||||
comments = JSON.parse(localStorage.getItem("comment-counts")) || {}
|
||||
{% endif %}
|
||||
|
||||
lastCount = comments['{{p.id}}']
|
||||
if (lastCount)
|
||||
{
|
||||
|
@ -921,4 +906,12 @@
|
|||
</script>
|
||||
{% endif %}
|
||||
|
||||
{% if offset %}
|
||||
{% if p %}
|
||||
{% set pid = p.id %}
|
||||
{% endif %}
|
||||
<br>
|
||||
<div id="viewmore-{{offset}}"><button id="viewbtn" class="btn btn-primary" onclick="viewmore({{pid}},'{{sort}}',{{offset}},{{ids}})">VIEW MORE COMMENTS</a></div>
|
||||
{% endif %}
|
||||
|
||||
</body>
|
|
@ -978,7 +978,38 @@
|
|||
</div>
|
||||
|
||||
{% if offset %}
|
||||
<script src="/static/assets/js/viewmore.js?v=247"></script>
|
||||
<script>
|
||||
function viewmore(pid,sort,offset,ids) {
|
||||
btn = document.getElementById("viewbtn");
|
||||
btn.disabled = true;
|
||||
btn.innerHTML = "Requesting...";
|
||||
var form = new FormData();
|
||||
const xhr = new XMLHttpRequest();
|
||||
xhr.open("get", `/viewmore/${pid}/${sort}/${offset}?ids=${ids}`);
|
||||
xhr.setRequestHeader('xhr', 'xhr');
|
||||
xhr.onload=function(){
|
||||
if (xhr.status==200) {
|
||||
document.getElementById(`viewmore-${offset}`).innerHTML = xhr.response.replace(/data-src/g, 'src').replace(/data-cfsrc/g, 'src').replace(/style="display:none;visibility:hidden;"/g, '');
|
||||
bs_trigger()
|
||||
|
||||
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 %}
|
||||
}
|
||||
}
|
||||
btn.disabled = false;
|
||||
}
|
||||
xhr.send(form)
|
||||
}
|
||||
</script>
|
||||
{% endif %}
|
||||
|
||||
{% elif not p.replies and p.deleted_utc == 0 %}
|
||||
|
|
Loading…
Reference in New Issue