painful
This commit is contained in:
parent
7ef991cc32
commit
c4df80eb0f
3 changed files with 41 additions and 34 deletions
|
@ -1,17 +0,0 @@
|
||||||
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()
|
|
||||||
}
|
|
||||||
btn.disabled = false;
|
|
||||||
}
|
|
||||||
xhr.send(form)
|
|
||||||
}
|
|
|
@ -887,25 +887,10 @@
|
||||||
|
|
||||||
<script src="/static/assets/js/comments+submission_listing.js?v=253"></script>
|
<script src="/static/assets/js/comments+submission_listing.js?v=253"></script>
|
||||||
<script src="/static/assets/js/comments.js?v=252"></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>
|
<script>
|
||||||
{% if p and (not v or v.highlightcomments) %}
|
{% 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")) || {}
|
comments = JSON.parse(localStorage.getItem("comment-counts")) || {}
|
||||||
{% endif %}
|
|
||||||
|
|
||||||
lastCount = comments['{{p.id}}']
|
lastCount = comments['{{p.id}}']
|
||||||
if (lastCount)
|
if (lastCount)
|
||||||
{
|
{
|
||||||
|
@ -921,4 +906,12 @@
|
||||||
</script>
|
</script>
|
||||||
{% endif %}
|
{% 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>
|
</body>
|
|
@ -978,7 +978,38 @@
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{% if offset %}
|
{% 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 %}
|
{% endif %}
|
||||||
|
|
||||||
{% elif not p.replies and p.deleted_utc == 0 %}
|
{% elif not p.replies and p.deleted_utc == 0 %}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue