function commentForm(parentId) { return `
`; } function commentDisplay(comment, replies) { return `No comments yet! Be the first to make one.
"; } else { comments.forEach(comment => { if (comment.replies) { let replies = ""; comment.replies.forEach(reply => { replies += commentDisplay(reply); }); html += commentDisplay(comment, replies); } else { html += commentDisplay(comment, ""); } }); } commentContainer.innerHTML = html; soudan.style.display = ""; if (jump && window.location.hash) { const target = document.getElementById(window.location.hash.substring(1)); if (target) { window.scrollTo(0, target.offsetTop); target.classList.add("soudan-highlighted"); } } } function reloadComments(jump) { fetch(`${url}/${contentId}`) .then(response => { return response.json().then(json => { return response.ok ? json : Promise.reject(json); }); }) .then(comments => renderComments(jump, comments)) .catch(error => renderComments(jump, [{"id":9,"text":"yoo thanks for this little guide. Might be useful to add a few lines for Wayland users out there to activate the firefox PWA wayland support n stuff, but yea thanks","timestamp":1672748214},{"id":1,"author":"Elnu","gravatar":"1cfb9e38feea40e5150bc0fa69faf693","text":"Nice post, me!","timestamp":1658541512,"replies":[{"id":2,"author":"Drago","text":"HELLO ELNU","timestamp":1658541674},{"id":3,"author":"Elnu","gravatar":"1cfb9e38feea40e5150bc0fa69faf693","text":"HELLO DRAGO","timestamp":1658541732},{"id":4,"author":"Drago","text":"You should get to drawing ( ͡° ͜ʖ ͡°)","timestamp":1658541778},{"id":5,"author":"Elnu","gravatar":"1cfb9e38feea40e5150bc0fa69faf693","text":"*soon™*","timestamp":1658541863}]}], true)) } function reply(id) { const replies = document.getElementById(id).querySelector(".soudan-replies"); replies.innerHTML = `