From 5eca2f162b0a802b1367b4352470b61953d2ae94 Mon Sep 17 00:00:00 2001 From: Caroline Schulte Date: Sun, 19 Jul 2026 20:10:51 +0200 Subject: [PATCH] . --- content/search-results.php | 31 ++++++++++++++++--------------- content/showArticle.php | 30 ++++++++++++++++++++---------- index.php | 1 - js/comments.js | 22 ++++++++++++++++++++-- 4 files changed, 56 insertions(+), 28 deletions(-) diff --git a/content/search-results.php b/content/search-results.php index d9a6399..956b416 100644 --- a/content/search-results.php +++ b/content/search-results.php @@ -123,9 +123,9 @@ $categories = [ - + @@ -189,21 +189,22 @@ $categories = [ - + diff --git a/content/showArticle.php b/content/showArticle.php index c5152c1..ae55dbd 100644 --- a/content/showArticle.php +++ b/content/showArticle.php @@ -251,11 +251,23 @@ if ($replyAuthor === null) { (string) $comment->getArticleId() ); ?>"> - +
+ + + + + + +
@@ -383,11 +395,9 @@ if ($replyAuthor === null) { (string) $reply->getArticleId() ); ?>"> - +
diff --git a/index.php b/index.php index 31cbe28..67b3238 100644 --- a/index.php +++ b/index.php @@ -26,7 +26,6 @@ include_once "php/controller/index-controller.php"; - diff --git a/js/comments.js b/js/comments.js index b9b83b0..d1c648b 100644 --- a/js/comments.js +++ b/js/comments.js @@ -11,6 +11,26 @@ document.addEventListener("DOMContentLoaded", function () { const parentCommentInput = document.getElementById("parent-comment-id"); const replyInfo = document.getElementById("reply-info"); + /** + * Fragt vor dem Löschen eines Kommentars nach einer Bestätigung. + * + * Der Listener funktioniert auch für Kommentare, + * die später per AJAX eingefügt werden. + */ + document.addEventListener("submit", function (event) { + if (!event.target.classList.contains("delete-comment-form")) { + return; + } + + const confirmed = confirm( + "Möchtest du diesen Kommentar wirklich löschen?" + ); + + if (!confirmed) { + event.preventDefault(); + } + }); + if (!form || !commentsList || !commentContent || !parentCommentInput) { return; } @@ -152,7 +172,6 @@ document.addEventListener("DOMContentLoaded", function () { @@ -230,7 +249,6 @@ document.addEventListener("DOMContentLoaded", function () {