Skip to content

Commit b76d2fd

Browse files
authored
Update script.js
1 parent e58cd7a commit b76d2fd

1 file changed

Lines changed: 21 additions & 17 deletions

File tree

script.js

Lines changed: 21 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -10,24 +10,28 @@ let wordStats = {}; // Track {word: {failures: 0, successes: 0}}
1010
const clickSound = new Audio("click.wav");
1111

1212
// ===== License Popup Logic =====
13-
const licensePopup = document.getElementById("licensePopup");
14-
const closePopupBtn = document.getElementById("closePopup");
15-
const dontShowCheckbox = document.getElementById("dontShowAgain");
16-
17-
// Show popup if user hasn't opted out
18-
if (!localStorage.getItem("hideLicensePopup")) {
19-
licensePopup.style.display = "flex";
20-
}
21-
22-
// Close popup function
23-
closePopupBtn.onclick = () => {
24-
triggerGlow(closePopupBtn);
25-
if (dontShowCheckbox.checked) {
26-
localStorage.setItem("hideLicensePopup", "true");
13+
document.addEventListener("DOMContentLoaded", () => {
14+
const licensePopup = document.getElementById("licensePopup");
15+
const closePopupBtn = document.getElementById("closePopup");
16+
const dontShowCheckbox = document.getElementById("dontShowAgain");
17+
18+
// Show popup if user hasn't opted out
19+
if (!localStorage.getItem("hideLicensePopup")) {
20+
licensePopup.style.display = "flex";
21+
} else {
22+
licensePopup.style.display = "none";
2723
}
28-
licensePopup.style.display = "none";
29-
clickSound.play();
30-
};
24+
25+
// Close popup function
26+
closePopupBtn.onclick = () => {
27+
triggerGlow(closePopupBtn);
28+
if (dontShowCheckbox.checked) {
29+
localStorage.setItem("hideLicensePopup", "true");
30+
}
31+
licensePopup.style.display = "none";
32+
clickSound.play();
33+
};
34+
});
3135

3236
// ===== Word Stats Storage =====
3337
function loadWordStats() {

0 commit comments

Comments
 (0)