-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcivil.js
37 lines (31 loc) · 1.21 KB
/
civil.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
// Loading Screen
window.onload = function() {
const loadingText = document.getElementById('loading-text');
// Move Goku and then show text
setTimeout(function() {
loadingText.style.display = 'block'; // Show the loading text
loadingText.style.opacity = 1; // Fade in the text
}, 3000); // Show text after Goku finishes moving
// Hide the loading screen after an additional 3 seconds
setTimeout(function() {
const loadingScreen = document.getElementById('loading-screen');
loadingScreen.style.display = 'none'; // Hide the loading screen
}, 1850); // Total of 6 seconds before hiding the loading screen
};
// Dark & Light Mode Switch
const toggle = document.getElementById('toggle');
const body = document.body;
// Load theme preference from localStorage (if exists)
if (localStorage.getItem('theme') === 'light') {
body.classList.add('light-mode');
toggle.checked = true;
}
toggle.addEventListener('change', () => {
body.classList.toggle('light-mode');
// Save theme preference in localStorage
if (body.classList.contains('light-mode')) {
localStorage.setItem('theme', 'light');
} else {
localStorage.setItem('theme', 'dark');
}
});