From d6e1e1598277eeea89305960ca0c03df6e591d76 Mon Sep 17 00:00:00 2001 From: type-two Date: Tue, 23 Jun 2026 23:22:46 +1000 Subject: [PATCH] =?UTF-8?q?feat(shop):=20storefront=20release=20page=20get?= =?UTF-8?q?s=20=E2=96=B6=20Listen=20too=20(Apple=20preview=20/=20YouTube?= =?UTF-8?q?=20/=20Beatport)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Same audio affordance as the kiosk on release.html — Apple 30s preview (instant audio), else YouTube embed, else Beatport/Bandcamp embed, + country-scoped Apple Music link. Co-Authored-By: Claude Opus 4.8 --- site/release.html | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/site/release.html b/site/release.html index 6855436..97f4b81 100644 --- a/site/release.html +++ b/site/release.html @@ -71,6 +71,7 @@ async function render(){ ${show('title')?`

${esc(r.title||'')}

`:''}${show('artist')?`
${aHtml}
`:''}
${meta.map(m=>`${esc(String(m))}`).join('')}
${tags.map(t=>`${esc(t.n)}`).join('')}
+
${show('cart')||show('price')?`
${(d.copies||[]).map(c=>`
${money(c.price)}
${esc(c.condition||'')}${c.sleeve_cond?' / '+esc(c.sleeve_cond):''} · ${esc(c.sku)}
${buy(c)}
`).join('')||'
no copies in stock
'}
`:''}
${(d.copies||[]).length?"Want a different copy? Request it":"Not in stock — request this record"} →
@@ -78,7 +79,26 @@ async function render(){ ${show('tracklist')&&d.tracks.length?`

Tracklist

${d.tracks.map(t=>``).join('')}
${esc(t.position||'')}${esc(t.title||'')}${esc(t.duration||'')}
`:''} ${show('description')&&r.notes?`

Notes

${esc(r.notes)}
`:''}`; + loadAudio(r.id); } +function ytId(uri){ const m=String(uri||'').match(/(?:v=|youtu\.be\/|embed\/)([\w-]{11})/); return m?m[1]:(/^[\w-]{11}$/.test(uri||'')?uri:null); } +async function loadAudio(rid){ + const z=$('#listen'); if(!z) return; z.innerHTML=''; + const d=await fetch('/shop/audio/'+rid).then(r=>r.json()).catch(()=>({})), v=d.videos||[]; + let html=''; + if(d.apple_preview){ html=``; } + else { const yt=v.map(x=>ytId(x.uri)).find(Boolean); + if(yt) html=``; + else if(d.beatport_embed) html=d.beatport_embed; + else if(d.bandcamp_embed) html=d.bandcamp_embed; + } + if(d.apple && d.apple.url) html+=` Apple Music ↗`; + z.innerHTML=html; +} +function resetLbtn(){ const b=$('#lbtn'); if(b) b.innerHTML='▶ Listen · 30s'; } +function togglePreview(url){ const au=$('#aud'), b=$('#lbtn'); if(!au) return; + if(au.paused){ if(au.src!==url) au.src=url; au.play(); b.textContent='⏸ Pause'; } else { au.pause(); resetLbtn(); } } +function playYT(id){ $('#listen').innerHTML=``; } boot();