feat: add exit button for exam mode with URL parameter handling

This commit is contained in:
Ross
2026-07-05 21:10:58 +01:00
parent 32655c9fa8
commit 2ca3ae4761
2 changed files with 27 additions and 0 deletions
+14
View File
@@ -66,6 +66,20 @@ let url_exam_mode = false;
if (examParam !== null) {
if (examParam === "1" || String(examParam).toLowerCase() === "true") {
url_exam_mode = true;
let el = $("#load-exam-packet-instructions")
el.html("You are in exam mode.");
let button = $("<button class='exit-exam-mode'>Exit Exam Mode</button>");
button.click(() => {
// Remove exam_mode param from URL and reload page
params.delete("exam_mode");
const newUrl = `${window.location.pathname}?${params.toString()}`;
window.location.href = newUrl;
})
el.append(button);
el.append("<br/>Click on exam below to load it.");
log.debug("URL parameter enabled exam mode");
}
}