remotes/1693045480750635534/spooky-22
kek7198 2021-12-05 11:43:23 -06:00
parent b0fbd00e38
commit bc9358b281
1 changed files with 19 additions and 2 deletions

View File

@ -670,7 +670,7 @@
{% endif %}
{% if p.replies %}
<div class="comment-section px-2.5 md:px-0">
<div class="comment-section px-2.5 md:px-0" id="comment-section">
{% with comments=p.replies %}
{% include "comments.html" %}
{% endwith %}
@ -691,7 +691,24 @@
{% endif %}
{% if offset %}
<a class="pt-2" href="{{request.path}}?sort={{sort}}&offset={{offset}}">View more</a>
<script defer>
function loadMore(id) {
const el = document.getElementById(id)
const form = new FormData();
const xhr = new XMLHttpRequest();
xhr.open("post", "/viewmore/{{p.id}}/{{sort}}/{{offset}}");
xhr.withCredentials=true;
xhr.onload=function(){
if (xhr.status==200) {
el.innerHTML = xhr.response;
}
}
xhr.send(form)
}
</script>
<button class="btn btn-gray w-full" onclick="loadMore('comment-section')">
Load more comments
</button>
{% endif %}
</div>