actually fix viewmore

pull/83/head
Aevann 2023-01-01 17:35:59 +02:00
parent e83f36eca4
commit 7370e47735
2 changed files with 3 additions and 3 deletions

View File

@ -1,10 +1,10 @@
function view_more(pid,sort,offset,ids) {
function view_more(t, pid, sort, offset) {
btn = document.getElementById("viewbtn");
btn.disabled = true;
btn.innerHTML = "Requesting...";
const form = new FormData();
const xhr = new XMLHttpRequest();
ids = ids.toString().replace(/[\[\]]/g, '')
ids = t.dataset.ids.toString().replace(/[\[\] ]/g, '')
xhr.open("get", `/view_more/${pid}/${sort}/${offset}?ids=${ids}`);
xhr.setRequestHeader('xhr', 'xhr');
xhr.onload=function(){

View File

@ -767,7 +767,7 @@
{% if offset %}
<br>
<div id="view_more-{{offset}}"><button type="button" id="viewbtn" class="btn btn-primary" data-nonce="{{g.nonce}}" data-onclick="view_more({{pid}},'{{sort}}',{{offset}},{{ids}})">VIEW MORE COMMENTS</a></div>
<div id="view_more-{{offset}}"><button type="button" id="viewbtn" class="btn btn-primary" data-nonce="{{g.nonce}}" data-ids="{{ids}}" data-onclick="view_more(this, {{pid}},'{{sort}}',{{offset}})">VIEW MORE COMMENTS</a></div>
{% endif %}
</body>