-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript.js
More file actions
29 lines (25 loc) · 1.09 KB
/
script.js
File metadata and controls
29 lines (25 loc) · 1.09 KB
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
29
document.addEventListener('DOMContentLoaded', function() {
// Your existing JavaScript code here
const correctPassword = "2501"; // You can change this password
const passwordInput = document.getElementById('password-input');
const unlockButton = document.getElementById('unlock-btn');
const passwordContainer = document.getElementById('password-container');
const imageGallery = document.getElementById('image-gallery');
const errorMessage = document.getElementById('error-message');
// Unlock the image gallery
unlockButton.addEventListener('click', function() {
const enteredPassword = passwordInput.value.trim();
if (enteredPassword === correctPassword) {
passwordContainer.style.display = 'none'; // Hide password entry
imageGallery.style.display = 'block'; // Show image gallery
} else {
errorMessage.textContent = 'Incorrect password. Please try again.';
}
});
// Optionally, handle pressing Enter to unlock
passwordInput.addEventListener('keydown', function(event) {
if (event.key === 'Enter') {
unlockButton.click();
}
});
});