2021-04-12 20:43:43 +02:00
|
|
|
class contactMailButton extends HTMLElement {
|
|
|
|
constructor() {
|
|
|
|
super();
|
|
|
|
this.addButton();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2021-09-26 22:40:39 +02:00
|
|
|
async addButton() {
|
2022-03-08 09:54:38 +01:00
|
|
|
var graphql = JSON.stringify({
|
|
|
|
query: "query {\r\n sitekey\r\n}"
|
|
|
|
})
|
|
|
|
var requestOptions = {
|
|
|
|
method: 'POST',
|
|
|
|
body: graphql,
|
|
|
|
};
|
|
|
|
|
|
|
|
let sitekey = (await (await fetch("/API/graphql.php", requestOptions)).json()).data.sitekey;
|
2021-05-24 18:19:25 +02:00
|
|
|
console.log(sitekey);
|
2021-04-12 20:43:43 +02:00
|
|
|
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);
|
2021-04-12 20:43:43 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
customElements.define("jl-contact_mail_button", contactMailButton);
|