-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.js
More file actions
28 lines (23 loc) · 806 Bytes
/
index.js
File metadata and controls
28 lines (23 loc) · 806 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
document.addEventListener("DOMContentLoaded", () => {
document.querySelectorAll(".levels a").forEach(link => {
const id = link.dataset.id;
const score = localStorage.getItem(id);
if (score === "30") {
link.classList.add("completed");
link.title = "Completed (30/30)";
}
});
});
document.addEventListener("DOMContentLoaded", () => {
const timerToggle = document.getElementById("show-timer");
const testLinks = document.querySelectorAll(".levels a");
testLinks.forEach(link => {
link.addEventListener("click", (e) => {
e.preventDefault();
const href = link.getAttribute("href");
const timerEnabled = timerToggle.checked;
const finalUrl = timerEnabled ? href : `${href}&timer=off`;
window.location.href = finalUrl;
});
});
});