@@ -10,24 +10,28 @@ let wordStats = {}; // Track {word: {failures: 0, successes: 0}}
1010const 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 =====
3337function loadWordStats ( ) {
0 commit comments