-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript.js
More file actions
165 lines (120 loc) · 3.65 KB
/
Copy pathscript.js
File metadata and controls
165 lines (120 loc) · 3.65 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
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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
const toggle = document.getElementById("theme-toggle");
// load saved theme
const savedTheme = localStorage.getItem("theme");
if (savedTheme === "light") {
document.body.classList.add("light-mode");
toggle.checked = true;
}
// toggle theme
toggle.addEventListener("change", function() {
if (toggle.checked) {
document.body.classList.add("light-mode");
localStorage.setItem("theme", "light");
} else {
document.body.classList.remove("light-mode");
localStorage.setItem("theme", "dark");
}
})
// welcome title in diff languages
const welcome = document.getElementById("welcome");
const greetings = [
"Welcome",
"Willkommen",
"Bienvenue",
"Bienvenido",
"Benvenuto",
"Welkom",
"स्वागत है",
"স্বাগতম",
"ようこそ",
"환영합니다",
"欢迎"
];
let currentGreeting = 0;
setInterval(function() {
welcome.style.opacity = 0;
setTimeout(function() {
currentGreeting++;
if (currentGreeting >= greetings.length) {
currentGreeting = 0;
}
welcome.textContent = greetings[currentGreeting];
welcome.style.opacity = 1;
}, 1250);
}, 5000);
// Know-me slider functionality
let information;
const slider = document.getElementById("info-slider");
const introduction = document.getElementById("introduction");
const skillsPanel = document.getElementById("skills-panel");
const researchPanel = document.getElementById("research-panel");
const skillsList = document.getElementById("skills-list");
const researchList = document.getElementById("research-list");
const cvPanel = document.getElementById('cv-panel');
fetch("data/details_2026.json")
.then(response => {
if (!response.ok) {
throw new Error("Could not load JSON file");
}
return response.json();
})
.then(data => {
information = data;
updateIntroduction();
})
.catch(error => {
console.error("Error loading information:", error);
});
function updateIntroduction() {
const level = slider.value;
const info = information[level];
introduction.innerHTML = "";
info.content.forEach(paragraph => {
const p = document.createElement("p");
p.className = "personal-details";
p.textContent = paragraph;
introduction.appendChild(p);
});
// link to CV
if (info.cv) {
const p = document.createElement("p");
p.className = "personal-details";
const link = document.createElement("a");
link.href = info.cv;
link.textContent = "CV";
link.target = "_blank";
p.appendChild(link);
introduction.appendChild(p);
}
// skills panel
skillsList.innerHTML = "";
if (info.skills) {
info.skills.forEach(skill => {
const li = document.createElement("li");
li.textContent = skill;
skillsList.appendChild(li);
});
skillsPanel.classList.add("show");
} else {
skillsPanel.classList.remove("show");
}
// research panel
researchList.innerHTML = "";
if (info.research) {
info.research.forEach(item => {
const li = document.createElement("li");
li.textContent = item;
researchList.appendChild(li);
});
researchPanel.classList.add("show");
} else {
researchPanel.classList.remove("show");
}
// CV panel
if (info.cv && Number(level) >= 11) {
cvPanel.classList.add("show");
} else {
cvPanel.classList.remove("show");
}
}
slider.addEventListener("input", updateIntroduction);