(async () => { let el = document.getElementById("comment-section") if (el == null) { return } let status_url = `https://hachyderm.io/api/v1/statuses/${el.getAttribute("data-status")}/context` let comments = await (await fetch(status_url)).json() if (comments["descendants"] == null || comments["descendants"].length === 0) { el.innerHTML = `
No comments yet
` return } for (let comment of comments["descendants"]) { let date = new Date(comment.created_at).toLocaleDateString(navigator.language || "en-GB", { day: "2-digit", year: "numeric", month: "long", hour: "2-digit", minute: "2-digit", }) let sanitize = DOMPurify.sanitize let comment_html = `
Profile picture of ${sanitize(comment.account.display_name)}
${sanitize(comment.content)}
` el.innerHTML += comment_html } })()