-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathscript.js
62 lines (52 loc) · 1.89 KB
/
script.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
57
58
59
60
61
62
// Typing animation
const terminalText = "./display_cv.sh";
let index = 0;
function typeText() {
const terminalElement = document.getElementById("user-header");
if (index < terminalText.length) {
terminalElement.innerHTML += terminalText.charAt(index);
index++;
setTimeout(typeText, 100); // Adjust the delay for typing speed
} else {
// After typing is complete, display the loading bar
displayProgressBar();
}
}
function displayProgressBar() {
const progressBar = document.getElementById("progress-bar-container");
progressBar.style.display = "inline-block";
// Simulate loading with a timeout
simulateLoading();
let progress = 0;
}
function simulateLoading() {
const progressBar = document.getElementById("progress-bar");
const loadingText = document.getElementById("loading-text");
let progress = 0;
const interval = setInterval(() => {
progressBar.textContent = `[${"#".repeat(progress/5+1)}${":".repeat(20-(progress/5+1))}]`;
progress += 5;
loadingText.textContent = `${progress}%`;
if (progress >= 100) {
clearInterval(interval);
displayContent();
}
}, 140); //Delay for loading simulation
}
function displayContent() {
const contentElement = document.getElementById("content");
contentElement.style.display = "block"; // Display the content
}
// Toggle between light and dark mode
function toggleMode() {
const body = document.body;
const terminal = document.getElementById("terminal");
// Toggle the body class for light/dark mode
body.classList.toggle("light-mode");
body.classList.toggle("dark-mode");
// Toggle the terminal class for dark mode border color
terminal.classList.toggle("dark-mode");
body.classList.toggle("light-mode");
}
// Call the typing function when the page loads
window.onload = typeText;