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
+13
View File
@@ -1347,4 +1347,17 @@ h2:has(+ #exam-list:empty), h2:has(+ #packet-list:empty){
display: flex;
align-items: center;
gap: 15px;
}
.exit-exam-mode {
position: fixed;
bottom: 20px;
right: 20px;
background-color: #b71c1c;
color: white;
border: none;
padding: 10px 15px;
border-radius: 5px;
cursor: pointer;
z-index: 10000;
}
+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");
}
}