From 520ca7abdc78cacdaef2a5a77ec66a5089ff2728 Mon Sep 17 00:00:00 2001 From: Jonas Leder Date: Mon, 12 Apr 2021 20:43:43 +0200 Subject: [PATCH] add new custome element for link to mail --- js/customElements/contactMailButton.js | 14 ++++++++++++++ js/customElements/newComment.js | 1 - js/script.js | 3 ++- public/API/config.php | 3 --- public/{internal => API}/getMail.php | 2 +- public/impressum.php | 4 ++-- 6 files changed, 19 insertions(+), 8 deletions(-) create mode 100644 js/customElements/contactMailButton.js rename public/{internal => API}/getMail.php (94%) diff --git a/js/customElements/contactMailButton.js b/js/customElements/contactMailButton.js new file mode 100644 index 0000000..ce36339 --- /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:
`; + } +} + +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 92a6e27..bf92254 100644 --- a/js/customElements/newComment.js +++ b/js/customElements/newComment.js @@ -24,7 +24,6 @@ class newComment extends HTMLElement {

Mit dem Klick auf den obigen Button erklären sie sich mit der Datenschutzerklärung einverstanden.

`; - } } diff --git a/js/script.js b/js/script.js index 1057467..9662cc2 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 e8a2ce7..97fe747 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 20d8ae0..f10a90f 100644 --- a/public/internal/getMail.php +++ b/public/API/getMail.php @@ -1,5 +1,5 @@ $secretkey, 'response' => $_POST['h-captcha-response'] diff --git a/public/impressum.php b/public/impressum.php index 9396a28..57536ba 100644 --- a/public/impressum.php +++ b/public/impressum.php @@ -8,7 +8,7 @@ getHeader("Impressum", "");

Impressum

Jonas Leder

- E-Mail:
+ Matrix: @matrix:jonasled.de

Haftungsausschluss

@@ -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); };