add custome element for new comment
This commit is contained in:
parent
4fc68e7974
commit
fbac380ec4
4 changed files with 35 additions and 22 deletions
31
js/customElements/newComment.js
Normal file
31
js/customElements/newComment.js
Normal file
|
@ -0,0 +1,31 @@
|
|||
class newComment extends HTMLElement {
|
||||
constructor() {
|
||||
super();
|
||||
this.setupForm();
|
||||
}
|
||||
|
||||
async setupForm(){
|
||||
let sitekey = await (await fetch("/API/config.php?name=sitekey")).text();
|
||||
|
||||
this.innerHTML = `
|
||||
<form action="/newComment.php" method="post">
|
||||
<label for="name">Name:</label><br>
|
||||
<input type="text" id="name" name="name"><br><br>
|
||||
|
||||
<label for="email">E-Mail: (wird nicht veröffentlicht)</label><br>
|
||||
<input type="text" id="email" name="email"><br><br>
|
||||
|
||||
<label for="comment">Kommentar:</label><br>
|
||||
<textarea name="comment" id="comment"></textarea><br><br>
|
||||
|
||||
<div class="h-captcha" data-theme="dark" data-sitekey="${sitekey}"></div><br>
|
||||
|
||||
<input type="submit" value="Kommentar veröffentlichen"><br>
|
||||
<p>Mit dem Klick auf den obigen Button erklären sie sich mit der <a href="/datenschutzerklaerung.html">Datenschutzerklärung</a> einverstanden.</p>
|
||||
</form>
|
||||
`;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
customElements.define("jl-new_comment", newComment);
|
|
@ -9,4 +9,5 @@ require("./customElements/cookie");
|
|||
require("./customElements/svgLoader");
|
||||
require("./customElements/blogFooter");
|
||||
require("./customElements/blogIndex");
|
||||
require("./customElements/commentsDisplay");
|
||||
require("./customElements/commentsDisplay");
|
||||
require("./customElements/newComment");
|
|
@ -1,5 +1,4 @@
|
|||
<?php
|
||||
include "config.php";
|
||||
|
||||
$conn = new mysqli($mysqlServer, $mysqlUser, $mysqlPassword, $mysqlDatabase);
|
||||
// Check connection
|
||||
|
|
|
@ -2,27 +2,9 @@
|
|||
|
||||
function getComments($article){
|
||||
echo(<<<EOF
|
||||
<script src='https://www.hCaptcha.com/1/api.js' async defer></script>
|
||||
<h2>Kommentare:</h2>
|
||||
<jl-comments_display></jl-comments_display>
|
||||
<script src='https://www.hCaptcha.com/1/api.js' async defer></script>
|
||||
<div id="newComment">
|
||||
<form action="/newComment.php" method="post">
|
||||
<label for="name">Name:</label><br>
|
||||
<input type="text" id="name" name="name"><br><br>
|
||||
|
||||
<label for="email">E-Mail: (wird nicht veröffentlicht)</label><br>
|
||||
<input type="text" id="email" name="email"><br><br>
|
||||
|
||||
<label for="comment">Kommentar:</label><br>
|
||||
<textarea name="comment" id="comment"></textarea><br><br>
|
||||
|
||||
<div class="h-captcha" data-theme="dark" data-sitekey="$sitekey"></div><br>
|
||||
|
||||
<input type="submit" value="Kommentar veröffentlichen"><br>
|
||||
<p>Mit dem klick auf den obigen Button erklären sie sich mit der <a href="/datenschutzerklaerung.html">Datenschutzerklärung</a> einverstanden.</p>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
|
||||
<jl-new_comment id="newComment"></jl-new_comment>
|
||||
EOF);
|
||||
}
|
Loading…
Reference in a new issue