@@ -10,6 +10,11 @@ const nishaQuote = document.getElementById('nisha-quote');
1010const gamesSection = document . getElementById ( 'games-section' ) ;
1111const leaderboardSection = document . getElementById ( 'leaderboard-section' ) ;
1212const leaderboardList = document . getElementById ( 'leaderboard' ) ;
13+ const secretsBtn = document . getElementById ( 'secrets-btn' ) ;
14+ const passwordSection = document . getElementById ( 'password-section' ) ;
15+ const passwordInput = document . getElementById ( 'password-input' ) ;
16+ const submitPasswordBtn = document . getElementById ( 'submit-password' ) ;
17+ const passwordError = document . getElementById ( 'password-error' ) ;
1318
1419let userName = '' ; // No localStorage, reset on load
1520let scores = JSON . parse ( localStorage . getItem ( 'scores' ) ) || { tic : 0 , rps : 0 , memory : 0 } ; // Keep scores in localStorage
@@ -46,6 +51,20 @@ updateNameBtn.addEventListener('click', () => {
4651 }
4752} ) ;
4853
54+ secretsBtn . addEventListener ( 'click' , ( ) => showSection ( passwordSection ) ) ;
55+
56+ submitPasswordBtn . addEventListener ( 'click' , ( ) => {
57+ const password = passwordInput . value . trim ( ) ;
58+ if ( password === '143' ) {
59+ passwordInput . value = '' ;
60+ passwordError . classList . add ( 'hidden' ) ;
61+ window . location . href = 'secrets.html' ; // Redirect to new page
62+ } else {
63+ passwordError . classList . remove ( 'hidden' ) ;
64+ passwordInput . value = '' ;
65+ }
66+ } ) ;
67+
4968function showDashboard ( ) {
5069 // Hide welcome screen
5170 welcomeNote . classList . add ( 'hidden' ) ;
@@ -55,6 +74,7 @@ function showDashboard() {
5574 dashboardSection . classList . remove ( 'hidden' ) ;
5675 gamesSection . classList . add ( 'hidden' ) ;
5776 leaderboardSection . classList . add ( 'hidden' ) ;
77+ passwordSection . classList . add ( 'hidden' ) ;
5878 dashboardWelcome . textContent = `Hello, ${ userName } ! Welcome to your dashboard.` ;
5979 if ( userName . toLowerCase ( ) . includes ( 'nisha' ) ) {
6080 nishaQuote . textContent = lovelyQuotes [ Math . floor ( Math . random ( ) * lovelyQuotes . length ) ] ;
@@ -92,6 +112,7 @@ function showSection(section) {
92112 game1 . classList . add ( 'hidden' ) ;
93113 game2 . classList . add ( 'hidden' ) ;
94114 game3 . classList . add ( 'hidden' ) ;
115+ passwordSection . classList . add ( 'hidden' ) ;
95116 section . classList . remove ( 'hidden' ) ;
96117}
97118
0 commit comments