From e90667a37e4279899e267bbb25c667f8eb8cd1ef Mon Sep 17 00:00:00 2001 From: Ross Date: Mon, 19 Jan 2026 11:52:45 +0000 Subject: [PATCH] feat: enhance error submission overlay with improved messaging and close button functionality --- js/interact.js | 2 +- js/main.js | 14 +++++++++++--- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/js/interact.js b/js/interact.js index 9bceeaf..fd25bce 100644 --- a/js/interact.js +++ b/js/interact.js @@ -140,7 +140,7 @@ export function submissionError(data, answer_json, exam_details) { if ($("#submit-error-overlay").length < 1) { $("body").append( - `

An error has occurred when submitting your answers. A copy of your answers are displayed below, you may wish to save a copy. Please try submitting again or refresh this page to continue (answers will be saved locally in the browser unless you clear local storage).

${html.get(0).innerHTML}

${JSON.stringify( + `

An error has occurred when submitting your answers. A copy of your answers are displayed below, you may wish to save a copy if subsequent submissions still fail. Please try submitting again or refresh this page to continue (answers will be saved locally in the browser unless you clear local storage).

${html.get(0).innerHTML}

${JSON.stringify( answer_json )}

` ); diff --git a/js/main.js b/js/main.js index 8638a39..b0869c1 100644 --- a/js/main.js +++ b/js/main.js @@ -2949,14 +2949,22 @@ $("#btn-view-local-answers").click(async function(evt) { if ($("#view-answers-overlay").length < 1) { $("body").append( - `

${JSON.stringify( - answer_json - )}

` + `
+ +
+
${JSON.stringify(answer_json, null, 2)}
+
+
` ); $("#view-answers-overlay").height(docHeight); $("#view-answers-overlay").append("Save") + // Close button handler + $("#close-view-answers").on("click", function() { + $("#view-answers-overlay").remove(); + }); + let file = new Blob([JSON.stringify(answer_json)], {type: "application/json"}) let link = document.getElementById("save-failed-answers");