website/js/customElements/contactMailButton.js

18 lines
627 B
JavaScript
Raw Normal View History

class contactMailButton extends HTMLElement {
constructor() {
super();
this.addButton();
}
2021-09-26 22:40:39 +02:00
async addButton() {
let sitekey = await (await fetch("/API/config.php?name=sitekey")).text();
2021-05-24 18:19:25 +02:00
console.log(sitekey);
this.innerHTML = `E-Mail: <button id="emailButton" class="h-captcha" data-sitekey="${sitekey}" data-callback="onSubmit">laden</button><br>`;
2021-09-26 22:40:39 +02:00
const script = document.createElement("script");
script.src = "https://hCaptcha.com/1/api.js";
document.head.append(script);
}
}
customElements.define("jl-contact_mail_button", contactMailButton);