blob: 970c41c5925ecadc1c5f88891082b96b68689c7f (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
|
{{ if .Param "comments" }}
<h2>comments</h2>
<div style="visibility: hidden" id="comments">comments go here</div>
<div style="visibility: hidden" id="comment_form">comment form goes here</div>
<script>
let comments = document.getElementById("comments");
let urlParam = new URLSearchParams();
urlParam.append("url", document.location.href);
fetch(document.location.origin + "/api/comment?" + urlParam.toString())
.then((response) => response.text())
.then((data) => {
comments.innerHTML = data;
comments.style.visibility = "visible";
});
let form = document.getElementById("comment_form");
fetch(document.location.origin + "/api/form?" + urlParam.toString())
.then((response) => response.text())
.then((data) => {
form.innerHTML = data;
form.style.visibility = "visible";
});
</script>
<noscript>Comments disabled without javascript!</noscript>
{{ end }}
|