summaryrefslogtreecommitdiff
path: root/static/js/dynamic-comment-form.js
diff options
context:
space:
mode:
authorJakob L. Kreuze <zerodaysfordays@sdf.org>2026-02-16 12:26:20 -0500
committerJakob L. Kreuze <zerodaysfordays@sdf.org>2026-02-16 12:26:20 -0500
commitc00ace03d64001c6fb49d7ba7e25d75386eb6ae9 (patch)
treec0a0773eefd1a53b0f8c85dc530812ade19c561f /static/js/dynamic-comment-form.js
parentc7cdffa549be231fff7a8a38dbc7caaadd9663a3 (diff)
Fix comment form
Diffstat (limited to 'static/js/dynamic-comment-form.js')
-rw-r--r--static/js/dynamic-comment-form.js25
1 files changed, 12 insertions, 13 deletions
diff --git a/static/js/dynamic-comment-form.js b/static/js/dynamic-comment-form.js
index ff5f875..809a755 100644
--- a/static/js/dynamic-comment-form.js
+++ b/static/js/dynamic-comment-form.js
@@ -42,19 +42,15 @@ function makeRequest (method, url) {
}
window.addEventListener("load", () => {
- let primaryDisplay = document.getElementById("comment-form-primary");
+ let primaryDisplay = document.getElementById("comment-form");
primaryDisplay.removeAttribute("hidden");
- let altDisplay = document.getElementById("comment-form-alt");
- altDisplay.remove();
+ const altDisplay = document.getElementById("captcha-alternative-wrapper");
let trigger = document.getElementById("captcha-challenge-trigger");
- let triggerBlock = document.getElementById("captcha-trigger-block");
trigger.addEventListener("click", (event) => {
- let captchaField = document.getElementById("comment-captcha");
-
let captchaId = document.getElementById("captcha-id");
- let captchaImage = document.getElementById("captcha-image");
+ let wrapper = document.getElementById("captcha-image-wrapper");
trigger.innerHTML = "Please wait...";
trigger.disabled = true;
@@ -65,13 +61,17 @@ window.addEventListener("load", () => {
// Update form with parsed values.
let challengeData = JSON.parse(data);
captchaId.value = challengeData["challenge-id"];
- captchaImage.src = challengeData["image"];
- // Unhide fieldset.
- captchaField.removeAttribute("hidden");
+ const img = document.createElement('img');
+ img.src = challengeData["image"];
+ // img.src = `data:image/png;base64,${base64Data}`;
+ wrapper.innerHTML = '';
+ wrapper.appendChild(img);
+
+ trigger.hidden = true;
- // Hide initial trigger.
- triggerBlock.remove();
+ // Unhide fieldset.
+ altDisplay.removeAttribute("hidden");
})
.catch(console.err);
}
@@ -80,7 +80,6 @@ window.addEventListener("load", () => {
});
});
-
window.addEventListener("load", () => {
// Unhide additional comment actions if Javascript is enabled.
let additionalActionsRows = document.querySelectorAll(".comment-additional-actions");