056e169814
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
26 lines
1.9 KiB
JavaScript
26 lines
1.9 KiB
JavaScript
// The Seed Bed (front page): the Spotlight row, the bed of packets with its filters, the verified visit, the PolHunter slot.
|
|
(async function () {
|
|
const $ = YPB.$;
|
|
let d = { bed: [] };
|
|
try { d = await YPB.wire('front'); } catch (e) {}
|
|
YPB.spotRow($('spots'), d);
|
|
const bed = d.bed || [];
|
|
let f = 'all';
|
|
const keep = x => f === 'all' || (f === 'sprouting' && x.stage === 'sprouting') || (f === 'review' && x.stage === 'review') || (f === 'free' && x.cost === 'free') || (f === 'crypto' && !!x.contract);
|
|
const paint = () => {
|
|
const l = bed.filter(keep);
|
|
$('bedList').innerHTML = l.length ? l.map(x => YPB.packetCard(x, { place: 'bed' })).join('')
|
|
: '<p class="empty">' + (bed.length ? 'No packet matches that filter yet.' : 'The Seed Bed is ready for its first program. <a href="/my?tab=plant">Plant yours, free</a>.') + '</p>';
|
|
YPB.decorate();
|
|
};
|
|
document.querySelectorAll('.filters .chip').forEach(b => { b.onclick = () => { f = b.dataset.f; document.querySelectorAll('.filters .chip').forEach(x => x.setAttribute('aria-pressed', String(x === b))); paint(); }; });
|
|
paint();
|
|
// PolHunter embed (the network pattern): the find code hides in one of the three steps. The mission is added in polhunter.com/admin at go-live.
|
|
const ph = document.createElement('script'); ph.async = true; ph.src = 'https://polhunter.com/embed.js'; ph.setAttribute('data-slots', '3'); ph.setAttribute('data-selector', '#how .step'); document.body.appendChild(ph);
|
|
})();
|
|
// seedling band: honour reduced motion (poster only)
|
|
(function () { var v = document.getElementById('growVid'); if (!v) return;
|
|
try { if (window.matchMedia('(prefers-reduced-motion: reduce)').matches) { v.removeAttribute('autoplay'); v.pause(); return; } } catch (e) {}
|
|
var go = function () { var r = v.play(); if (r && r.catch) r.catch(function () {}); };
|
|
if (v.readyState >= 2) go(); else v.addEventListener('canplay', go, { once: true }); })();
|