-
-
Save randPharoah/3a80bd43ec3e43c6213f02da25450cb5 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Get references to page elements | |
| const passwordModal = document.querySelector('.modal'); | |
| const passwordInput = document.querySelector('.modal input'); | |
| const unlockBtn = document.querySelector('.modal button'); | |
| const notesSection = document.querySelector('.notes'); | |
| // Open password modal | |
| function openPasswordModal() { | |
| passwordModal.style.display = 'flex'; | |
| } | |
| // Close password modal | |
| function closePasswordModal() { | |
| passwordModal.style.display = 'none'; | |
| } | |
| // Unlock notes | |
| function unlockNotes(password) { | |
| // Validate password | |
| if (password === 'secret') { | |
| notesSection.style.filter = 'blur(0px)'; | |
| } else { | |
| alert('Incorrect password'); | |
| } | |
| } | |
| // Check password when modal is opened | |
| openPasswordModal(); | |
| // Submit password | |
| unlockBtn.addEventListener('click', () => { | |
| unlockNotes(passwordInput.value); | |
| closePasswordModal(); | |
| }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment