add new custome element for link to mail
This commit is contained in:
parent
15c99a4e0c
commit
520ca7abdc
14
js/customElements/contactMailButton.js
Normal file
14
js/customElements/contactMailButton.js
Normal file
|
@ -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);
|
|
@ -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>
|
||||
`;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -10,4 +10,5 @@ require("./customElements/svgLoader");
|
|||
require("./customElements/blogFooter");
|
||||
require("./customElements/blogIndex");
|
||||
require("./customElements/commentsDisplay");
|
||||
require("./customElements/newComment");
|
||||
require("./customElements/newComment");
|
||||
require("./customElements/contactMailButton");
|
|
@ -4,9 +4,6 @@ require "./lib/config.php";
|
|||
$configValue = $_GET['name'];
|
||||
|
||||
switch ($configValue){
|
||||
case "contactmail":
|
||||
echo($contactmail);
|
||||
break;
|
||||
case "sitekey":
|
||||
echo($sitekey);
|
||||
break;
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<?php
|
||||
include("./config.php");
|
||||
include("./lib/config.php");
|
||||
$data = array(
|
||||
'secret' => $secretkey,
|
||||
'response' => $_POST['h-captcha-response']
|
|
@ -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);
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue