26 lines
1.1 KiB
HTML
26 lines
1.1 KiB
HTML
<hr/>
|
|
<div id="commentContainer" style="visibility:hidden;">
|
|
<h2>Comments</h2><div class="commentCounter" id="commentCounter">0</div>
|
|
<div class="comments" id="comments"></div>
|
|
</div>
|
|
<script type="text/javascript">
|
|
function fetchComments() {
|
|
fetch("/COMMENTS?article=$ARTICLE.comment").then((data)=>data.text())
|
|
.then((data)=>{
|
|
data=data.split("\n");
|
|
for (var i=0;i<data.length;i++) {
|
|
if (i==0) {
|
|
document.getElementById("commentCounter").innerText=data[i]
|
|
} else {
|
|
if (i%2==1) {
|
|
document.getElementById("comments").innerHTML+="<div class=\"comment\"><div class=\"commentData\">"+data[i]+"</div><br>"
|
|
} else {
|
|
document.getElementById("comments").innerHTML+="<div class=\"commentInfo\">"+data[i]+"</div></div><br>"
|
|
}
|
|
}
|
|
}
|
|
document.getElementById("commentContainer").style.visibility="visible"
|
|
})
|
|
}
|
|
fetchComments()
|
|
</script> |