.
This commit is contained in:
Generated
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<project version="4">
|
<project version="4">
|
||||||
<component name="dataSourceStorageLocal" created-in="IU-261.25134.95">
|
<component name="dataSourceStorageLocal" created-in="IU-253.32098.101">
|
||||||
<data-source name="articles" uuid="315cb5c9-2b0f-435b-b602-59823b160908">
|
<data-source name="articles" uuid="315cb5c9-2b0f-435b-b602-59823b160908">
|
||||||
<database-info product="SQLite" version="3.51.1" jdbc-version="4.2" driver-name="SQLite JDBC" driver-version="3.51.1.0" dbms="SQLITE" exact-version="3.51.1" exact-driver-version="3.51">
|
<database-info product="SQLite" version="3.51.1" jdbc-version="4.2" driver-name="SQLite JDBC" driver-version="3.51.1.0" dbms="SQLITE" exact-version="3.51.1" exact-driver-version="3.51">
|
||||||
<identifier-quote-string>"</identifier-quote-string>
|
<identifier-quote-string>"</identifier-quote-string>
|
||||||
|
|||||||
@@ -457,6 +457,18 @@ if ($replyAuthor === null) {
|
|||||||
<button type="submit" class="button">
|
<button type="submit" class="button">
|
||||||
Kommentar senden
|
Kommentar senden
|
||||||
</button>
|
</button>
|
||||||
|
|
||||||
|
<p
|
||||||
|
id="comment-loading"
|
||||||
|
class="comment-loading"
|
||||||
|
role="status"
|
||||||
|
aria-live="polite"
|
||||||
|
hidden
|
||||||
|
>
|
||||||
|
<span class="comment-spinner" aria-hidden="true"></span>
|
||||||
|
Kommentar wird gesendet …
|
||||||
|
</p>
|
||||||
|
|
||||||
</form>
|
</form>
|
||||||
<?php else: ?>
|
<?php else: ?>
|
||||||
<div class="comment-login-hint">
|
<div class="comment-login-hint">
|
||||||
|
|||||||
@@ -225,4 +225,34 @@ h1 {
|
|||||||
text-align: center;
|
text-align: center;
|
||||||
text-decoration: none;
|
text-decoration: none;
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
|
}
|
||||||
|
.comment-loading {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 8px;
|
||||||
|
margin-top: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.comment-loading[hidden] {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.comment-spinner {
|
||||||
|
width: 16px;
|
||||||
|
height: 16px;
|
||||||
|
border: 2px solid #cbd5e1;
|
||||||
|
border-top-color: #1f2937;
|
||||||
|
border-radius: 50%;
|
||||||
|
animation: comment-spinner-rotation 0.8s linear infinite;
|
||||||
|
}
|
||||||
|
|
||||||
|
@keyframes comment-spinner-rotation {
|
||||||
|
to {
|
||||||
|
transform: rotate(360deg);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#comment-form button[type="submit"]:disabled {
|
||||||
|
cursor: wait;
|
||||||
|
opacity: 0.65;
|
||||||
}
|
}
|
||||||
+38
-1
@@ -11,7 +11,19 @@ document.addEventListener("DOMContentLoaded", function () {
|
|||||||
const parentCommentInput = document.getElementById("parent-comment-id");
|
const parentCommentInput = document.getElementById("parent-comment-id");
|
||||||
const replyInfo = document.getElementById("reply-info");
|
const replyInfo = document.getElementById("reply-info");
|
||||||
|
|
||||||
if (!form || !commentsList || !commentContent || !parentCommentInput) {
|
const submitButton = form
|
||||||
|
? form.querySelector('button[type="submit"]')
|
||||||
|
: null;
|
||||||
|
|
||||||
|
const loadingMessage = document.getElementById("comment-loading");
|
||||||
|
|
||||||
|
if (
|
||||||
|
!form
|
||||||
|
|| !commentsList
|
||||||
|
|| !commentContent
|
||||||
|
|| !parentCommentInput
|
||||||
|
|| !submitButton
|
||||||
|
) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -53,6 +65,23 @@ document.addEventListener("DOMContentLoaded", function () {
|
|||||||
form.addEventListener("submit", function (event) {
|
form.addEventListener("submit", function (event) {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Verhindert einen erneuten Submit, während der vorherige
|
||||||
|
* Kommentar noch gespeichert wird.
|
||||||
|
*/
|
||||||
|
if (submitButton.disabled) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const originalButtonText = submitButton.textContent;
|
||||||
|
|
||||||
|
submitButton.disabled = true;
|
||||||
|
submitButton.textContent = "Wird gesendet …";
|
||||||
|
|
||||||
|
if (loadingMessage) {
|
||||||
|
loadingMessage.hidden = false;
|
||||||
|
}
|
||||||
|
|
||||||
const formData = new FormData(form);
|
const formData = new FormData(form);
|
||||||
const parentCommentId = parentCommentInput.value;
|
const parentCommentId = parentCommentInput.value;
|
||||||
|
|
||||||
@@ -269,6 +298,14 @@ document.addEventListener("DOMContentLoaded", function () {
|
|||||||
.catch(function (error) {
|
.catch(function (error) {
|
||||||
console.error(error);
|
console.error(error);
|
||||||
alert("Kommentar konnte nicht gesendet werden.");
|
alert("Kommentar konnte nicht gesendet werden.");
|
||||||
|
})
|
||||||
|
.finally(function () {
|
||||||
|
submitButton.disabled = false;
|
||||||
|
submitButton.textContent = originalButtonText;
|
||||||
|
|
||||||
|
if (loadingMessage) {
|
||||||
|
loadingMessage.hidden = true;
|
||||||
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user