diff --git a/js/customElements/contactMailButton.js b/js/customElements/contactMailButton.js new file mode 100644 index 0000000000000000000000000000000000000000..ce3633993b8764ac3aa59d4e9dfbb021d49eadc7 --- /dev/null +++ b/js/customElements/contactMailButton.js @@ -0,0 +1,14 @@ +class contactMailButton extends HTMLElement { + constructor() { + super(); + this.addButton(); + + } + + async addButton(){ + let sitekey = await (await fetch("/API/config.php?name=sitekey")).text(); + this.innerHTML = `E-Mail: <button id="emailButton" class="h-captcha" data-sitekey="${sitekey}" data-callback="onSubmit">laden</button><br>`; + } +} + +customElements.define("jl-contact_mail_button", contactMailButton); \ No newline at end of file diff --git a/js/customElements/newComment.js b/js/customElements/newComment.js index 92a6e27d9d4000c6a8a7d73d673b28bd555b2af6..bf92254cce872308ab1f357377191cb45c8814a7 100644 --- a/js/customElements/newComment.js +++ b/js/customElements/newComment.js @@ -24,7 +24,6 @@ class newComment extends HTMLElement { <p>Mit dem Klick auf den obigen Button erklären sie sich mit der <a href="/datenschutzerklaerung.html">Datenschutzerklärung</a> einverstanden.</p> </form> `; - } } diff --git a/js/script.js b/js/script.js index 1057467bdd74eb1057bd3e813192bd162ebfc2cc..9662cc2cfca4eb6ba7de629a681890b4bab5fea1 100644 --- a/js/script.js +++ b/js/script.js @@ -10,4 +10,5 @@ require("./customElements/svgLoader"); require("./customElements/blogFooter"); require("./customElements/blogIndex"); require("./customElements/commentsDisplay"); -require("./customElements/newComment"); \ No newline at end of file +require("./customElements/newComment"); +require("./customElements/contactMailButton"); \ No newline at end of file diff --git a/public/API/config.php b/public/API/config.php index e8a2ce7be9ff8941d09fbedecb78e59e672a4afa..97fe7471cdd96cd8c531e14424daa813703fec56 100644 --- a/public/API/config.php +++ b/public/API/config.php @@ -4,9 +4,6 @@ require "./lib/config.php"; $configValue = $_GET['name']; switch ($configValue){ - case "contactmail": - echo($contactmail); - break; case "sitekey": echo($sitekey); break; diff --git a/public/internal/getMail.php b/public/API/getMail.php similarity index 94% rename from public/internal/getMail.php rename to public/API/getMail.php index 20d8ae03c3c950821fa877f60041b1b892bacbca..f10a90f38b208d13bddadbdd7430e409c05e2b9c 100644 --- a/public/internal/getMail.php +++ b/public/API/getMail.php @@ -1,5 +1,5 @@ <?php -include("./config.php"); +include("./lib/config.php"); $data = array( 'secret' => $secretkey, 'response' => $_POST['h-captcha-response'] diff --git a/public/impressum.php b/public/impressum.php index 9396a28b26d96e505a64be4dcb9dfaf2777e3ef4..57536ba04254a1314772d30d6e6faf38cba3a27a 100644 --- a/public/impressum.php +++ b/public/impressum.php @@ -8,7 +8,7 @@ getHeader("Impressum", ""); <script src='https://www.hCaptcha.com/1/api.js' async defer></script> <h2>Impressum</h2> <p>Jonas Leder</p> - E-Mail: <button id="emailButton" class="h-captcha" data-sitekey="<?php echo($sitekey); ?>" data-callback="onSubmit">laden</button><br> + <jl-contact_mail_button></jl-contact_mail_button> Matrix: <a href="https://matrix.jonasled.de/invite/#/@jonasled:jonasled.de">@matrix:jonasled.de</a> <h2>Haftungsausschluss</h2> @@ -33,7 +33,7 @@ getHeader("Impressum", ""); button.parentNode.replaceChild(emailElement, button); } }; - xmlhttp.open("POST", "/internal/getMail.php", true); + xmlhttp.open("POST", "/API/getMail.php", true); xmlhttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded"); xmlhttp.send("h-captcha-response=" + token); };