-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtemplate.html
More file actions
executable file
·616 lines (550 loc) · 25 KB
/
Copy pathtemplate.html
File metadata and controls
executable file
·616 lines (550 loc) · 25 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
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no, viewport-fit=cover">
<meta name="description" content="james taylor-foster — curator, editor, and writer">
<meta name="author" content="james taylor-foster">
<meta property="og:title" content="James Taylor-Foster">
<meta property="og:description" content="Curator, writer, and cultural leader.">
<meta property="og:url" content="https://james.tf">
<meta property="og:type" content="website">
<meta property="og:image" content="https://james.tf/assets/images/jtf-2026-PierreBjork-CC-BY.jpg">
<title>james taylor-foster</title>
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Instrument+Sans:ital,wght@0,400;1,400&display=swap" rel="stylesheet">
<link rel="stylesheet" href="style.css">
<link rel="icon" type="image/svg+xml" href="favicon.svg">
<link rel="canonical" href="https://james.tf">
<noscript>
<style>
.name,
.bio,
.bio-controls,
.nav-item,
.footer {
opacity: 1 !important;
animation: none !important;
}
</style>
</noscript>
<script defer src="https://cloud.umami.is/script.js" data-website-id="7c4701b2-e2a5-42be-95a5-2ea028c1d270"></script>
<script defer src="/_vercel/insights/script.js"></script>
</head>
<body>
<img class="cursor-portrait" src="" alt="">
<div class="mobile-header"></div>
<div class="desktop-header"></div>
<span class="name-jtf">JTF</span>
<div class="layout">
<span class="face">
<span class="eye left-eye">◕</span>
<span class="mouth">‿</span>
<span class="eye right-eye">◕</span>
</span>
<aside class="col-left">
<h1 class="name" style="animation-delay: {{NAME_DELAY}}">JTF</h1>
<section class="bio" style="animation-delay: {{BIO_DELAY}}">
<div class="bio-panel" id="bio-short" data-words="{{BIO_SHORT_WORDS}}">{{BIO_SHORT}}</div>
<div class="bio-panel" id="bio-medium" data-words="{{BIO_MEDIUM_WORDS}}">{{BIO_MEDIUM}}</div>
<div class="bio-panel" id="bio-long" data-words="{{BIO_LONG_WORDS}}">{{BIO_LONG}}</div>
</section>
<div class="bio-controls" style="animation-delay: {{BIO_CONTROLS_DELAY}}">
<span class="bio-buttons">
<button class="bio-btn" id="bio-minus">
<svg width="11" height="5" viewBox="0 0 22 10" fill="none" xmlns="http://www.w3.org/2000/svg">
<line x1="0" y1="5" x2="22" y2="5" stroke="currentColor" stroke-width="2.25"/>
</svg>
</button>
<button class="bio-btn" id="bio-plus">
<svg width="11" height="11" viewBox="0 0 22 22" fill="none" xmlns="http://www.w3.org/2000/svg">
<line x1="11" y1="0" x2="11" y2="22" stroke="currentColor" stroke-width="2.25"/>
<line x1="0" y1="11" x2="22" y2="11" stroke="currentColor" stroke-width="2.25"/>
</svg>
</button>
</span>
<button class="bio-wordcount" id="bio-copy" aria-label="Copy bio"></button>
</div>
<div class="bio-spacer"></div>
<nav class="sections sections-primary">
{{NAV_PRIMARY}}
</nav>
<nav class="sections sections-secondary">
{{NAV_SECONDARY}}
</nav>
<div class="footer-spacer"></div>
<footer class="footer" style="animation-delay: {{FOOTER_DELAY}}">
{{FOOTER}}
</footer>
</aside>
</div>
<script>
document.addEventListener('DOMContentLoaded', () => {
const face = {
priority: ['blushing', 'winking', 'surprised', 'sleeping', 'default'],
active: new Set(['default']),
_wokenByPanel: false,
states: {
default: { leftEye: '◕', rightEye: '◕', mouth: '‿', canBlink: true },
sleeping: { leftEye: '◡', rightEye: '◡', mouth: '〇', canBlink: false },
blushing: { leftEye: '◡', rightEye: '◡', mouth: '‿', canBlink: false },
winking: { leftEye: '◕', rightEye: '◠', mouth: '‿', canBlink: false },
surprised: { leftEye: '>', rightEye: ' <', mouth: 'ᴗ', canBlink: true },
},
current() {
for (const state of this.priority) {
if (this.active.has(state)) return state;
}
return 'default';
},
enter(stateName) {
this.active.add(stateName);
this.render();
},
leave(stateName) {
this.active.delete(stateName);
this.render();
},
flash(stateName, duration = 1000) {
this.enter(stateName);
setTimeout(() => this.leave(stateName), duration);
},
render() {
const s = this.states[this.current()];
document.querySelector('.left-eye').textContent = s.leftEye;
document.querySelector('.right-eye').textContent = s.rightEye;
document.querySelector('.mouth').textContent = s.mouth;
const faceEl = document.querySelector('.face');
faceEl.className = 'face';
if (this.current() !== 'default') faceEl.classList.add(this.current());
}
};
// Blinking eyes
function blink() {
const current = face.states[face.current()];
if (current.canBlink) {
const eyes = document.querySelectorAll('.eye');
eyes.forEach(e => e.classList.add('blinking'));
setTimeout(() => eyes.forEach(e => e.classList.remove('blinking')), 120);
}
setTimeout(blink, 2000 + Math.random() * 4000);
}
setTimeout(blink, 1000 + Math.random() * 2000);
// Dark mode toggle
const hour = new Date().getHours();
if (hour >= 20 || hour < 7) {
document.body.classList.add('dark');
face.enter('sleeping');
}
document.querySelector('.face').addEventListener('click', () => {
document.body.classList.toggle('dark');
if (document.body.classList.contains('dark')) {
face.enter('sleeping');
} else {
face.leave('sleeping');
}
});
// Bio version switcher
const bioPanels = document.querySelectorAll('.bio-panel');
const bioMinus = document.getElementById('bio-minus');
const bioPlus = document.getElementById('bio-plus');
let bioIndex = 0;
const bioWordCount = document.getElementById('bio-copy');
// Bio copy button
const bioCopy = document.getElementById('bio-copy');
let copyResetTimeout = null;
bioCopy.addEventListener('click', () => {
const activePanel = bioPanels[bioIndex];
const text = activePanel.innerText.trim();
navigator.clipboard.writeText(text).then(() => {
bioCopy.dataset.state = 'copied';
face.flash('winking', 2000);
clearTimeout(copyResetTimeout);
copyResetTimeout = setTimeout(() => {
delete bioCopy.dataset.state;
}, 2000);
});
});
let bioAnimating = false;
function showBio(index, animate = true) {
const bioContainer = document.querySelector('.bio');
const currentPanel = bioPanels[bioIndex];
const nextPanel = bioPanels[index];
// Update controls immediately
bioMinus.disabled = index === 0;
bioPlus.disabled = index === bioPanels.length - 1;
bioWordCount.dataset.words = bioPanels[index].dataset.words + ' words';
delete bioWordCount.dataset.state;
document.querySelector('.bio-buttons').classList.toggle('at-longest', index === bioPanels.length - 1);
if (!animate || bioAnimating || index === bioIndex) {
// Instant switch (initial load or same index)
bioPanels.forEach((panel, i) => panel.classList.toggle('active', i === index));
bioContainer.style.height = nextPanel.scrollHeight + 'px';
requestAnimationFrame(() => { positionNav(); });
return;
}
bioAnimating = true;
// Step 1: fade out current
currentPanel.classList.remove('active');
setTimeout(() => {
// Step 2: animate height
bioContainer.style.height = nextPanel.scrollHeight + 'px';
// Step 3: reposition exactly when height transition ends
bioContainer.addEventListener('transitionend', function onTransitionEnd(e) {
if (e.propertyName !== 'height') return;
bioContainer.removeEventListener('transitionend', onTransitionEnd);
nextPanel.classList.add('active');
bioAnimating = false;
positionNav();
});
}, 200);
}
// Initialise
// Set initial height before first show so there's no jump
document.fonts.ready.then(() => {
const bioContainer = document.querySelector('.bio');
bioContainer.style.height = bioPanels[0].scrollHeight + 'px';
showBio(bioIndex, false);
positionNav();
});
window.addEventListener('resize', positionNav);
let wasMobile = window.innerWidth <= 768;
window.addEventListener('resize', () => {
const isMobile = window.innerWidth <= 768;
if (isMobile !== wasMobile) {
location.reload();
}
});
bioMinus.addEventListener('click', () => {
if (bioIndex > 0 && !bioAnimating) {
if (window.innerWidth <= 768) {
document.querySelector('.col-left').scrollTop = 0;
}
face.flash('surprised', 500);
bioIndex--;
showBio(bioIndex);
}
});
bioPlus.addEventListener('click', () => {
if (bioIndex < bioPanels.length - 1 && !bioAnimating) {
face.flash('surprised', 500);
bioIndex++;
showBio(bioIndex);
}
});
// Open all links in new tab
document.querySelectorAll('a[href]').forEach(link => {
const href = link.getAttribute('href');
if (href && !href.startsWith('#') && !href.startsWith('mailto:')) {
link.setAttribute('target', '_blank');
link.setAttribute('rel', 'noopener noreferrer');
}
});
// Nav interactions
const items = document.querySelectorAll('.nav-item');
const panels = document.querySelectorAll('.section-panel');
let pinned = null;
let hideTimeout = null;
const panelCleanupTimeouts = new Map();
const ENTRY_IN_STEP = 0.06;
const ENTRY_OUT_STEP = 0.04;
const HIDE_DELAY = 1800;
// Position nav: pinned at 33vh, only moves if bio fills the gap
function positionNav() {
const bioContainer = document.querySelector('.bio');
const activePanel = bioPanels[bioIndex];
bioContainer.style.height = activePanel.scrollHeight + 'px';
}
// Keep section panels aligned with nav when column scrolls
const colLeft = document.querySelector('.col-left');
const mobileHeader = document.querySelector('.mobile-header');
colLeft.addEventListener('scroll', () => {
const scrolled = colLeft.scrollTop > 10;
document.querySelector('.footer').classList.toggle('pill-visible', scrolled);
if (window.innerWidth <= 768) {
mobileHeader.classList.toggle('visible', scrolled);
if (scrolled && !mobileHeader.querySelector('.name-clone')) {
const clone = document.createElement('span');
clone.className = 'name-clone';
clone.textContent = 'James Taylor-Foster';
mobileHeader.appendChild(clone);
}
mobileHeader.classList.toggle('name-visible', scrolled);
} else {
const dh = document.querySelector('.desktop-header');
dh.classList.toggle('visible', scrolled);
if (scrolled && !dh.querySelector('.name-clone')) {
const clone = document.createElement('span');
clone.className = 'name-clone';
clone.textContent = 'James Taylor-Foster';
dh.appendChild(clone);
}
dh.classList.toggle('name-visible', scrolled);
}
});
function showPanel(target) {
clearTimeout(hideTimeout);
items.forEach(i => i.setAttribute('aria-expanded', i.dataset.section === target ? 'true' : 'false'));
panels.forEach(p => {
if (p.id === target) {
clearTimeout(panelCleanupTimeouts.get(p.id));
panelCleanupTimeouts.delete(p.id);
const entries = p.querySelectorAll('.entry, .entry-full, .entry-portrait');
entries.forEach(entry => {
entry.classList.remove('leaving');
entry.style.transitionDelay = '';
});
p.classList.add('visible');
entries.forEach((entry, i) => {
entry.style.transitionDelay = `${i * ENTRY_IN_STEP}s`;
entry.classList.add('visible');
});
} else {
const entries = p.querySelectorAll('.entry, .entry-full, .entry-portrait');
entries.forEach(entry => {
entry.style.transitionDelay = '0s';
entry.classList.remove('visible');
entry.classList.remove('leaving');
});
p.classList.remove('visible');
}
});
items.forEach(i => i.classList.toggle('panel-hover', i.dataset.section === target));
// Only wake face for primary nav items, and only in dark mode
const isPrimary = !!document.querySelector(`.sections-primary .nav-item[data-section="${target}"]`);
if (isPrimary && face.active.has('sleeping')) {
face.leave('sleeping');
face._wokenByPanel = true;
}
}
function hideAll() {
items.forEach(i => i.setAttribute('aria-expanded', 'false'));
items.forEach(i => i.classList.remove('panel-hover'));
panels.forEach(p => {
if (p.classList.contains('visible')) {
const entries = p.querySelectorAll('.entry, .entry-full, .entry-portrait');
const visibleEntries = Array.from(entries).filter(e => e.classList.contains('visible'));
visibleEntries.reverse().forEach((entry, i) => {
entry.style.transitionDelay = `${i * ENTRY_OUT_STEP}s`;
entry.classList.add('leaving');
entry.classList.remove('visible');
});
const sleepDelay = visibleEntries.length * ENTRY_OUT_STEP * 1000 + 400;
const cleanupId = setTimeout(() => {
p.classList.remove('visible');
visibleEntries.forEach(entry => {
entry.classList.remove('leaving');
entry.style.transitionDelay = '';
});
panelCleanupTimeouts.delete(p.id);
// Re-sleep after entries finish animating out
if (face._wokenByPanel) {
face.enter('sleeping');
face._wokenByPanel = false;
}
}, sleepDelay);
panelCleanupTimeouts.set(p.id, cleanupId);
}
});
// If no panels were visible but flag is set, still re-sleep
if (face._wokenByPanel && ![...panels].some(p => p.classList.contains('visible'))) {
face.enter('sleeping');
face._wokenByPanel = false;
}
}
items.forEach(item => {
item.addEventListener('mouseenter', () => {
if (!pinned) showPanel(item.dataset.section);
});
item.addEventListener('click', () => {
const target = item.dataset.section;
if (pinned === target) {
pinned = null;
item.classList.remove('pinned');
clearTimeout(hideTimeout);
hideAll();
} else {
if (pinned) items.forEach(i => i.classList.remove('pinned'));
pinned = target;
item.classList.add('pinned');
showPanel(target);
}
});
});
document.querySelectorAll('.sections-primary, .sections-secondary').forEach(nav => {
nav.addEventListener('mouseleave', () => {
if (!pinned) hideTimeout = setTimeout(hideAll, HIDE_DELAY);
});
nav.addEventListener('mouseenter', () => {
clearTimeout(hideTimeout);
});
});
document.querySelector('.layout').addEventListener('mouseleave', () => {
if (!pinned) hideTimeout = setTimeout(hideAll, HIDE_DELAY);
});
document.querySelector('.layout').addEventListener('mouseenter', () => {
clearTimeout(hideTimeout);
});
// Cursor-following portrait
const cursorPortrait = document.querySelector('.cursor-portrait');
let portraitVisible = false;
document.addEventListener('mousemove', (e) => {
if (portraitVisible) {
const x = e.clientX + 30;
const y = e.clientY - cursorPortrait.offsetHeight - 60;
cursorPortrait.style.left = x + 'px';
cursorPortrait.style.top = y + 'px';
cursorCaption.style.left = x + 'px';
cursorCaption.style.top = (y + cursorPortrait.offsetHeight + 6) + 'px';
}
});
const cursorCaption = document.createElement('span');
cursorCaption.className = 'cursor-caption';
document.body.appendChild(cursorCaption);
document.querySelectorAll('#portrait .entry-portrait').forEach(entry => {
const src = entry.dataset.src;
const caption = entry.querySelector('.entry-caption')?.innerHTML || '';
const trigger = entry.querySelector('.entry-trigger');
if (!trigger) return;
trigger.addEventListener('mouseenter', () => {
cursorPortrait.src = src;
cursorCaption.innerHTML = caption;
cursorPortrait.classList.add('visible');
cursorCaption.classList.add('visible');
portraitVisible = true;
face.enter('blushing');
});
trigger.addEventListener('mouseleave', () => {
cursorPortrait.classList.remove('visible');
cursorCaption.classList.remove('visible');
portraitVisible = false;
face.leave('blushing');
});
});
// Mobile overlays
if (window.innerWidth <= 768) {
const overlay = document.querySelector('.section-overlay');
const overlayContent = document.querySelector('.section-overlay-content');
const overlayTitle = document.querySelector('.section-overlay-title');
overlayContent.addEventListener('scroll', () => {
if (!overlay.classList.contains('visible')) return;
const scrolled = overlayContent.scrollTop > 10;
mobileHeader.classList.toggle('visible', scrolled);
if (scrolled && !mobileHeader.querySelector('.name-clone')) {
const clone = document.createElement('span');
clone.className = 'name-clone';
clone.textContent = 'James Taylor-Foster';
mobileHeader.appendChild(clone);
}
mobileHeader.classList.toggle('name-visible', scrolled);
document.querySelector('.name-jtf').classList.toggle('visible', !scrolled);
});
items.forEach(item => {
if (item.dataset.section === 'portrait') return;
item.style.pointerEvents = 'auto';
item.style.cursor = 'pointer';
item.addEventListener('click', () => {
const panel = document.getElementById(item.dataset.section);
if (!panel) return;
overlayTitle.textContent = item.querySelector('.nav-label').textContent;
overlayContent.innerHTML = panel.innerHTML;
overlayContent.querySelectorAll('.entry, .entry-full').forEach((entry, i) => {
entry.style.opacity = '0';
entry.style.transition = 'opacity 0.4s ease';
entry.style.transitionDelay = `${i * ENTRY_IN_STEP}s`;
requestAnimationFrame(() => {
entry.style.opacity = '1';
});
});
overlayContent.querySelectorAll('a').forEach(link => {
link.setAttribute('target', '_blank');
link.setAttribute('rel', 'noopener noreferrer');
});
overlayContent.scrollTop = 0;
mobileHeader.classList.remove('visible', 'name-visible', 'overlay-open');
const nameJtf = document.querySelector('.name-jtf');
nameJtf.textContent = 'James Taylor-Foster';
nameJtf.classList.add('visible');
overlay.classList.add('visible');
mobileHeader.style.pointerEvents = 'auto';
});
});
document.querySelector('.section-overlay-close').addEventListener('click', () => {
overlayContent.scrollTop = 0;
overlay.classList.remove('visible');
mobileHeader.style.pointerEvents = '';
const nameJtf = document.querySelector('.name-jtf');
nameJtf.textContent = 'JTF';
nameJtf.classList.remove('visible');
const mainScrolled = colLeft.scrollTop > 10;
mobileHeader.classList.toggle('visible', mainScrolled);
mobileHeader.classList.toggle('name-visible', mainScrolled);
});
document.querySelector('.mobile-header').addEventListener('click', () => {
if (overlay.classList.contains('visible')) {
document.querySelector('.section-overlay-close').click();
}
});
// Portrait overlay
const portraitOverlay = document.querySelector('.portrait-overlay');
const portraitPanel = document.getElementById('portrait');
const portraitNavItem = Array.from(items).find(i => i.dataset.section === 'portrait');
if (portraitNavItem && portraitPanel) {
const entries = portraitPanel.querySelectorAll('.entry-portrait');
const container = document.createElement('div');
container.className = 'portrait-images';
portraitOverlay.insertBefore(container, portraitOverlay.querySelector('.portrait-controls'));
entries.forEach(entry => {
const src = entry.dataset.src;
const caption = entry.querySelector('.entry-caption')?.innerHTML || '';
const wrapper = document.createElement('div');
wrapper.className = 'portrait-item';
wrapper.innerHTML = `<img src="${src}" alt="Portrait" data-download="${entry.dataset.download}"><p class="portrait-caption">${caption}</p>`;
container.appendChild(wrapper);
});
portraitNavItem.style.pointerEvents = 'auto';
portraitNavItem.style.cursor = 'pointer';
portraitNavItem.addEventListener('click', () => {
portraitOverlay.classList.add('visible');
face.enter('blushing');
mobileHeader.classList.remove('visible', 'name-visible');
});
}
document.querySelector('.portrait-close').addEventListener('click', () => {
portraitOverlay.classList.remove('visible');
face.leave('blushing');
const mainScrolled = colLeft.scrollTop > 10;
mobileHeader.classList.toggle('visible', mainScrolled);
mobileHeader.classList.toggle('name-visible', mainScrolled);
});
document.querySelector('.portrait-share').addEventListener('click', async () => {
const img = portraitOverlay.querySelector('.portrait-images img');
if (!img) return;
try {
const response = await fetch(img.dataset.download || img.src);
const blob = await response.blob();
const file = new File([blob], 'portrait.jpg', { type: blob.type });
await navigator.share({ files: [file] });
} catch (err) {
console.log('Share failed:', err);
}
});
}
});
</script>
<div class="section-overlay">
<div class="section-overlay-content"></div>
<div class="section-overlay-bar">
<span class="section-overlay-title"></span>
<button class="section-overlay-close">Close</button>
</div>
</div>
<div class="portrait-overlay">
<div class="portrait-controls">
<button class="portrait-share">Share</button>
<button class="portrait-close">Close</button>
</div>
</div>
</body>
</html>