// Front page: the ticker, today's numbers, "Top ads this week" by verified clicks (with "On the wire" and "Boosted" views of the // ads the ticker already shows), the live ledger and the contract box. (async function () { VAB.renderNav('/'); VAB.renderFooter(); const $ = VAB.$, esc = VAB.esc; const d = await VAB.wire('front').catch(() => ({})); const t = d.today || {}; $('stViews').textContent = VAB.n(t.views); $('stClicks').textContent = VAB.n(t.vclicks); $('stBoosts').textContent = VAB.n(t.boosts); $('stAds').textContent = VAB.n(t.ads); const items = (d.board && d.board.items) || []; const wireAds = d.ticker || []; const views = { clicks: () => items.length ? items.map(x => VAB.paper(x, '#' + x.rank, 'board', VAB.n(x.clicks) + ' verified click' + (x.clicks === 1 ? '' : 's'))).join('') : '
No verified clicks yet this week. The first ad clicked by a verified visitor takes #1.
', wire: () => wireAds.length ? wireAds.map(x => VAB.paper(x, x.boosted ? '' : 'LIVE', 'wire')).join('') : 'The wire is quiet. Post the first text ad.
', boosted: () => { const b = wireAds.filter(x => x.boosted); return b.length ? b.map(x => VAB.paper(x, '', 'wire')).join('') : 'No Boosted ads on the wire right now. A Boost stars your ad here and on the ticker.
'; } }; const show = k => { $('boardCards').innerHTML = views[k](); document.querySelectorAll('#board [data-sort]').forEach(b => { const on = b.dataset.sort === k; b.classList.toggle('on', on); b.setAttribute('aria-pressed', on ? 'true' : 'false'); }); VAB.decorate(); }; document.querySelectorAll('#board [data-sort]').forEach(b => { b.onclick = () => show(b.dataset.sort); }); show('clicks'); // the ledger: the newest Boost rows and their payouts const L = await VAB.getJSON('/api/ledger?n=6').catch(() => ({})); const ex = L.explorer || 'https://polygonscan.com'; const who = (a, nm) => nm ? '@' + esc(nm) : esc(VAB.short(a || '')); const rows = []; for (const r of (L.items || [])) { const link = 'verify'; rows.push('