jsonresume-theme-wintermuted 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +43 -0
- package/helpers/date-helpers.js +18 -0
- package/helpers/index.js +18 -0
- package/helpers/link-projects.js +52 -0
- package/helpers/nested-work.js +27 -0
- package/helpers/projects-by-category.js +22 -0
- package/helpers/projects-for-role.js +134 -0
- package/index.js +98 -0
- package/package.json +38 -0
- package/partials/awards.hbs +15 -0
- package/partials/education.hbs +28 -0
- package/partials/interests.hbs +19 -0
- package/partials/languages.hbs +10 -0
- package/partials/projects.hbs +177 -0
- package/partials/skills.hbs +19 -0
- package/partials/summary.hbs +8 -0
- package/partials/volunteer.hbs +30 -0
- package/partials/work.hbs +72 -0
- package/resume.hbs +1025 -0
- package/style.css +1507 -0
package/resume.hbs
ADDED
|
@@ -0,0 +1,1025 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="utf-8" />
|
|
5
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
6
|
+
{{#resume.basics}}
|
|
7
|
+
<title>{{ name }} — Resume</title>
|
|
8
|
+
{{/resume.basics}}
|
|
9
|
+
<link rel="preconnect" href="https://fonts.googleapis.com" />
|
|
10
|
+
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
|
|
11
|
+
<link
|
|
12
|
+
href="https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600&display=swap"
|
|
13
|
+
rel="stylesheet"
|
|
14
|
+
/>
|
|
15
|
+
<style>{{{css}}}</style>
|
|
16
|
+
</head>
|
|
17
|
+
<body>
|
|
18
|
+
<div class="tile-bg" aria-hidden="true"></div>
|
|
19
|
+
<button class="gol-btn" id="gol-btn" type="button">Play the game?</button>
|
|
20
|
+
|
|
21
|
+
<div class="header-sentinel" aria-hidden="true"></div>
|
|
22
|
+
{{#resume.basics}}
|
|
23
|
+
<header class="header">
|
|
24
|
+
<div class="header-top">
|
|
25
|
+
<div class="header-name">
|
|
26
|
+
<h1>{{ name }}</h1>
|
|
27
|
+
<p class="label">{{ label }}</p>
|
|
28
|
+
</div>
|
|
29
|
+
<div class="controls">
|
|
30
|
+
<button class="print-btn" aria-label="Print resume" type="button" onclick="window.print()">⎙ Print</button>
|
|
31
|
+
<button class="view-toggle" aria-label="Toggle view" type="button">
|
|
32
|
+
<span class="control-icon" aria-hidden="true">☰</span>
|
|
33
|
+
<span class="control-label">Summary</span>
|
|
34
|
+
</button>
|
|
35
|
+
<button class="nav-pos-toggle" aria-label="Toggle nav position" type="button">Nav →</button>
|
|
36
|
+
<button class="layout-mode-toggle" aria-label="Toggle layout width" type="button">
|
|
37
|
+
<span class="control-icon" aria-hidden="true">⛶</span>
|
|
38
|
+
<span class="control-label">Full Width</span>
|
|
39
|
+
</button>
|
|
40
|
+
<button class="theme-toggle" aria-label="Toggle dark mode" type="button">
|
|
41
|
+
<span class="icon-moon">☾</span>
|
|
42
|
+
<span class="icon-sun">☼</span>
|
|
43
|
+
</button>
|
|
44
|
+
</div>
|
|
45
|
+
</div>
|
|
46
|
+
<div class="header-contact">
|
|
47
|
+
{{#if email}}<span><a href="mailto:{{ email }}">{{ email }}</a></span>{{/if}}
|
|
48
|
+
{{#if phone}}<span>{{ phone }}</span>{{/if}}
|
|
49
|
+
{{#if location}}<span>{{ location.city }}, {{ location.region }}</span>{{/if}}
|
|
50
|
+
{{#if url}}<span><a href="{{ url }}">{{ url }}</a></span>{{/if}}
|
|
51
|
+
{{#each profiles}}
|
|
52
|
+
<span><a href="{{ url }}">{{ network }}</a></span>
|
|
53
|
+
{{/each}}
|
|
54
|
+
</div>
|
|
55
|
+
</header>
|
|
56
|
+
{{/resume.basics}}
|
|
57
|
+
|
|
58
|
+
<div class="layout">
|
|
59
|
+
<nav class="side-nav" id="side-nav" aria-label="Section navigation"></nav>
|
|
60
|
+
|
|
61
|
+
<main>
|
|
62
|
+
{{> summary}}
|
|
63
|
+
{{> work}}
|
|
64
|
+
{{> projects}}
|
|
65
|
+
{{> skills}}
|
|
66
|
+
{{> education}}
|
|
67
|
+
{{> volunteer}}
|
|
68
|
+
{{> awards}}
|
|
69
|
+
{{> languages}}
|
|
70
|
+
{{> interests}}
|
|
71
|
+
</main>
|
|
72
|
+
</div>
|
|
73
|
+
|
|
74
|
+
{{#resume.basics}}
|
|
75
|
+
<section class="contact-section" aria-label="Contact information">
|
|
76
|
+
<h2>Contact</h2>
|
|
77
|
+
<div class="contact-links">
|
|
78
|
+
{{#if email}}<a href="mailto:{{ email }}">{{ email }}</a>{{/if}}
|
|
79
|
+
{{#each profiles}}
|
|
80
|
+
<a href="{{ url }}">{{ network }}</a>
|
|
81
|
+
{{/each}}
|
|
82
|
+
</div>
|
|
83
|
+
</section>
|
|
84
|
+
{{/resume.basics}}
|
|
85
|
+
|
|
86
|
+
<script>
|
|
87
|
+
(function () {
|
|
88
|
+
var html = document.documentElement;
|
|
89
|
+
|
|
90
|
+
/* --- Dark / Light theme --- */
|
|
91
|
+
var themeBtn = document.querySelector('.theme-toggle');
|
|
92
|
+
var storedTheme = localStorage.getItem('theme');
|
|
93
|
+
if (storedTheme) {
|
|
94
|
+
html.setAttribute('data-theme', storedTheme);
|
|
95
|
+
} else if (window.matchMedia('(prefers-color-scheme: dark)').matches) {
|
|
96
|
+
html.setAttribute('data-theme', 'dark');
|
|
97
|
+
}
|
|
98
|
+
themeBtn.addEventListener('click', function () {
|
|
99
|
+
var next = html.getAttribute('data-theme') === 'dark' ? 'light' : 'dark';
|
|
100
|
+
html.setAttribute('data-theme', next);
|
|
101
|
+
localStorage.setItem('theme', next);
|
|
102
|
+
});
|
|
103
|
+
|
|
104
|
+
/* --- Detailed / Summary view --- */
|
|
105
|
+
var viewBtn = document.querySelector('.view-toggle');
|
|
106
|
+
var storedView = localStorage.getItem('view');
|
|
107
|
+
html.setAttribute('data-view', storedView || 'summary');
|
|
108
|
+
function updateViewLabel() {
|
|
109
|
+
var current = html.getAttribute('data-view');
|
|
110
|
+
var nextLabel = current === 'summary' ? 'Detailed' : 'Summary';
|
|
111
|
+
var nextIcon = current === 'summary' ? '▦' : '☰';
|
|
112
|
+
viewBtn.innerHTML =
|
|
113
|
+
'<span class="control-icon" aria-hidden="true">' +
|
|
114
|
+
nextIcon +
|
|
115
|
+
'</span><span class="control-label">' +
|
|
116
|
+
nextLabel +
|
|
117
|
+
'</span>';
|
|
118
|
+
}
|
|
119
|
+
updateViewLabel();
|
|
120
|
+
viewBtn.addEventListener('click', function () {
|
|
121
|
+
var next = html.getAttribute('data-view') === 'summary' ? 'detailed' : 'summary';
|
|
122
|
+
html.setAttribute('data-view', next);
|
|
123
|
+
localStorage.setItem('view', next);
|
|
124
|
+
updateViewLabel();
|
|
125
|
+
// Collapse all expanded sections when switching to detailed
|
|
126
|
+
if (next === 'detailed') {
|
|
127
|
+
document.querySelectorAll('.detail-content.expanded').forEach(function (el) {
|
|
128
|
+
el.classList.remove('expanded');
|
|
129
|
+
});
|
|
130
|
+
document.querySelectorAll('.expand-toggle.expanded').forEach(function (el) {
|
|
131
|
+
el.classList.remove('expanded');
|
|
132
|
+
el.firstChild.textContent = 'Show details';
|
|
133
|
+
});
|
|
134
|
+
}
|
|
135
|
+
});
|
|
136
|
+
|
|
137
|
+
/* --- Expand / Collapse individual sections --- */
|
|
138
|
+
document.querySelectorAll('.expand-toggle').forEach(function (btn) {
|
|
139
|
+
btn.addEventListener('click', function () {
|
|
140
|
+
var content = btn.nextElementSibling;
|
|
141
|
+
var isExpanded = content.classList.toggle('expanded');
|
|
142
|
+
btn.classList.toggle('expanded', isExpanded);
|
|
143
|
+
btn.firstChild.textContent = isExpanded ? 'Hide details' : 'Show details';
|
|
144
|
+
|
|
145
|
+
// Mermaid diagrams inside collapsed detail blocks render at tiny sizes
|
|
146
|
+
// if initialized while hidden. Render them when the block is expanded.
|
|
147
|
+
if (isExpanded && typeof window.renderMermaidIn === 'function') {
|
|
148
|
+
window.renderMermaidIn(content);
|
|
149
|
+
}
|
|
150
|
+
});
|
|
151
|
+
});
|
|
152
|
+
|
|
153
|
+
/* --- Nav Position Toggle --- */
|
|
154
|
+
var navPosBtn = document.querySelector('.nav-pos-toggle');
|
|
155
|
+
var storedNavPos = localStorage.getItem('nav-position');
|
|
156
|
+
if (storedNavPos) {
|
|
157
|
+
html.setAttribute('data-nav', storedNavPos);
|
|
158
|
+
}
|
|
159
|
+
function updateNavPosLabel() {
|
|
160
|
+
var current = html.getAttribute('data-nav');
|
|
161
|
+
navPosBtn.innerHTML = current === 'right' ? '← Nav' : 'Nav →';
|
|
162
|
+
}
|
|
163
|
+
updateNavPosLabel();
|
|
164
|
+
navPosBtn.addEventListener('click', function () {
|
|
165
|
+
var next = html.getAttribute('data-nav') === 'right' ? 'left' : 'right';
|
|
166
|
+
html.setAttribute('data-nav', next);
|
|
167
|
+
localStorage.setItem('nav-position', next);
|
|
168
|
+
updateNavPosLabel();
|
|
169
|
+
});
|
|
170
|
+
|
|
171
|
+
/* --- Layout Width Toggle (Focused / Full Width) --- */
|
|
172
|
+
var layoutModeBtn = document.querySelector('.layout-mode-toggle');
|
|
173
|
+
var storedLayoutMode = localStorage.getItem('layout-mode');
|
|
174
|
+
html.setAttribute('data-layout-mode', storedLayoutMode || 'full');
|
|
175
|
+
function updateLayoutModeLabel() {
|
|
176
|
+
var current = html.getAttribute('data-layout-mode');
|
|
177
|
+
var nextLabel = current === 'full' ? 'Focused' : 'Full Width';
|
|
178
|
+
var nextIcon = current === 'full' ? '▤' : '⛶';
|
|
179
|
+
layoutModeBtn.innerHTML =
|
|
180
|
+
'<span class="control-icon" aria-hidden="true">' +
|
|
181
|
+
nextIcon +
|
|
182
|
+
'</span><span class="control-label">' +
|
|
183
|
+
nextLabel +
|
|
184
|
+
'</span>';
|
|
185
|
+
}
|
|
186
|
+
updateLayoutModeLabel();
|
|
187
|
+
layoutModeBtn.addEventListener('click', function () {
|
|
188
|
+
var next = html.getAttribute('data-layout-mode') === 'full' ? 'focused' : 'full';
|
|
189
|
+
html.setAttribute('data-layout-mode', next);
|
|
190
|
+
localStorage.setItem('layout-mode', next);
|
|
191
|
+
updateLayoutModeLabel();
|
|
192
|
+
});
|
|
193
|
+
|
|
194
|
+
/* --- Side Navigation --- */
|
|
195
|
+
(function () {
|
|
196
|
+
var nav = document.getElementById('side-nav');
|
|
197
|
+
var sections = document.querySelectorAll('main .section[id]');
|
|
198
|
+
if (!nav || !sections.length) return;
|
|
199
|
+
|
|
200
|
+
var EXPANDABLE_SECTION_IDS = {
|
|
201
|
+
experience: true,
|
|
202
|
+
projects: true
|
|
203
|
+
};
|
|
204
|
+
|
|
205
|
+
var sectionListItems = {};
|
|
206
|
+
var sectionLinks = {};
|
|
207
|
+
var subItemLinks = [];
|
|
208
|
+
var experienceSection = document.getElementById('experience');
|
|
209
|
+
var experienceHeading = experienceSection ? experienceSection.querySelector('h2') : null;
|
|
210
|
+
var experienceEntryCompanyById = {};
|
|
211
|
+
var projectsSection = document.getElementById('projects');
|
|
212
|
+
var projectsHeading = projectsSection ? projectsSection.querySelector('h2') : null;
|
|
213
|
+
var projectsEntrySubsectionById = {};
|
|
214
|
+
|
|
215
|
+
function setExperienceDockedCompany(label) {
|
|
216
|
+
if (!experienceHeading) return;
|
|
217
|
+
|
|
218
|
+
var normalized = (label || '').trim();
|
|
219
|
+
if (normalized) {
|
|
220
|
+
experienceHeading.setAttribute('data-subsection', normalized);
|
|
221
|
+
} else {
|
|
222
|
+
experienceHeading.removeAttribute('data-subsection');
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
function assignExperienceCompanyMap() {
|
|
227
|
+
if (!experienceSection) return;
|
|
228
|
+
|
|
229
|
+
var workGroups = Array.from(experienceSection.querySelectorAll('.work-group[id]'));
|
|
230
|
+
workGroups.forEach(function (group) {
|
|
231
|
+
var heading = group.querySelector('.work-company h3');
|
|
232
|
+
var companyLabel = heading ? heading.textContent.trim() : '';
|
|
233
|
+
if (!companyLabel) return;
|
|
234
|
+
|
|
235
|
+
experienceEntryCompanyById[group.id] = companyLabel;
|
|
236
|
+
Array.from(group.querySelectorAll('.work-role[id]')).forEach(function (role) {
|
|
237
|
+
experienceEntryCompanyById[role.id] = companyLabel;
|
|
238
|
+
});
|
|
239
|
+
});
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
function compactProjectsSubsectionLabel(rawLabel) {
|
|
243
|
+
if (!rawLabel) return '';
|
|
244
|
+
return rawLabel
|
|
245
|
+
.replace(/\s+projects$/i, '')
|
|
246
|
+
.replace(/-/g, ' ')
|
|
247
|
+
.trim();
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
function setProjectsDockedSubsection(label) {
|
|
251
|
+
if (!projectsHeading) return;
|
|
252
|
+
|
|
253
|
+
var normalized = (label || '').trim();
|
|
254
|
+
if (normalized) {
|
|
255
|
+
projectsHeading.setAttribute('data-subsection', normalized);
|
|
256
|
+
} else {
|
|
257
|
+
projectsHeading.removeAttribute('data-subsection');
|
|
258
|
+
}
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
function assignProjectsSubsectionMap() {
|
|
262
|
+
if (!projectsSection) return;
|
|
263
|
+
|
|
264
|
+
var subgroupHeadings = Array.from(projectsSection.querySelectorAll('.projects-subheading'));
|
|
265
|
+
if (!subgroupHeadings.length) return;
|
|
266
|
+
|
|
267
|
+
subgroupHeadings.forEach(function (heading) {
|
|
268
|
+
var label = compactProjectsSubsectionLabel(heading.textContent.trim()) || heading.textContent.trim();
|
|
269
|
+
var node = heading.nextElementSibling;
|
|
270
|
+
|
|
271
|
+
while (node && !(node.classList && node.classList.contains('projects-subheading'))) {
|
|
272
|
+
if (node.classList && node.classList.contains('project-entry') && node.id) {
|
|
273
|
+
projectsEntrySubsectionById[node.id] = label;
|
|
274
|
+
}
|
|
275
|
+
node = node.nextElementSibling;
|
|
276
|
+
}
|
|
277
|
+
});
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
assignExperienceCompanyMap();
|
|
281
|
+
assignProjectsSubsectionMap();
|
|
282
|
+
|
|
283
|
+
function getSectionSubItems(sectionId) {
|
|
284
|
+
if (sectionId === 'experience') {
|
|
285
|
+
return Array.from(document.querySelectorAll('.work-group[id]')).map(function (entry) {
|
|
286
|
+
var heading = entry.querySelector('.work-company h3');
|
|
287
|
+
return {
|
|
288
|
+
type: 'link',
|
|
289
|
+
id: entry.id,
|
|
290
|
+
label: heading ? heading.textContent.trim() : entry.id
|
|
291
|
+
};
|
|
292
|
+
});
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
if (sectionId === 'projects') {
|
|
296
|
+
var projectsSection = document.getElementById('projects');
|
|
297
|
+
if (!projectsSection) return [];
|
|
298
|
+
|
|
299
|
+
var subgroupHeadings = Array.from(projectsSection.querySelectorAll('.projects-subheading'));
|
|
300
|
+
if (!subgroupHeadings.length) {
|
|
301
|
+
return Array.from(projectsSection.querySelectorAll('.project-entry[id]')).map(function (entry) {
|
|
302
|
+
var entryHeading = entry.querySelector('.role-header h4');
|
|
303
|
+
return {
|
|
304
|
+
type: 'link',
|
|
305
|
+
id: entry.id,
|
|
306
|
+
label: entryHeading ? entryHeading.textContent.trim() : entry.id
|
|
307
|
+
};
|
|
308
|
+
});
|
|
309
|
+
}
|
|
310
|
+
|
|
311
|
+
var items = [];
|
|
312
|
+
subgroupHeadings.forEach(function (heading) {
|
|
313
|
+
var rawLabel = heading.textContent.trim();
|
|
314
|
+
var compactLabel = compactProjectsSubsectionLabel(rawLabel);
|
|
315
|
+
|
|
316
|
+
items.push({
|
|
317
|
+
type: 'group-label',
|
|
318
|
+
label: compactLabel || rawLabel
|
|
319
|
+
});
|
|
320
|
+
|
|
321
|
+
var node = heading.nextElementSibling;
|
|
322
|
+
while (node && !(node.classList && node.classList.contains('projects-subheading'))) {
|
|
323
|
+
if (node.classList && node.classList.contains('project-entry') && node.id) {
|
|
324
|
+
var entryTitle = node.querySelector('.role-header h4');
|
|
325
|
+
items.push({
|
|
326
|
+
type: 'link',
|
|
327
|
+
id: node.id,
|
|
328
|
+
label: entryTitle ? entryTitle.textContent.trim() : node.id
|
|
329
|
+
});
|
|
330
|
+
}
|
|
331
|
+
node = node.nextElementSibling;
|
|
332
|
+
}
|
|
333
|
+
});
|
|
334
|
+
|
|
335
|
+
return items;
|
|
336
|
+
}
|
|
337
|
+
|
|
338
|
+
return [];
|
|
339
|
+
}
|
|
340
|
+
|
|
341
|
+
function setExpandedSection(sectionId, expanded) {
|
|
342
|
+
var li = sectionListItems[sectionId];
|
|
343
|
+
if (!li) return;
|
|
344
|
+
li.classList.toggle('is-expanded', expanded);
|
|
345
|
+
}
|
|
346
|
+
|
|
347
|
+
function setActiveSection(sectionId) {
|
|
348
|
+
Object.keys(sectionLinks).forEach(function (id) {
|
|
349
|
+
var link = sectionLinks[id];
|
|
350
|
+
link.classList.toggle('active', id === sectionId);
|
|
351
|
+
|
|
352
|
+
if (EXPANDABLE_SECTION_IDS[id]) {
|
|
353
|
+
setExpandedSection(id, id === sectionId);
|
|
354
|
+
}
|
|
355
|
+
});
|
|
356
|
+
}
|
|
357
|
+
|
|
358
|
+
function setActiveSubItem(activeId) {
|
|
359
|
+
subItemLinks.forEach(function (entry) {
|
|
360
|
+
entry.link.classList.toggle('active', entry.id === activeId);
|
|
361
|
+
if (entry.id === activeId) {
|
|
362
|
+
setExpandedSection(entry.sectionId, true);
|
|
363
|
+
setActiveSection(entry.sectionId);
|
|
364
|
+
|
|
365
|
+
if (entry.sectionId === 'projects') {
|
|
366
|
+
setProjectsDockedSubsection(projectsEntrySubsectionById[entry.id] || '');
|
|
367
|
+
}
|
|
368
|
+
|
|
369
|
+
if (entry.sectionId === 'experience') {
|
|
370
|
+
setExperienceDockedCompany(experienceEntryCompanyById[entry.id] || '');
|
|
371
|
+
}
|
|
372
|
+
}
|
|
373
|
+
});
|
|
374
|
+
}
|
|
375
|
+
|
|
376
|
+
// Build nav links from rendered sections
|
|
377
|
+
var ul = document.createElement('ul');
|
|
378
|
+
sections.forEach(function (section) {
|
|
379
|
+
var h2 = section.querySelector('h2');
|
|
380
|
+
if (!h2) return;
|
|
381
|
+
|
|
382
|
+
var li = document.createElement('li');
|
|
383
|
+
li.className = 'side-nav-group';
|
|
384
|
+
sectionListItems[section.id] = li;
|
|
385
|
+
|
|
386
|
+
var a = document.createElement('a');
|
|
387
|
+
a.href = '#' + section.id;
|
|
388
|
+
a.textContent = h2.textContent;
|
|
389
|
+
sectionLinks[section.id] = a;
|
|
390
|
+
a.addEventListener('click', function (e) {
|
|
391
|
+
e.preventDefault();
|
|
392
|
+
section.scrollIntoView({ behavior: 'smooth', block: 'start' });
|
|
393
|
+
history.replaceState(null, '', '#' + section.id);
|
|
394
|
+
|
|
395
|
+
setActiveSection(section.id);
|
|
396
|
+
setActiveSubItem('');
|
|
397
|
+
if (EXPANDABLE_SECTION_IDS[section.id]) {
|
|
398
|
+
setExpandedSection(section.id, true);
|
|
399
|
+
}
|
|
400
|
+
});
|
|
401
|
+
li.appendChild(a);
|
|
402
|
+
|
|
403
|
+
if (EXPANDABLE_SECTION_IDS[section.id]) {
|
|
404
|
+
var subItems = getSectionSubItems(section.id);
|
|
405
|
+
if (subItems.length) {
|
|
406
|
+
li.classList.add('has-children');
|
|
407
|
+
var subList = document.createElement('ul');
|
|
408
|
+
subList.className = 'side-nav-sublist';
|
|
409
|
+
|
|
410
|
+
subItems.forEach(function (subItem) {
|
|
411
|
+
if (subItem.type === 'group-label') {
|
|
412
|
+
var labelLi = document.createElement('li');
|
|
413
|
+
labelLi.className = 'side-nav-subgroup-label';
|
|
414
|
+
labelLi.textContent = subItem.label;
|
|
415
|
+
subList.appendChild(labelLi);
|
|
416
|
+
return;
|
|
417
|
+
}
|
|
418
|
+
|
|
419
|
+
var subLi = document.createElement('li');
|
|
420
|
+
subLi.className = 'side-nav-subitem';
|
|
421
|
+
|
|
422
|
+
var subLink = document.createElement('a');
|
|
423
|
+
subLink.href = '#' + subItem.id;
|
|
424
|
+
subLink.textContent = subItem.label;
|
|
425
|
+
subLink.className = 'side-nav-sublink';
|
|
426
|
+
|
|
427
|
+
subLink.addEventListener('click', function (e) {
|
|
428
|
+
e.preventDefault();
|
|
429
|
+
var target = document.getElementById(subItem.id);
|
|
430
|
+
if (!target) return;
|
|
431
|
+
|
|
432
|
+
target.scrollIntoView({ behavior: 'smooth', block: 'start' });
|
|
433
|
+
history.replaceState(null, '', '#' + subItem.id);
|
|
434
|
+
|
|
435
|
+
setExpandedSection(section.id, true);
|
|
436
|
+
setActiveSection(section.id);
|
|
437
|
+
setActiveSubItem(subItem.id);
|
|
438
|
+
});
|
|
439
|
+
|
|
440
|
+
subLi.appendChild(subLink);
|
|
441
|
+
subList.appendChild(subLi);
|
|
442
|
+
|
|
443
|
+
subItemLinks.push({
|
|
444
|
+
id: subItem.id,
|
|
445
|
+
sectionId: section.id,
|
|
446
|
+
link: subLink
|
|
447
|
+
});
|
|
448
|
+
});
|
|
449
|
+
|
|
450
|
+
li.appendChild(subList);
|
|
451
|
+
}
|
|
452
|
+
}
|
|
453
|
+
|
|
454
|
+
ul.appendChild(li);
|
|
455
|
+
});
|
|
456
|
+
nav.appendChild(ul);
|
|
457
|
+
|
|
458
|
+
// Scroll spy: highlight active section
|
|
459
|
+
var sectionObserver = new IntersectionObserver(function (entries) {
|
|
460
|
+
entries.forEach(function (entry) {
|
|
461
|
+
if (entry.isIntersecting) {
|
|
462
|
+
setActiveSection(entry.target.id);
|
|
463
|
+
setActiveSubItem('');
|
|
464
|
+
|
|
465
|
+
if (entry.target.id !== 'projects') {
|
|
466
|
+
setProjectsDockedSubsection('');
|
|
467
|
+
}
|
|
468
|
+
|
|
469
|
+
if (entry.target.id !== 'experience') {
|
|
470
|
+
setExperienceDockedCompany('');
|
|
471
|
+
}
|
|
472
|
+
}
|
|
473
|
+
});
|
|
474
|
+
}, { rootMargin: '-10% 0px -80% 0px' });
|
|
475
|
+
|
|
476
|
+
sections.forEach(function (section) {
|
|
477
|
+
sectionObserver.observe(section);
|
|
478
|
+
});
|
|
479
|
+
|
|
480
|
+
// Sub-item scroll spy for Experience and Projects entries.
|
|
481
|
+
if (subItemLinks.length) {
|
|
482
|
+
var subItemObserver = new IntersectionObserver(function (entries) {
|
|
483
|
+
entries.forEach(function (entry) {
|
|
484
|
+
if (entry.isIntersecting) {
|
|
485
|
+
setActiveSubItem(entry.target.id);
|
|
486
|
+
}
|
|
487
|
+
});
|
|
488
|
+
}, { rootMargin: '-18% 0px -72% 0px' });
|
|
489
|
+
|
|
490
|
+
subItemLinks.forEach(function (entry) {
|
|
491
|
+
var target = document.getElementById(entry.id);
|
|
492
|
+
if (target) {
|
|
493
|
+
subItemObserver.observe(target);
|
|
494
|
+
}
|
|
495
|
+
});
|
|
496
|
+
}
|
|
497
|
+
|
|
498
|
+
// Experience role-level scroll spy to keep sticky company breadcrumb current.
|
|
499
|
+
if (experienceSection && experienceHeading) {
|
|
500
|
+
var experienceRoleObserver = new IntersectionObserver(function (entries) {
|
|
501
|
+
entries.forEach(function (entry) {
|
|
502
|
+
if (entry.isIntersecting) {
|
|
503
|
+
setExperienceDockedCompany(experienceEntryCompanyById[entry.target.id] || '');
|
|
504
|
+
}
|
|
505
|
+
});
|
|
506
|
+
}, { rootMargin: '-18% 0px -72% 0px' });
|
|
507
|
+
|
|
508
|
+
Array.from(experienceSection.querySelectorAll('.work-role[id]')).forEach(function (role) {
|
|
509
|
+
experienceRoleObserver.observe(role);
|
|
510
|
+
});
|
|
511
|
+
}
|
|
512
|
+
|
|
513
|
+
// Projects subgroup scroll spy for breadcrumb-style docked title.
|
|
514
|
+
if (projectsSection && projectsHeading) {
|
|
515
|
+
var projectsSubheadingObserver = new IntersectionObserver(function (entries) {
|
|
516
|
+
entries.forEach(function (entry) {
|
|
517
|
+
if (entry.isIntersecting) {
|
|
518
|
+
var label = compactProjectsSubsectionLabel(entry.target.textContent.trim()) || entry.target.textContent.trim();
|
|
519
|
+
setProjectsDockedSubsection(label);
|
|
520
|
+
}
|
|
521
|
+
});
|
|
522
|
+
}, { rootMargin: '-16% 0px -78% 0px' });
|
|
523
|
+
|
|
524
|
+
Array.from(projectsSection.querySelectorAll('.projects-subheading')).forEach(function (heading) {
|
|
525
|
+
projectsSubheadingObserver.observe(heading);
|
|
526
|
+
});
|
|
527
|
+
}
|
|
528
|
+
|
|
529
|
+
// Initialize active state from URL hash when possible.
|
|
530
|
+
var hash = window.location.hash ? window.location.hash.slice(1) : '';
|
|
531
|
+
if (hash) {
|
|
532
|
+
var matchedSub = subItemLinks.find(function (entry) { return entry.id === hash; });
|
|
533
|
+
if (matchedSub) {
|
|
534
|
+
setExpandedSection(matchedSub.sectionId, true);
|
|
535
|
+
setActiveSection(matchedSub.sectionId);
|
|
536
|
+
setActiveSubItem(matchedSub.id);
|
|
537
|
+
|
|
538
|
+
if (matchedSub.sectionId === 'projects') {
|
|
539
|
+
setProjectsDockedSubsection(projectsEntrySubsectionById[matchedSub.id] || '');
|
|
540
|
+
}
|
|
541
|
+
|
|
542
|
+
if (matchedSub.sectionId === 'experience') {
|
|
543
|
+
setExperienceDockedCompany(experienceEntryCompanyById[matchedSub.id] || '');
|
|
544
|
+
}
|
|
545
|
+
|
|
546
|
+
return;
|
|
547
|
+
}
|
|
548
|
+
|
|
549
|
+
if (sectionLinks[hash]) {
|
|
550
|
+
setActiveSection(hash);
|
|
551
|
+
setActiveSubItem('');
|
|
552
|
+
if (EXPANDABLE_SECTION_IDS[hash]) {
|
|
553
|
+
setExpandedSection(hash, true);
|
|
554
|
+
}
|
|
555
|
+
return;
|
|
556
|
+
}
|
|
557
|
+
}
|
|
558
|
+
|
|
559
|
+
setActiveSection('summary');
|
|
560
|
+
setActiveSubItem('');
|
|
561
|
+
setExpandedSection('experience', false);
|
|
562
|
+
setExpandedSection('projects', false);
|
|
563
|
+
setExperienceDockedCompany('');
|
|
564
|
+
setProjectsDockedSubsection('');
|
|
565
|
+
})();
|
|
566
|
+
|
|
567
|
+
/* --- Sticky Header Height Sync --- */
|
|
568
|
+
(function () {
|
|
569
|
+
var header = document.querySelector('.header');
|
|
570
|
+
if (!header) return;
|
|
571
|
+
|
|
572
|
+
function syncStickyHeaderHeight() {
|
|
573
|
+
document.documentElement.style.setProperty(
|
|
574
|
+
'--sticky-header-h',
|
|
575
|
+
header.offsetHeight + 'px'
|
|
576
|
+
);
|
|
577
|
+
}
|
|
578
|
+
|
|
579
|
+
window.addEventListener('resize', syncStickyHeaderHeight);
|
|
580
|
+
window.addEventListener('orientationchange', syncStickyHeaderHeight);
|
|
581
|
+
|
|
582
|
+
syncStickyHeaderHeight();
|
|
583
|
+
})();
|
|
584
|
+
|
|
585
|
+
/* --- Heading Anchor Links --- */
|
|
586
|
+
(function () {
|
|
587
|
+
function addAnchor(heading, id, scrollTarget) {
|
|
588
|
+
var a = document.createElement('a');
|
|
589
|
+
a.className = 'heading-anchor';
|
|
590
|
+
a.href = '#' + id;
|
|
591
|
+
a.textContent = '#';
|
|
592
|
+
a.setAttribute('aria-label', 'Link to ' + heading.textContent.trim());
|
|
593
|
+
a.addEventListener('click', function (e) {
|
|
594
|
+
e.preventDefault();
|
|
595
|
+
history.replaceState(null, '', '#' + id);
|
|
596
|
+
scrollTarget.scrollIntoView({ behavior: 'smooth', block: 'start' });
|
|
597
|
+
});
|
|
598
|
+
heading.insertBefore(a, heading.firstChild);
|
|
599
|
+
}
|
|
600
|
+
|
|
601
|
+
// h2: section headings — anchor from parent section's id
|
|
602
|
+
document.querySelectorAll('main .section[id] > h2').forEach(function (h2) {
|
|
603
|
+
addAnchor(h2, h2.parentElement.id, h2.parentElement);
|
|
604
|
+
});
|
|
605
|
+
|
|
606
|
+
// h3: company headings inside work groups
|
|
607
|
+
document.querySelectorAll('.work-group[id] h3').forEach(function (h3) {
|
|
608
|
+
var entry = h3.closest('.work-group[id]');
|
|
609
|
+
if (entry) addAnchor(h3, entry.id, entry);
|
|
610
|
+
});
|
|
611
|
+
|
|
612
|
+
// h4: all entry types with id — projects, roles, education, volunteer, awards
|
|
613
|
+
var entrySelectors = [
|
|
614
|
+
'.project-entry[id]',
|
|
615
|
+
'.work-role[id]',
|
|
616
|
+
'.education-entry[id]',
|
|
617
|
+
'.volunteer-entry[id]',
|
|
618
|
+
'.award-entry[id]'
|
|
619
|
+
];
|
|
620
|
+
document.querySelectorAll(entrySelectors.join(',')).forEach(function (entry) {
|
|
621
|
+
var h4 = entry.querySelector('h4');
|
|
622
|
+
if (h4) addAnchor(h4, entry.id, entry);
|
|
623
|
+
});
|
|
624
|
+
})();
|
|
625
|
+
})();
|
|
626
|
+
|
|
627
|
+
/* --- Scroll-driven Tile Background --- */
|
|
628
|
+
(function () {
|
|
629
|
+
var container = document.querySelector('.tile-bg');
|
|
630
|
+
if (!container) return;
|
|
631
|
+
|
|
632
|
+
var TILE_SIZE = 14;
|
|
633
|
+
var REMOVAL_FRACTION = 0.10;
|
|
634
|
+
var tiles = [];
|
|
635
|
+
var removalOrder = [];
|
|
636
|
+
var currentlyRemoved = 0;
|
|
637
|
+
var ticking = false;
|
|
638
|
+
var gridCols = 0;
|
|
639
|
+
var gridRows = 0;
|
|
640
|
+
|
|
641
|
+
function buildGrid() {
|
|
642
|
+
gridCols = Math.ceil(window.innerWidth / TILE_SIZE);
|
|
643
|
+
gridRows = Math.ceil(window.innerHeight / TILE_SIZE);
|
|
644
|
+
var total = gridCols * gridRows;
|
|
645
|
+
|
|
646
|
+
// Clear existing
|
|
647
|
+
container.innerHTML = '';
|
|
648
|
+
tiles = [];
|
|
649
|
+
removalOrder = [];
|
|
650
|
+
currentlyRemoved = 0;
|
|
651
|
+
|
|
652
|
+
// Set grid dimensions
|
|
653
|
+
container.style.gridTemplateColumns = 'repeat(' + gridCols + ', ' + TILE_SIZE + 'px)';
|
|
654
|
+
container.style.gridTemplateRows = 'repeat(' + gridRows + ', ' + TILE_SIZE + 'px)';
|
|
655
|
+
|
|
656
|
+
// Create tiles via DocumentFragment
|
|
657
|
+
var frag = document.createDocumentFragment();
|
|
658
|
+
for (var i = 0; i < total; i++) {
|
|
659
|
+
var d = document.createElement('div');
|
|
660
|
+
d.className = 'tile';
|
|
661
|
+
frag.appendChild(d);
|
|
662
|
+
tiles.push(d);
|
|
663
|
+
}
|
|
664
|
+
container.appendChild(frag);
|
|
665
|
+
|
|
666
|
+
// Pre-compute removal order: ~10% of tiles, biased toward bottom-right
|
|
667
|
+
var candidates = [];
|
|
668
|
+
for (var idx = 0; idx < total; idx++) {
|
|
669
|
+
var row = Math.floor(idx / gridCols);
|
|
670
|
+
var col = idx % gridCols;
|
|
671
|
+
// Normalize position: 0 at top-left, 1 at bottom-right
|
|
672
|
+
var nr = gridRows > 1 ? row / (gridRows - 1) : 0;
|
|
673
|
+
var nc = gridCols > 1 ? col / (gridCols - 1) : 0;
|
|
674
|
+
// Weight = distance toward bottom-right (0..1 range, cubed for strong bias)
|
|
675
|
+
var weight = Math.pow((nr + nc) / 2, 3);
|
|
676
|
+
candidates.push({ idx: idx, weight: weight });
|
|
677
|
+
}
|
|
678
|
+
|
|
679
|
+
// Weighted random selection
|
|
680
|
+
var targetCount = Math.floor(total * REMOVAL_FRACTION);
|
|
681
|
+
var selected = [];
|
|
682
|
+
// Fisher-Yates-like weighted sampling: sort by weight * random, take top N
|
|
683
|
+
candidates.sort(function (a, b) {
|
|
684
|
+
return (b.weight * Math.random()) - (a.weight * Math.random());
|
|
685
|
+
});
|
|
686
|
+
for (var s = 0; s < Math.min(targetCount, candidates.length); s++) {
|
|
687
|
+
selected.push(candidates[s].idx);
|
|
688
|
+
}
|
|
689
|
+
|
|
690
|
+
// Shuffle selected for random removal order
|
|
691
|
+
for (var j = selected.length - 1; j > 0; j--) {
|
|
692
|
+
var k = Math.floor(Math.random() * (j + 1));
|
|
693
|
+
var tmp = selected[j];
|
|
694
|
+
selected[j] = selected[k];
|
|
695
|
+
selected[k] = tmp;
|
|
696
|
+
}
|
|
697
|
+
|
|
698
|
+
removalOrder = selected;
|
|
699
|
+
}
|
|
700
|
+
|
|
701
|
+
function onScroll() {
|
|
702
|
+
if (gameRunning) return;
|
|
703
|
+
if (ticking) return;
|
|
704
|
+
ticking = true;
|
|
705
|
+
requestAnimationFrame(function () {
|
|
706
|
+
var maxScroll = document.body.scrollHeight - window.innerHeight;
|
|
707
|
+
var progress = maxScroll > 0 ? Math.min(1, Math.max(0, window.scrollY / maxScroll)) : 0;
|
|
708
|
+
var target = Math.floor(progress * removalOrder.length);
|
|
709
|
+
|
|
710
|
+
// Add removals
|
|
711
|
+
while (currentlyRemoved < target) {
|
|
712
|
+
tiles[removalOrder[currentlyRemoved]].classList.add('removed');
|
|
713
|
+
currentlyRemoved++;
|
|
714
|
+
}
|
|
715
|
+
// Reverse removals
|
|
716
|
+
while (currentlyRemoved > target) {
|
|
717
|
+
currentlyRemoved--;
|
|
718
|
+
tiles[removalOrder[currentlyRemoved]].classList.remove('removed');
|
|
719
|
+
}
|
|
720
|
+
|
|
721
|
+
// Show/hide Game of Life button near bottom
|
|
722
|
+
var golBtn = document.getElementById('gol-btn');
|
|
723
|
+
if (golBtn && !gameRunning) {
|
|
724
|
+
golBtn.classList.toggle('visible', progress > 0.92);
|
|
725
|
+
}
|
|
726
|
+
|
|
727
|
+
ticking = false;
|
|
728
|
+
});
|
|
729
|
+
}
|
|
730
|
+
|
|
731
|
+
buildGrid();
|
|
732
|
+
window.addEventListener('scroll', onScroll, { passive: true });
|
|
733
|
+
onScroll();
|
|
734
|
+
|
|
735
|
+
// Rebuild on resize (debounced)
|
|
736
|
+
var resizeTimer;
|
|
737
|
+
window.addEventListener('resize', function () {
|
|
738
|
+
if (gameRunning) return;
|
|
739
|
+
clearTimeout(resizeTimer);
|
|
740
|
+
resizeTimer = setTimeout(function () {
|
|
741
|
+
buildGrid();
|
|
742
|
+
onScroll();
|
|
743
|
+
}, 200);
|
|
744
|
+
});
|
|
745
|
+
|
|
746
|
+
/* --- Game of Life --- */
|
|
747
|
+
var gameRunning = false;
|
|
748
|
+
var gameInterval = null;
|
|
749
|
+
var gameState = []; // flat array: true = alive
|
|
750
|
+
|
|
751
|
+
function seedFromCurrentState() {
|
|
752
|
+
// Seed: currently removed tiles become alive cells
|
|
753
|
+
var total = gridCols * gridRows;
|
|
754
|
+
gameState = new Array(total).fill(false);
|
|
755
|
+
// Use the removed tiles as initial alive pattern
|
|
756
|
+
for (var i = 0; i < removalOrder.length; i++) {
|
|
757
|
+
if (i < currentlyRemoved) {
|
|
758
|
+
gameState[removalOrder[i]] = true;
|
|
759
|
+
}
|
|
760
|
+
}
|
|
761
|
+
// Add some random cells in bottom-right to ensure enough mass
|
|
762
|
+
var minAlive = Math.floor(total * 0.05);
|
|
763
|
+
var aliveCount = gameState.filter(Boolean).length;
|
|
764
|
+
while (aliveCount < minAlive) {
|
|
765
|
+
var row = Math.floor(gridRows * 0.5 + Math.random() * gridRows * 0.5);
|
|
766
|
+
var col = Math.floor(gridCols * 0.5 + Math.random() * gridCols * 0.5);
|
|
767
|
+
if (row >= gridRows) row = gridRows - 1;
|
|
768
|
+
if (col >= gridCols) col = gridCols - 1;
|
|
769
|
+
var idx = row * gridCols + col;
|
|
770
|
+
if (!gameState[idx]) {
|
|
771
|
+
gameState[idx] = true;
|
|
772
|
+
aliveCount++;
|
|
773
|
+
}
|
|
774
|
+
}
|
|
775
|
+
}
|
|
776
|
+
|
|
777
|
+
function countNeighbors(index) {
|
|
778
|
+
var row = Math.floor(index / gridCols);
|
|
779
|
+
var col = index % gridCols;
|
|
780
|
+
var count = 0;
|
|
781
|
+
for (var dr = -1; dr <= 1; dr++) {
|
|
782
|
+
for (var dc = -1; dc <= 1; dc++) {
|
|
783
|
+
if (dr === 0 && dc === 0) continue;
|
|
784
|
+
var nr = row + dr;
|
|
785
|
+
var nc = col + dc;
|
|
786
|
+
// Wrap around edges (toroidal)
|
|
787
|
+
if (nr < 0) nr = gridRows - 1;
|
|
788
|
+
if (nr >= gridRows) nr = 0;
|
|
789
|
+
if (nc < 0) nc = gridCols - 1;
|
|
790
|
+
if (nc >= gridCols) nc = 0;
|
|
791
|
+
if (gameState[nr * gridCols + nc]) count++;
|
|
792
|
+
}
|
|
793
|
+
}
|
|
794
|
+
return count;
|
|
795
|
+
}
|
|
796
|
+
|
|
797
|
+
function nextGeneration() {
|
|
798
|
+
var total = gridCols * gridRows;
|
|
799
|
+
var next = new Array(total);
|
|
800
|
+
for (var i = 0; i < total; i++) {
|
|
801
|
+
var n = countNeighbors(i);
|
|
802
|
+
if (gameState[i]) {
|
|
803
|
+
next[i] = n === 2 || n === 3;
|
|
804
|
+
} else {
|
|
805
|
+
next[i] = n === 3;
|
|
806
|
+
}
|
|
807
|
+
}
|
|
808
|
+
gameState = next;
|
|
809
|
+
}
|
|
810
|
+
|
|
811
|
+
function renderGame() {
|
|
812
|
+
for (var i = 0; i < tiles.length; i++) {
|
|
813
|
+
tiles[i].classList.toggle('alive', !!gameState[i]);
|
|
814
|
+
tiles[i].classList.toggle('removed', !gameState[i]);
|
|
815
|
+
}
|
|
816
|
+
}
|
|
817
|
+
|
|
818
|
+
function startGame() {
|
|
819
|
+
gameRunning = true;
|
|
820
|
+
document.body.classList.add('game-active');
|
|
821
|
+
container.classList.add('game-active');
|
|
822
|
+
seedFromCurrentState();
|
|
823
|
+
renderGame();
|
|
824
|
+
|
|
825
|
+
var golBtn = document.getElementById('gol-btn');
|
|
826
|
+
golBtn.textContent = 'Stop';
|
|
827
|
+
|
|
828
|
+
gameInterval = setInterval(function () {
|
|
829
|
+
nextGeneration();
|
|
830
|
+
renderGame();
|
|
831
|
+
}, 180);
|
|
832
|
+
}
|
|
833
|
+
|
|
834
|
+
function stopGame() {
|
|
835
|
+
gameRunning = false;
|
|
836
|
+
clearInterval(gameInterval);
|
|
837
|
+
gameInterval = null;
|
|
838
|
+
document.body.classList.remove('game-active');
|
|
839
|
+
container.classList.remove('game-active');
|
|
840
|
+
|
|
841
|
+
// Reset all tiles
|
|
842
|
+
for (var i = 0; i < tiles.length; i++) {
|
|
843
|
+
tiles[i].classList.remove('alive', 'removed');
|
|
844
|
+
}
|
|
845
|
+
currentlyRemoved = 0;
|
|
846
|
+
|
|
847
|
+
var golBtn = document.getElementById('gol-btn');
|
|
848
|
+
golBtn.textContent = 'Play the game?';
|
|
849
|
+
|
|
850
|
+
// Scroll to bottom of resume and re-apply scroll state
|
|
851
|
+
window.scrollTo(0, document.body.scrollHeight);
|
|
852
|
+
onScroll();
|
|
853
|
+
}
|
|
854
|
+
|
|
855
|
+
var golBtn = document.getElementById('gol-btn');
|
|
856
|
+
if (golBtn) {
|
|
857
|
+
golBtn.addEventListener('click', function () {
|
|
858
|
+
if (gameRunning) {
|
|
859
|
+
stopGame();
|
|
860
|
+
} else {
|
|
861
|
+
startGame();
|
|
862
|
+
}
|
|
863
|
+
});
|
|
864
|
+
}
|
|
865
|
+
})();
|
|
866
|
+
|
|
867
|
+
/* --- Lightbox for project screenshots & diagrams --- */
|
|
868
|
+
(function () {
|
|
869
|
+
var overlay = document.getElementById('lightbox-overlay');
|
|
870
|
+
if (!overlay) return;
|
|
871
|
+
var img = document.getElementById('lightbox-img');
|
|
872
|
+
var svgContainer = document.getElementById('lightbox-svg');
|
|
873
|
+
var caption = document.getElementById('lightbox-caption');
|
|
874
|
+
var prevBtn = document.getElementById('lightbox-prev');
|
|
875
|
+
var nextBtn = document.getElementById('lightbox-next');
|
|
876
|
+
var counter = document.getElementById('lightbox-counter');
|
|
877
|
+
var projectName = document.getElementById('lightbox-project-name');
|
|
878
|
+
var projectDate = document.getElementById('lightbox-project-date');
|
|
879
|
+
|
|
880
|
+
function getHeadingTextWithoutAnchor(heading) {
|
|
881
|
+
if (!heading) return '';
|
|
882
|
+
var clone = heading.cloneNode(true);
|
|
883
|
+
clone.querySelectorAll('.heading-anchor').forEach(function (anchor) {
|
|
884
|
+
anchor.remove();
|
|
885
|
+
});
|
|
886
|
+
return clone.textContent.trim();
|
|
887
|
+
}
|
|
888
|
+
|
|
889
|
+
// Build ordered list of all gallery items (screenshots + diagrams)
|
|
890
|
+
var items = [];
|
|
891
|
+
var itemProjects = []; // parallel array: { name, date } per item
|
|
892
|
+
document.querySelectorAll('.project-gallery').forEach(function (gallery) {
|
|
893
|
+
var entry = gallery.closest('.project-entry');
|
|
894
|
+
var name = '';
|
|
895
|
+
var date = '';
|
|
896
|
+
if (entry) {
|
|
897
|
+
var h4 = entry.querySelector('h4');
|
|
898
|
+
if (h4) name = getHeadingTextWithoutAnchor(h4);
|
|
899
|
+
var dateEl = entry.querySelector('.role-header .date');
|
|
900
|
+
if (dateEl) date = dateEl.textContent.trim();
|
|
901
|
+
}
|
|
902
|
+
gallery.querySelectorAll('.project-screenshot, .project-diagram').forEach(function (el) {
|
|
903
|
+
items.push(el);
|
|
904
|
+
itemProjects.push({ name: name, date: date });
|
|
905
|
+
});
|
|
906
|
+
});
|
|
907
|
+
|
|
908
|
+
var currentIndex = -1;
|
|
909
|
+
|
|
910
|
+
function showItem(index) {
|
|
911
|
+
if (index < 0 || index >= items.length) return;
|
|
912
|
+
currentIndex = index;
|
|
913
|
+
var el = items[index];
|
|
914
|
+
var cap = el.querySelector('figcaption');
|
|
915
|
+
var capText = cap ? cap.textContent : '';
|
|
916
|
+
|
|
917
|
+
if (el.classList.contains('project-screenshot')) {
|
|
918
|
+
var thumb = el.querySelector('img');
|
|
919
|
+
svgContainer.style.display = 'none';
|
|
920
|
+
svgContainer.innerHTML = '';
|
|
921
|
+
img.style.display = '';
|
|
922
|
+
img.src = thumb.src;
|
|
923
|
+
img.alt = thumb.alt;
|
|
924
|
+
} else {
|
|
925
|
+
var svg = el.querySelector('.mermaid svg');
|
|
926
|
+
if (!svg) return;
|
|
927
|
+
img.style.display = 'none';
|
|
928
|
+
img.src = '';
|
|
929
|
+
svgContainer.innerHTML = '';
|
|
930
|
+
var clone = svg.cloneNode(true);
|
|
931
|
+
clone.removeAttribute('style');
|
|
932
|
+
clone.removeAttribute('width');
|
|
933
|
+
clone.removeAttribute('height');
|
|
934
|
+
svgContainer.appendChild(clone);
|
|
935
|
+
svgContainer.style.display = 'block';
|
|
936
|
+
}
|
|
937
|
+
|
|
938
|
+
caption.textContent = capText;
|
|
939
|
+
caption.style.display = capText ? 'block' : 'none';
|
|
940
|
+
var proj = itemProjects[index];
|
|
941
|
+
projectName.textContent = proj.name;
|
|
942
|
+
projectDate.textContent = proj.date;
|
|
943
|
+
counter.textContent = items.length > 1 ? (index + 1) + ' / ' + items.length : '';
|
|
944
|
+
prevBtn.disabled = index === 0;
|
|
945
|
+
nextBtn.disabled = index === items.length - 1;
|
|
946
|
+
prevBtn.style.display = items.length > 1 ? '' : 'none';
|
|
947
|
+
nextBtn.style.display = items.length > 1 ? '' : 'none';
|
|
948
|
+
}
|
|
949
|
+
|
|
950
|
+
function openLightbox(index) {
|
|
951
|
+
showItem(index);
|
|
952
|
+
overlay.classList.add('active');
|
|
953
|
+
document.body.style.overflow = 'hidden';
|
|
954
|
+
}
|
|
955
|
+
|
|
956
|
+
// Attach click handlers to each gallery item
|
|
957
|
+
items.forEach(function (el, i) {
|
|
958
|
+
el.addEventListener('click', function () {
|
|
959
|
+
openLightbox(i);
|
|
960
|
+
});
|
|
961
|
+
});
|
|
962
|
+
|
|
963
|
+
prevBtn.addEventListener('click', function (e) {
|
|
964
|
+
e.stopPropagation();
|
|
965
|
+
if (currentIndex > 0) showItem(currentIndex - 1);
|
|
966
|
+
});
|
|
967
|
+
|
|
968
|
+
nextBtn.addEventListener('click', function (e) {
|
|
969
|
+
e.stopPropagation();
|
|
970
|
+
if (currentIndex < items.length - 1) showItem(currentIndex + 1);
|
|
971
|
+
});
|
|
972
|
+
|
|
973
|
+
overlay.querySelector('.lightbox-close').addEventListener('click', closeLightbox);
|
|
974
|
+
overlay.addEventListener('click', function (e) {
|
|
975
|
+
if (e.target === overlay) closeLightbox();
|
|
976
|
+
});
|
|
977
|
+
document.addEventListener('keydown', function (e) {
|
|
978
|
+
if (!overlay.classList.contains('active')) return;
|
|
979
|
+
if (e.key === 'Escape') closeLightbox();
|
|
980
|
+
if (e.key === 'ArrowLeft' && currentIndex > 0) showItem(currentIndex - 1);
|
|
981
|
+
if (e.key === 'ArrowRight' && currentIndex < items.length - 1) showItem(currentIndex + 1);
|
|
982
|
+
});
|
|
983
|
+
|
|
984
|
+
function closeLightbox() {
|
|
985
|
+
overlay.classList.remove('active');
|
|
986
|
+
document.body.style.overflow = '';
|
|
987
|
+
img.src = '';
|
|
988
|
+
img.style.display = '';
|
|
989
|
+
svgContainer.style.display = 'none';
|
|
990
|
+
svgContainer.innerHTML = '';
|
|
991
|
+
currentIndex = -1;
|
|
992
|
+
}
|
|
993
|
+
})();
|
|
994
|
+
</script>
|
|
995
|
+
<script type="module">
|
|
996
|
+
import mermaid from 'https://cdn.jsdelivr.net/npm/mermaid@11/dist/mermaid.esm.min.mjs';
|
|
997
|
+
mermaid.initialize({
|
|
998
|
+
startOnLoad: false,
|
|
999
|
+
theme: document.documentElement.getAttribute('data-theme') === 'dark' ? 'dark' : 'default',
|
|
1000
|
+
flowchart: { useMaxWidth: true, htmlLabels: true },
|
|
1001
|
+
sequence: { useMaxWidth: true }
|
|
1002
|
+
});
|
|
1003
|
+
|
|
1004
|
+
window.renderMermaidIn = async function (root) {
|
|
1005
|
+
var scope = root || document;
|
|
1006
|
+
var nodes = Array.from(scope.querySelectorAll('.mermaid')).filter(function (el) {
|
|
1007
|
+
return el.offsetParent !== null && !el.dataset.mermaidRendered;
|
|
1008
|
+
});
|
|
1009
|
+
|
|
1010
|
+
if (!nodes.length) return;
|
|
1011
|
+
|
|
1012
|
+
try {
|
|
1013
|
+
await mermaid.run({ nodes: nodes });
|
|
1014
|
+
nodes.forEach(function (el) {
|
|
1015
|
+
el.dataset.mermaidRendered = 'true';
|
|
1016
|
+
});
|
|
1017
|
+
} catch (err) {
|
|
1018
|
+
console.error('Mermaid render error:', err);
|
|
1019
|
+
}
|
|
1020
|
+
};
|
|
1021
|
+
|
|
1022
|
+
window.renderMermaidIn(document);
|
|
1023
|
+
</script>
|
|
1024
|
+
</body>
|
|
1025
|
+
</html>
|