-
Notifications
You must be signed in to change notification settings - Fork 0
/
page3.js
56 lines (48 loc) · 1.72 KB
/
page3.js
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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
function openSettings() {
var settingsPage = document.querySelector('.settings-page');
settingsPage.style.display = 'block';
}
function closeSettings() {
var settingsPage = document.querySelector('.settings-page');
settingsPage.style.display = 'none';
}
function toggleDarkMode() {
var body = document.querySelector('body');
body.classList.toggle('dark-mode');
// Store dark mode preference
var darkModeCheckbox = document.querySelector('input[name="darkMode"]');
localStorage.setItem('darkMode', darkModeCheckbox.checked);
}
// Retrieve the dark mode preference from localStorage and apply the dark mode on page load
document.addEventListener('DOMContentLoaded', function () {
var body = document.querySelector('body');
var darkModeCheckbox = document.querySelector('input[name="darkMode"]');
darkModeCheckbox.checked = localStorage.getItem('darkMode') === 'true';
if (darkModeCheckbox.checked) {
body.classList.add('dark-mode');
var imageGallery = document.querySelector('.image-gallery');
imageGallery.classList.add('dark-mode');
}
});
function showEditForm() {
var editForm = document.querySelector('.editForm');
editForm.style.display = 'block';
}
function cancelEditForm() {
var editForm = document.querySelector('.editForm');
editForm.style.display = 'none';
}
function removeUpload() {
if (confirm("Are you sure you want to remove the upload?")) {
var form = document.createElement('form');
form.method = 'post';
var input = document.createElement('input');
input.type = 'hidden';
input.name = 'removeUpload';
input.value = '1';
form.appendChild(input);
document.body.appendChild(form);
form.submit();
}
}
// completed the project