Files
vbb/public/assets/static.js
T

16 lines
1.0 KiB
JavaScript

// How it works + Packages: nav, footer, and the live config numbers.
(async function () {
const page = location.pathname.replace(/\/$/, '') || '/';
VBB.renderNav(page); VBB.renderFooter();
const c = await VBB.getConfig().catch(() => ({}));
const set = (k, v) => document.querySelectorAll('[data-k=' + k + ']').forEach(el => { el.textContent = v; });
if (c.perShift) set('perShift', c.perShift);
if (c.viewsPerCycle != null) set('views', VBB.n(c.viewsPerCycle));
if (c.visitSeconds) set('secs', c.visitSeconds);
// planned package prices from config (Marty 2026-11-13); still coming soon, nothing is sold here
const money = v => '$' + (Number.isInteger(v) ? v : Number(v).toFixed(2));
const pp = document.getElementById('pkPacks');
if (pp && c.packs && c.packs.length) pp.innerHTML = c.packs.map(p => '<li>' + VBB.n(p.credits) + ' post credits for ' + money(p.usd) + '</li>').join('');
const lk = document.getElementById('pkLook'); if (lk && c.lookUsd) lk.textContent = money(c.lookUsd) + ' per banner';
})();