forked from rogerpoliver/resume
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathscript.js
80 lines (72 loc) · 2.95 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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
fetch("data.json")
.then((response) => response.json())
.then((data) => {
document.title = `${data.name} - Resume`; // Set the document title dynamically
document.getElementById("name").textContent = data.name;
document.getElementById("title").textContent = data.title;
document.getElementById(
"contact"
).textContent = `${data.location} | ✉️ ${data.email}`;
document.getElementById("links").innerHTML = `
🌐 <a href="${data.linkedin}">LinkedIn</a> | <a href="${data.github}">GitHub</a>
`;
document.getElementById("summary").textContent = data.summary;
document.getElementById("summary").innerHTML = data.summary;
const experienceContainer = document.getElementById("experience");
data.experience.forEach((job) => {
const jobDiv = document.createElement("div");
jobDiv.innerHTML = `
<h3>${job.title} – ${job.company}</h3>
<p class="date">${job.date}</p>
<ul>${job.tasks.map((task) => `<li>${task}</li>`).join("")}</ul>
`;
experienceContainer.appendChild(jobDiv);
});
const educationContainer = document.getElementById("education");
data.education.forEach((edu) => {
const eduDiv = document.createElement("div");
eduDiv.innerHTML = `
<strong>${edu.degree} in ${edu.field}</strong>
<p class="date">${edu.date}</p>
`;
educationContainer.appendChild(eduDiv);
});
const skillsContainer = document.getElementById("skills");
data.skills.forEach((skill) => {
const li = document.createElement("li");
li.textContent = skill;
skillsContainer.appendChild(li);
});
const certificationsContainer = document.getElementById("certifications");
data.certifications.forEach((cert) => {
const li = document.createElement("li");
li.textContent = `${cert.name} - ${cert.institution} (${cert.date})`;
certificationsContainer.appendChild(li);
});
document.getElementById("languages").textContent =
data.languages.join(" | ");
const volunteeringContainer = document.getElementById("volunteering");
data.volunteering.forEach((volunteer) => {
const div = document.createElement("div");
div.innerHTML = `
<h3>${volunteer.role} – ${volunteer.organization}</h3>
<p class="date">${volunteer.date}</p>
<p>${volunteer.description}</p>
`;
volunteeringContainer.appendChild(div);
});
const opensourceContainer = document.getElementById("opensource");
data.opensource?.forEach((contribution) => {
const div = document.createElement("div");
div.innerHTML = `
<h3>${contribution.project}</h3>
<p>${contribution.description}</p>
<p><a href="${contribution.link}">View Contribution</a></p>
`;
opensourceContainer.appendChild(div);
});
document.getElementById(
"footer"
).textContent = `© ${new Date().getFullYear()} - ${data.name}`;
})
.catch((error) => console.error("Error loading the data:", error));