From 0f48251fc0d6fc8f0f60c147a327dc6055d80a8a Mon Sep 17 00:00:00 2001 From: Ryan Stafford Date: Wed, 4 Oct 2023 13:46:12 -0400 Subject: [PATCH] delete post confirm() #83 --- public/utils.js | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/public/utils.js b/public/utils.js index 13dc394..5355d2f 100644 --- a/public/utils.js +++ b/public/utils.js @@ -56,7 +56,7 @@ function commentClick(e) { } else { return } e.target.disabled = "disabled" if (data.get("op") == "delete_comment") { - if (!confirm("Are you sure you want to delete?")) { + if (!confirm("Are you sure?")) { return false } } @@ -242,6 +242,11 @@ function formSubmit(e) { targ.remove() return } + if (data.get("op") == "delete_post") { + if (!confirm("Are you sure?")) { + return false + } + } e.submitter.disabled = "disabled" request(targ.target, data, function(res){ @@ -267,6 +272,10 @@ function formSubmit(e) { targ.remove() return } + if (data.get("op") == "delete_post") { + window.location.reload() + return false + } targ.outerHTML = res setup() },