Repository navigation
Expand file tree
/
Copy pathtabs.js
More file actions
293 lines (277 loc) · 27.2 KB
/
Copy pathtabs.js
File metadata and controls
293 lines (277 loc) · 27.2 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
/* Oct 25 2026: + Resume pill in header, resume row under Experience, Skills marquee (see content.js resume/skills).
v4 (Oct 16 2026): shared header (logo + name, Hire me pill, tab row) and the tab pages.
About | UI/UX Designs | AI / Motion Designs | Brand Designs | Video Edits. All words live in content.js.
Tab switches render in place (no page reload): the header stays, the page swaps instantly, the URL updates. */
(function(){
const C = window.CONTENT, B = C.brand, body = document.body;
const base = body.dataset.base || "";
const esc = (s)=>String(s??"").replace(/[&<>"]/g, c=>({"&":"&","<":"<",">":">",'"':"""}[c]));
const U = (p)=> /^(https?:|mailto:|#)/.test(p) ? p : base + p;
const G = C.groups;
const TABS = C.tabs;
const tabById = (id)=> TABS.find(t=>t.id===id) || TABS[0];
const R = C.resume; // Oct 25 2026: resume PDF (header pill + About row)
const RP = "resume.html"; // Oct 25 2026 2:04 AM her words "I could not go back to the site": CV pill + Full resume row open resume.html (same tab, Back + Download PDF), not the raw PDF
/* which tab a case belongs to (case pages) */
function tabOfCase(slug){
for(const id of ["uiux","motion","brand"]) if((G[id].cases||[]).includes(slug)) return id;
return "uiux";
}
window.TBTabOfCase = tabOfCase;
window.TBTabPage = (id)=> tabById(id).page;
const isCase = !!body.dataset.slug;
let active = body.dataset.tab || (isCase ? tabOfCase(body.dataset.slug) : "about");
body.dataset.tab = active;
/* path -> tab (for in-place switching and back/forward) */
function tabOfPath(pathname){
const last = (pathname.split("/").pop() || "").replace(/\.html$/,"");
if(!last || last==="index") return "about";
const t = TABS.find(t=>t.page===last); return t ? t.id : null;
}
/* ---------- HEADER ---------- */
const head = document.createElement("header");
head.className = "tb-head"; head.id = "tb-head";
head.innerHTML = `
<div class="tb-bar">
<a class="tb-brand" href="${U("./")}" data-tab="about" aria-label="${esc(B.name)}, about">
<img class="tb-logo" src="${U(B.logo)}" alt="" width="38" height="38">
<span class="tb-name"><span>${esc(B.first)}</span> <em>${esc(B.last)}</em><small>${esc(B.tag)}</small></span>
</a>
<div class="tb-acts"><!-- Oct 25 2026 2:17 AM her ask: header CV/Resume pill removed (Full resume row on About stays) -->
<a class="tb-hire" href="mailto:${C.footer.email}"><span class="tb-dot"></span>${esc(B.hire)}</a></div><!-- Oct 18 10:17 PM her ask: Hire me back in header, opens email -->
</div>
<nav class="tb-tabs" aria-label="Portfolio">
<div class="tb-tabs-in">${TABS.map(t=>`<a href="${U(t.page)}" data-tab="${t.id}">${esc(t.label)}</a>`).join("")}</div>
</nav>`;
const old = document.querySelector("header.nav"); if(old) old.replaceWith(head); else body.prepend(head);
function markTab(id){
head.querySelectorAll(".tb-tabs a").forEach(a=>{ const on = a.dataset.tab===id && !isCase; a.classList.toggle("on", a.dataset.tab===id); if(on) a.setAttribute("aria-current","page"); else a.removeAttribute("aria-current"); });
const on = head.querySelector(".tb-tabs a.on"); if(on){ const row = head.querySelector(".tb-tabs"); row.scrollLeft = Math.max(0, on.offsetLeft - 20); }
}
markTab(active);
if(isCase) return; // case pages: header only (their links are normal page loads)
const main = document.getElementById("page");
const F = C.footer;
const contactBlock = (big)=> `
<section class="tb-contact${big?" big":""}" id="contact">
<div class="foot-orb"><div class="orb-core"></div><div class="orb-ring"></div><div class="orb-gloss"></div></div>
<p class="eyebrow">${esc(C.contact.eyebrow)}</p>
<h2 class="tb-contact-t">${C.contact.title}</h2>
<p class="tb-contact-b">${esc(C.contact.body)}</p>
<a class="tb-hire big tb-mail" href="mailto:${F.email}"><span class="tb-dot"></span>${esc(B.hire)}</a>
<p class="socials tb-socials"><a class="li-ico" href="${F.linkedinHref}" target="_blank" rel="noopener" aria-label="LinkedIn"><svg viewBox="0 0 24 24" width="34" height="34" fill="currentColor" aria-hidden="true"><path d="M20.45 20.45h-3.55v-5.57c0-1.33-.03-3.04-1.85-3.04-1.85 0-2.14 1.45-2.14 2.94v5.67H9.36V9h3.41v1.56h.05c.48-.9 1.64-1.85 3.37-1.85 3.6 0 4.27 2.37 4.27 5.46v6.28zM5.34 7.43a2.06 2.06 0 1 1 0-4.12 2.06 2.06 0 0 1 0 4.12zM7.12 20.45H3.56V9h3.56v11.45zM22.22 0H1.77C.79 0 0 .77 0 1.73v20.54C0 23.23.79 24 1.77 24h20.45c.98 0 1.78-.77 1.78-1.73V1.73C24 .77 23.2 0 22.22 0z"/></svg></a></p>
<p class="rights">${esc(F.rights)}</p>
</section>`;
const footSmall = ()=> `
<footer class="tb-foot">
<div><p class="foot-label">Like what you see?</p><a class="tb-hire big" href="mailto:${F.email}"><span class="tb-dot"></span>${esc(B.hire)}</a></div>
<div class="tb-foot-r"><a class="foot-link" href="mailto:${F.email}">${esc(F.email)}</a><p class="socials"><a class="li-ico" href="${F.linkedinHref}" target="_blank" rel="noopener" aria-label="LinkedIn"><svg viewBox="0 0 24 24" width="22" height="22" fill="currentColor" aria-hidden="true"><path d="M20.45 20.45h-3.55v-5.57c0-1.33-.03-3.04-1.85-3.04-1.85 0-2.14 1.45-2.14 2.94v5.67H9.36V9h3.41v1.56h.05c.48-.9 1.64-1.85 3.37-1.85 3.6 0 4.27 2.37 4.27 5.46v6.28zM5.34 7.43a2.06 2.06 0 1 1 0-4.12 2.06 2.06 0 0 1 0 4.12zM7.12 20.45H3.56V9h3.56v11.45zM22.22 0H1.77C.79 0 0 .77 0 1.73v20.54C0 23.23.79 24 1.77 24h20.45c.98 0 1.78-.77 1.78-1.73V1.73C24 .77 23.2 0 22.22 0z"/></svg></a></p><p class="rights">${esc(F.rights)}</p></div>
</footer>`;
const pageHead = (g)=> `<div class="tb-phead"><p class="eyebrow left">${esc(g.eyebrow)}</p><h1 class="tb-title">${esc(g.title)}</h1>${g.intro?`<p class="tb-intro">${esc(g.intro)}</p>`:""}</div>`;
const subHead = (s, n)=> `<div class="tb-sub"><span class="tb-sub-n">${n||""}</span><div><p class="eyebrow left">${esc(s.eyebrow)}</p><h2 class="tb-sub-t">${esc(s.title)}</h2>${s.intro?`<p class="tb-sub-i">${esc(s.intro)}</p>`:""}</div></div>`;
/* Oct 25 2026: Skills marquee icons (inline SVG, lilac via currentColor). Keys used in content.js skills.rows[].i */
const SKI = {"product": "<path d=\"M12 3l8 4.5v9L12 21l-8-4.5v-9z\"/><path d=\"M4 7.5l8 4.5 8-4.5M12 12v9\"/>", "uiux": "<rect x=\"3\" y=\"4\" width=\"18\" height=\"16\" rx=\"2.5\"/><path d=\"M3 9h18M9 9v11\"/>", "system": "<rect x=\"3.5\" y=\"3.5\" width=\"7\" height=\"7\" rx=\"1.5\"/><rect x=\"13.5\" y=\"3.5\" width=\"7\" height=\"7\" rx=\"1.5\"/><rect x=\"3.5\" y=\"13.5\" width=\"7\" height=\"7\" rx=\"1.5\"/><circle cx=\"17\" cy=\"17\" r=\"3.5\"/>", "research": "<circle cx=\"11\" cy=\"11\" r=\"6.5\"/><path d=\"M20 20l-4.3-4.3\"/>", "proto": "<path d=\"M5 3.5l13 6.2-5.6 1.9-2.2 5.7z\"/><path d=\"M13 13l5 5\"/>", "interact": "<circle cx=\"12\" cy=\"12\" r=\"3\"/><path d=\"M12 3v3M12 18v3M3 12h3M18 12h3M5.6 5.6l2.1 2.1M16.3 16.3l2.1 2.1\"/>", "ai": "<path d=\"M11 3l1.9 5.1L18 10l-5.1 1.9L11 17l-1.9-5.1L4 10l5.1-1.9z\"/><path d=\"M18.5 14.5l.8 2.2 2.2.8-2.2.8-.8 2.2-.8-2.2-2.2-.8 2.2-.8z\"/>", "figma": "<path d=\"M9 3h3v6H9a3 3 0 0 1 0-6zM12 3h3a3 3 0 0 1 0 6h-3zM9 9h3v6H9a3 3 0 0 1 0-6zM12 15v3a3 3 0 1 1-3-3z\"/><circle cx=\"15\" cy=\"12\" r=\"3\"/>", "motion": "<circle cx=\"15\" cy=\"12\" r=\"5.5\"/><path d=\"M2.5 9h5M1.5 12h5M2.5 15h5\"/>", "video": "<rect x=\"3\" y=\"6\" width=\"13\" height=\"12\" rx=\"2.5\"/><path d=\"M16 10.5l5-3v9l-5-3\"/>", "prompt": "<rect x=\"3\" y=\"4\" width=\"18\" height=\"16\" rx=\"2.5\"/><path d=\"M7 9.5l3 2.5-3 2.5M12.5 15h4.5\"/>", "aivideo": "<rect x=\"3\" y=\"5\" width=\"18\" height=\"14\" rx=\"3\"/><path d=\"M10 9l5 3-5 3z\"/>", "mdesign": "<circle cx=\"13.5\" cy=\"12\" r=\"7.5\"/><path d=\"M11.8 9l4.6 3-4.6 3z\"/><path d=\"M2.5 9h2.5M1.5 12h2.5M2.5 15h2.5\"/>", "brand": "<path d=\"M12 3l6 7.5L12 21 6 10.5z\"/><circle cx=\"12\" cy=\"11\" r=\"1.7\"/>", "web3": "<path d=\"M12 2.5l8 4.6v9.8l-8 4.6-8-4.6V7.1z\"/><path d=\"M12 7.6l4 2.3v4.4l-4 2.3-4-2.3V9.9z\"/>", "content": "<rect x=\"9\" y=\"3\" width=\"6\" height=\"11\" rx=\"3\"/><path d=\"M5.5 11a6.5 6.5 0 0 0 13 0M12 17.5V21\"/>", "community": "<circle cx=\"9\" cy=\"8\" r=\"3\"/><path d=\"M3.5 19a5.5 5.5 0 0 1 11 0\"/><circle cx=\"17\" cy=\"9\" r=\"2.4\"/><path d=\"M15.6 14a4.5 4.5 0 0 1 5.4 4.5\"/>"};
const skPill = (k, dup)=> `<span class="tb-pill${dup?" dup":""}"${dup?' aria-hidden="true"':""}><span class="tb-pill-i"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">${SKI[k.i]||SKI.ai}</svg></span>${esc(k.t)}</span>`;
/* each row: the list twice (= one loop set, wide enough for big screens), then that set again for the seamless -50% loop */
const skRow = (row, i)=> `<div class="tb-sk-row${i%2?" rev":""}"><div class="tb-sk-track">${row.map(k=>skPill(k,false)).join("")}${[...row,...row,...row].map(k=>skPill(k,true)).join("")}</div></div>`;
const skillsBlock = (S)=> !S ? "" : `
<section class="tb-skills" id="skills">
${subHead({eyebrow:S.eyebrow, title:S.title})}
<div class="tb-sk"><span class="tb-sk-label"><span class="tb-dot"></span>${esc(S.label)}</span>${S.rows.map(skRow).join("")}</div>
${resumeRow()}<!-- Oct 25 2026 1:59 AM her ask: "Full resume should be after What I work with" -->
</section>`;
const resumeRow = ()=> !R ? "" : `<a class="tb-resume" href="${U(RP)}"><span class="tb-resume-ic"><svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M14 3H7a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2V8z"/><path d="M14 3v5h5M9 13h6M9 17h4"/></svg></span><span class="tb-resume-m"><span class="tb-resume-t">${esc(R.title)}</span><span class="tb-resume-s">${esc(R.line)}</span></span><span class="tb-resume-go">${esc(R.cta)} <i>→</i></span></a>`;
const secById = (id)=> C.sections.find(s=>s.id===id);
const vgrid = (s)=> `<div class="vgrid cols-${(s.items.length===3 && !s.items.some(i=>i.span))?3:(s.cols||2)} tb-vgrid">${s.items.map(TB.tile).join("")}</div>`;
let clockTimer = null;
/* Oct 18 2026 (her words: each section has its own thumbnail and it keeps updating as the site grows):
the landing tile shows the FIRST visible item of that section, video if it has one. explore.img is only a fallback. */
/* Oct 25 2026 2:36 AM her ask "why not animated": the UI/UX tile = the same 4 fixed designs, animated in code.
Each tile is its own window onto the 1280x800 collage (slow Ken Burns), the UI cards / coins float on top, tiles slide in staggered. */
const exaHTML = (A)=>{
const W=1280, H=800, P=(v,t)=>(v/t*100).toFixed(3)+"%", url=(s)=>`url('${U(s)}')`, v=A.v?("?v="+A.v):"";
return `<span class="tb-exa" aria-hidden="true"><i class="exa-bg" style="background-image:${url(A.base)}"></i>${A.q.map((q,i)=>`<span class="exa-q" style="left:${P(q[0],W)};top:${P(q[1],H)};width:${P(q[2],W)};height:${P(q[3],H)};--i:${i}"><span class="exa-kb" style="left:${P(-q[0],q[2])};top:${P(-q[1],q[3])};width:${P(W,q[2])};height:${P(H,q[3])};transform-origin:${P(q[0]+q[2]/2,W)} ${P(q[1]+q[3]/2,H)}"><i class="exa-base" style="background-image:${url(A.base)}"></i>${A.f.filter(f=>f[1]===i).map((f,j)=>`<i class="exa-f${f[6]?" "+f[6]:""}" style="left:${P(f[2],W)};top:${P(f[3],H)};width:${P(f[4],W)};height:${P(f[5],H)};border-radius:${f[7]||0};background-image:${url(A.dir+f[0]+".webp"+v)};--j:${j}"></i>`).join("")}</span></span>`).join("")}</span>`;
};
function autoThumb(g){
if(g.explore && g.explore.cover) return {img:g.explore.cover, vid:g.explore.coverVid||null, anim:g.explore.anim||null}; /* Oct 20 2026 her ask: each category tile is a top-4 highlight collage */
const fromMedia = (m)=> m ? (m.type==="video" ? {vid:m.src, img:m.poster||""} : {img:m.src||"", vid:null}) : null;
const tryCases = ()=>{ for(const id of (g.cases||[])){ const k=C.work.cases.find(c=>(c.slug||c.key)===id); if(k && !k.hidden && k.media && k.media.src) return fromMedia(k.media); } return null; };
const trySecs = ()=>{ for(const sid of (g.sections||[])){ const s=C.sections.find(x=>x.id===sid); for(const it of ((s&&s.items)||[])){ if(!it.soon && it.src) return /\.mp4/.test(it.src)?{vid:it.src,img:it.poster||""}:{img:it.src,vid:null}; } } return null; };
const r = (g.sections ? (trySecs()||tryCases()) : (tryCases()||trySecs()));
return r || {img:(g.explore&&g.explore.img)||"", vid:(g.explore&&g.explore.vid)||null};
}
const RENDER = {
about(){
const H = C.hero, A = C.about, E = C.experience, L = C.loop;
const tiles = ["uiux","motion","video","brand"].map(id=>{
const g = G[id], t = tabById(id);
const n = id==="uiux" ? g.cases.length+" case studies"
: id==="motion" ? "AI films · motion design"
: id==="brand" ? "Identities · campaigns · visuals"
: "Brand videos, shot & edited";
const a = autoThumb(g);
return { id, t: t.label, d: n, img: a.img, vid: a.vid, anim: a.anim||null, href: t.page };
});
main.innerHTML = `
<section class="tb-hero">
<div class="orb-wrap tb-orb"><div class="orb"><div class="orb-core"></div><div class="orb-ring"></div><div class="orb-gloss"></div></div></div>
<h1 class="tb-hero-h">${H.sentence}</h1>
<div class="tb-widget">
<div class="w-item"><svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M12 21s7-6.2 7-11.5A7 7 0 0 0 5 9.5C5 14.8 12 21 12 21z"/><circle cx="12" cy="9.5" r="2.5"/></svg><div><span class="w-label">${esc(H.workingOutOf)}</span><span class="w-value">${esc(H.city)}</span></div></div>
<div class="w-item"><svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><circle cx="12" cy="12" r="9"/><path d="M12 7v5l3 2"/></svg><div><span class="w-label">${esc(H.localTimeLabel)}</span><span class="w-value" id="w-time"></span></div></div>
</div>
</section>
<section class="tb-loop" aria-label="Adaikem">
<div class="tb-loop-m"><video data-vsrc="${L.src}" poster="${L.poster}" autoplay muted loop playsinline preload="auto" disablepictureinpicture aria-label="${esc(L.alt)}"></video></div>
</section>
<section class="tb-about" id="about">
<p class="eyebrow left">${esc(A.eyebrow)}</p>
<p class="tb-about-b">${esc(A.body)}</p>
<a class="tb-about-h" href="${A.handleHref}" target="_blank" rel="noopener">${esc(A.handle)}</a>
</section>
<section class="tb-exp" id="experience">
${subHead({eyebrow:"Experience", title:"Where I’ve worked"})}
<ol class="tb-exp-list">${E.map(e=>`
<li>
<span class="tb-exp-yr"><span class="tb-exp-y mono">${esc(e.years)}</span>${e.loc?`<span class="tb-exp-l tb-exp-l2">${esc(e.loc)}</span>`:""}</span>
<span class="tb-exp-m"><span class="tb-exp-oh"><span class="tb-exp-o">${esc(e.org)}</span>${e.loc?`<span class="tb-exp-l tb-exp-l1">${esc(e.loc)}</span>`:""}</span>${e.roles.map(([r,d])=>`<span class="tb-exp-r">${esc(r)}${d?`<span class="tb-exp-d">${esc(d)}</span>`:""}</span>`).join("")}</span>
</li>`).join("")}
</ol>
${C.skills ? "" : resumeRow()}
</section>
${skillsBlock(C.skills)}
<section class="tb-explore">
${subHead({eyebrow:"The work", title:"Explore my categories"})}
<div class="tb-ex-grid">${tiles.map(x=>`<a class="tb-ex" href="${x.href}" data-tab="${x.id}"><span class="tb-ex-img">${x.anim?exaHTML(x.anim):x.vid?`<video data-vsrc="${x.vid}" poster="${x.img}" autoplay muted loop playsinline preload="none" disablepictureinpicture></video>`:x.img?`<img src="${x.img}" alt="" loading="lazy" decoding="async">`:`<span class="tb-ex-ph"><span class="soon-orb"></span><span class="mono">COMING SOON</span></span>`}</span><span class="tb-ex-t">${esc(x.t)} <i>→</i></span><span class="tb-ex-d">${esc(x.d)}</span></a>`).join("")}</div>
</section>
${contactBlock(true)}`;
const H2 = H; const tick = ()=>{ const el=document.getElementById("w-time"); if(el) el.innerHTML = esc(new Date().toLocaleTimeString("en-US",{hour:"numeric",minute:"2-digit",timeZone:H2.timezone})).replace(":","<span class=\"tb-colon\">:</span>"); };
tick(); clockTimer = setInterval(tick, 15000);
/* Oct 20 2026 10:50 PM her voice note ("the thumbnail on the landing page about us is not playing"): the About loop waited for
all 9 parts (7.9 MB) of the 4K file before it could start, never retried a failed part, and never re-tried play() when the
browser refused or paused it. Now: the 1.8 MB 1080p cut starts first on every screen, desktops swap to 4K once it is in
(staying on 1080p if that fails), a failed load retries, and it plays whenever it is on screen (or on the first touch/scroll
if the browser blocked autoplay). */
const lv = main.querySelector(".tb-loop video");
if(lv){
lv.muted = true; lv.defaultMuted = true;
const go = ()=>{ if(!lv.isConnected || !lv.paused || !lv.currentSrc) return; lv.play().catch(()=>{ const once=()=>{ if(lv.isConnected && lv.paused) lv.play().catch(()=>{}); }; ["pointerdown","touchstart","scroll","keydown"].forEach(ev=>addEventListener(ev, once, {once:true, passive:true})); }); };
const ld = (v)=>{ if(window.vload) vload(v); else v.src = v.dataset.vsrc; };
lv.addEventListener("vready", go); lv.addEventListener("loadeddata", go); lv.addEventListener("canplay", go);
ld(lv);
let tries = 0; const rt = setInterval(()=>{ if(!lv.isConnected || lv.currentSrc || ++tries > 6){ clearInterval(rt); return; } if(lv.dataset.vloaded === "") ld(lv); }, 3000);
if(L.src4k && window.vload && window.matchMedia && matchMedia("(min-width: 901px)").matches){
const hi = document.createElement("video"); hi.muted = true; hi.preload = "none"; hi.dataset.noauto = "1"; hi.dataset.vsrc = L.src4k;
hi.addEventListener("vready", ()=>{ const u = hi.src; hi.removeAttribute("src"); if(!lv.isConnected || !u) return;
const lo = lv.currentSrc, t0 = lv.currentTime;
const back = ()=>{ if(lo){ lv.src = lo; go(); } };
lv.addEventListener("error", back, {once:true});
lv.addEventListener("loadedmetadata", ()=>{ lv.removeEventListener("error", back); try{ lv.currentTime = t0 % (lv.duration || 4.5); }catch(_){} go(); }, {once:true});
lv.src = u; go(); }, {once:true});
lv.addEventListener("playing", ()=>vload(hi), {once:true}); // fetch the 4K parts only after the 1080p cut is moving
}
if("IntersectionObserver" in window) new IntersectionObserver(es=>es.forEach(e=>{ if(e.isIntersecting) go(); }),{threshold:0.1}).observe(lv);
}
main.querySelectorAll(".tb-exa").forEach(el=>{ const urls=[...new Set([...el.querySelectorAll("i")].map(i=>(i.style.backgroundImage.match(/url\(["']?([^"')]+)/)||[])[1]).filter(Boolean))]; const ready=Promise.race([Promise.all(urls.map(u=>new Promise(r=>{ const im=new Image(); im.onerror=r; im.onload=()=>(im.decode?im.decode():Promise.resolve()).then(r,r); im.src=u; }))), new Promise(r=>setTimeout(r,1800))]); const go=()=>ready.then(()=>el.classList.add("in")); if("IntersectionObserver" in window){ const io=new IntersectionObserver(es=>{ if(es.some(e=>e.isIntersecting)){ io.disconnect(); go(); } },{threshold:.25}); io.observe(el); } else go(); }); /* Oct 25 2026: animated UI/UX tile slides in when seen */
main.querySelectorAll(".tb-ex-img video").forEach(v=>{ v.muted=true; const go=()=>{ if(window.vload) vload(v); else v.src=v.dataset.vsrc; }; if("IntersectionObserver" in window){ const io=new IntersectionObserver(es=>{ if(es.some(e=>e.isIntersecting)){ io.disconnect(); go(); } },{rootMargin:"300px"}); io.observe(v); } else go(); v.addEventListener("vready", ()=>v.play().catch(()=>{}), {once:true}); v.addEventListener("loadeddata", ()=>v.play().catch(()=>{}), {once:true}); });
document.title = C.meta.title;
},
uiux(){
const g = G.uiux;
const W3 = ["hm-trades","stikboo","chainai","hex-memecoin","presale-memecoin-landing","redesigned-neon-ui"];
const PRI=["auxhr","warblelive","hm-trades","sofavault","hex-memecoin","invora"]; /* Oct 20 2026 9:23 PM her ask: meme coin landing swaps with Stikboo (Stikboo now sits after Navra) */ /* Oct 19 2026: AuxHR first, before WarbleLive (her ask) */ const OR=k=>{const p=PRI.indexOf(k); return p>=0?p:10+g.cases.indexOf(k);};
const colA = g.cases.filter(k=>!W3.includes(k)), colB = g.cases.filter(k=>W3.includes(k));
main.innerHTML = `<section class="tb-page">${pageHead(g)}<div class="cards tb-cards tb-split"><div class="tb-col">${colA.map(k=>`<div class="tb-cw" style="--o:${OR(k)}">${TB.workCards([k])}</div>`).join("")}</div><div class="tb-col">${colB.map(k=>`<div class="tb-cw" style="--o:${OR(k)}">${TB.workCards([k])}</div>`).join("")}</div></div></section>${footSmall()}`;
document.title = `${g.title} | ${B.name}`;
if(window.vhydrate) vhydrate(main);
},
motion(){
/* Oct 18 2026 v7: the living AI / Motion page lives in motion-page.js (+ .css); loaded on demand on an in-place tab switch */
if(window.TBMotionPage){ window.TBMotionPage({ main, C, G, B, esc, pageHead, subHead, footSmall, secById }); return; }
if(!window.__tbMP){ window.__tbMP = 1; let n = 0; const ready = ()=>{ if(++n===2 && active==="motion" && window.TBMotionPage) RENDER.motion(); };
const l = document.createElement("link"); l.rel = "stylesheet"; l.href = U("motion-page.css?v=7"); l.onload = l.onerror = ready; document.head.appendChild(l);
const s = document.createElement("script"); s.src = U("motion-page.js?v=7"); s.onload = s.onerror = ready; document.head.appendChild(s); }
const g = G.motion;
const secs = g.sections.map(secById).filter(Boolean);
main.innerHTML = `<section class="tb-page">${pageHead(g)}
<nav class="tb-chips" aria-label="Sections">${secs.map(s=>`<a href="#${s.id}">${esc(s.title)}</a>`).join("")}</nav>
<div class="cards tb-cards">${TB.workCards(g.featured)}</div></section>
${secs.map((s,i)=>`<section class="tb-page tb-subsec" id="${s.id}">${subHead(s, "0"+(i+1))}${vgrid(s)}</section>`).join("")}
${footSmall()}`;
document.title = `${g.title} | ${B.name}`;
TB.wireVideos(main);
},
brand(){
const g = G.brand;
main.innerHTML = `<section class="tb-page">${pageHead(g)}<div class="cards tb-cards">${TB.workCards(g.cases)}</div>
<div class="vgrid cols-1 tb-vgrid tb-solo">${TB.tile(g.soon)}</div></section>${footSmall()}`;
document.title = `${g.title} | ${B.name}`;
if(window.vhydrate) vhydrate(main);
},
video(){
const g = G.video;
const secs = g.sections.map(secById).filter(Boolean);
main.innerHTML = `<section class="tb-page">${pageHead(g)}${secs.map(s=>vgrid(s)).join("")}</section>${footSmall()}`;
document.title = `${g.title} | ${B.name}`;
TB.wireVideos(main);
videoFS(main, secs);
}
};
/* Oct 24 2026 6:23 PM her ask ("why am I clicking to watch the videos on video edit [and it] is not clicking?"): a tap on a
UGC / Video Edits card used to only unmute the small card in place. Now any card opens the full-screen player of the
AI / Motion page (motion-page.js, TBMotionLB) and plays with sound; swipe / arrows go through the 5 edits. */
function videoFS(main, secs){
const P = [];
secs.forEach(s=>s.items.forEach(it=>{ if(it.soon || !it.src) return;
P.push({ sec: s.id, title: it.title, meta: it.meta||"", src: it.src, poster: it.poster||"", ar: it.ar||"16/9", href: it.href||"",
brand: it.brand||String(s.title||"").toUpperCase(), years: "", dot: it.dot||"var(--lilac)", outcome: it.title, role: "", badges: [], short: "", desc: it.desc||"",
cta: "Watch", link: it.link||"", linkLabel: it.linkLabel||"", caseLabel: it.caseLabel||"" }); }));
const need = ()=>{ if(window.TBMotionLB || window.__tbMPv) return; window.__tbMPv = 1;
if(!document.querySelector('link[href*="motion-page.css"]')){ const l = document.createElement("link"); l.rel = "stylesheet"; l.href = U("motion-page.css?v=7"); document.head.appendChild(l); }
const s = document.createElement("script"); s.src = U("motion-page.js?v=11"); document.head.appendChild(s); };
need();
main.querySelectorAll(".vtile:not(.soon) .vmedia").forEach((m,k)=>{
const lb = m.querySelector(".snd"); if(lb){ lb.setAttribute("aria-label","Tap to watch"); const l = lb.querySelector(".l"); if(l) l.textContent = "Tap to watch"; }
m.addEventListener("click",(e)=>{
e.preventDefault(); e.stopPropagation();
main.querySelectorAll(".vtile video").forEach(o=>{ try{ o.muted = true; o.pause(); }catch(_){} o.closest(".vtile")?.classList.remove("sound"); });
const go = ()=>{ window.TBMotionLB.set(P); window.TBMotionLB.open(k, m); };
if(window.TBMotionLB) go(); else { need(); let t = 0; const w = setInterval(()=>{ if(window.TBMotionLB){ clearInterval(w); go(); } else if(++t>80) clearInterval(w); }, 50); }
}, true);
});
}
function render(id, hash){
if(clockTimer){ clearInterval(clockTimer); clockTimer = null; }
main.querySelectorAll("video").forEach(v=>{ try{ v.pause(); }catch(_){} });
active = RENDER[id] ? id : "about";
body.dataset.tab = active;
markTab(active);
RENDER[active]();
if(hash){ const t=document.getElementById(hash); if(t){ t.scrollIntoView(); return; } }
window.scrollTo(0,0);
}
/* in-place tab switching: intercept clicks on any link that points at a tab */
document.addEventListener("click",(e)=>{
if(e.defaultPrevented || e.button!==0 || e.metaKey || e.ctrlKey || e.shiftKey || e.altKey) return;
const a = e.target.closest("a[href]"); if(!a || a.target==="_blank") return;
const url = new URL(a.getAttribute("href"), location.href);
if(url.origin!==location.origin) return;
const id = a.dataset.tab || tabOfPath(url.pathname); if(!id) return;
const hash = a.dataset.hash || url.hash.slice(1);
if(!a.dataset.tab && !hash && url.pathname===location.pathname && a.getAttribute("href").startsWith("#")) return;
e.preventDefault();
if(id===active && hash){ const t=document.getElementById(hash); if(t){ t.scrollIntoView({behavior:"smooth"}); history.replaceState({tab:id}, "", url.pathname+"#"+hash); return; } }
if(id===active && !hash){ window.scrollTo({top:0,behavior:"smooth"}); return; }
history.pushState({tab:id}, "", url.pathname + (hash?"#"+hash:""));
render(id, hash);
});
window.addEventListener("popstate",()=>{ const id = tabOfPath(location.pathname); if(id) render(id, location.hash.slice(1)); });
/* first paint: no entrance animation after the first page */
render(active, location.hash.slice(1));
history.replaceState({tab:active}, "");
requestAnimationFrame(()=>{ body.classList.add("ready"); setTimeout(()=>body.classList.add("tb-swapped"), 1200); });
window.__siteReady = true;
})();
;(function(){var kick=function(){document.querySelectorAll('video[muted],video').forEach(function(v){if(v.muted&&v.paused&&v.src&&v.dataset.noauto!=='1'){var r=v.getBoundingClientRect();if(r.bottom>0&&r.top<innerHeight)v.play().catch(function(){});}});};
['touchstart','touchend','scroll','click'].forEach(function(e){addEventListener(e,kick,{passive:true});});
document.addEventListener('visibilitychange',function(){if(!document.hidden)kick();});setTimeout(kick,800);setTimeout(kick,2500);})();