class newComment extends HTMLElement { constructor() { super(); this.innerHTML = ` `; document.getElementById("showCommentButton").onclick = this.setupForm; } async setupForm() { let sitekey = await (await fetch("/API/config.php?name=sitekey")).text(); let script = document.createElement('script'); script.src = "https://hCaptcha.com/1/api.js"; script.type = 'text/javascript'; script.onload = () => { let pageName = window.location.pathname.split("/").pop(); this.parentElement.innerHTML = `
`; } document.body.append(script); } } customElements.define("jl-new_comment", newComment);