-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathscript.js
155 lines (140 loc) · 6.15 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
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
const localUrl = "resume.json";
async function loadResume() {
try {
const response = await fetch(localUrl);
const data = await response.json();
const resumeDiv = document.getElementById("resume");
// Header
const header = document.createElement("div");
header.classList.add("header", "row", "align-items-center", "mb-4");
header.innerHTML = `
<div class="col-md-3">
<img src="${data.profile.pictures[0].src}" alt="${data.profile.pictures[0].altText}" class="img-fluid rounded-circle profile-img">
</div>
<div class="col-md-9">
<h1 class="mb-3">${data.profile.Name}</h1>
<p class="lead">${data.profile.Description}</p>
<h3 class="mt-4">Key Achievements</h3>
<ul class="achievements-list">
${data.profile.KeyAchievments.map(achievement => `
<li>${achievement}</li>
`).join('')}
</ul>
</div>
`;
resumeDiv.appendChild(header);
// Github Stats
const ghstat = document.createElement("div");
ghstat.classList.add("section");
ghstat.innerHTML = `
<a href="https://github.com/martinfeineis/github-readme-stats">
<img height=200 align="center" src="https://github-readme-stats.vercel.app/api?username=martinfeineis" />
</a>
<a href="https://github.com/martinfeineis/convoychat">
<img height=200 align="center" src="https://github-readme-stats.vercel.app/api/top-langs?username=martinfeineis&layout=compact&langs_count=8&card_width=320" />
</a>
`;
resumeDiv.appendChild(ghstat);
// Skills
const skills = document.createElement("div");
skills.classList.add("section");
skills.innerHTML = `
<h2>Skills</h2>
<table class="skills-table">
<tbody>
${data.Skills.reduce((rows, skill, index) => {
if (index % 2 === 0) rows.push([]);
rows[Math.floor(index / 2)].push(skill);
return rows;
}, []).map(row => {
let leftSkill = row[0];
let rightSkill = row[1];
const leftName = Object.keys(leftSkill)[0];
const leftRating = Object.values(leftSkill)[0];
const leftStars = '★'.repeat(leftRating) + '☆'.repeat(5 - leftRating);
let rightContent = '';
if (rightSkill) {
const rightName = Object.keys(rightSkill)[0];
const rightRating = Object.values(rightSkill)[0];
const rightStars = '★'.repeat(rightRating) + '☆'.repeat(5 - rightRating);
rightContent = `
<td class="skill-name">${rightName}</td>
<td class="star-rating">${rightStars}</td>`;
} else {
rightContent = `<td class="skill-name"></td><td class="star-rating"></td>`;
}
return `
<tr>
<td class="skill-name">${leftName}</td>
<td class="star-rating">${leftStars}</td>
<td class="divider"></td>
${rightContent}
</tr>`;
}).join('')}
</tbody>
</table>`;
resumeDiv.appendChild(skills);
// Jobs
const jobs = document.createElement("div");
jobs.classList.add("section");
jobs.innerHTML = `<h2>Work Experience</h2>`;
data.jobs.forEach(job => {
jobs.innerHTML += `
<h3>${job.Company}</h3>
${job.Positions.map(pos => `
<div>
<h4>${pos.Title} (${pos.StartDate} - ${pos.EndDate})</h4>
<ul>
${pos.Responsibilities.map(resp => `<li>${resp}</li>`).join('')}
</ul>
</div>
`).join("")}
`;
});
resumeDiv.appendChild(jobs);
// Tech Stack
const techStack = document.createElement("div");
techStack.classList.add("section");
techStack.innerHTML = `
<h2>Technologies</h2>
<div class="tech-grid">
${Object.entries(data.TechIcons.techstack).map(([key, tech]) => `
<div class="tech-item">
<img src="${tech.bgimg}" alt="${tech.title}" class="tech-icon">
<h4>${tech.title}</h4>
<p>${tech.desc}</p>
</div>
`).join('')}
</div>
`;
resumeDiv.appendChild(techStack);
// Picture Gallery
// const gallery = document.createElement("div");
// gallery.classList.add("section");
// const activePictures = data.profile.pictures.filter(picture => picture.isActive);
// gallery.innerHTML = `
// <h2>Picture Gallery</h2>
// <div class="picture-gallery">${activePictures.map(picture => `
// <img src="${picture.src}" alt="${picture.altText}">
// `).join("")
// }</div>`;
// resumeDiv.appendChild(gallery);
// User Links
if (data.profile.userlinks && data.profile.userlinks.length) {
const userLinks = document.createElement("div");
userLinks.classList.add("section");
userLinks.innerHTML = `<h2>Links</h2>`;
data.profile.userlinks.forEach(link => {
const [key, value] = Object.entries(link)[0];
userLinks.innerHTML += `<p><a href="${value}" target="_blank">${key}</a></p>`;
});
resumeDiv.appendChild(userLinks);
}
// Add message section
resumeDiv.appendChild(createMessageSection());
} catch (error) {
console.error("Error loading JSON:", error);
document.getElementById("resume").innerHTML = `<p>Error loading resume. Please try again later.</p>`;
}
}
loadResume();