Files
viraladblitz/public/assets/boost.js
T
Marty Bostick 001878bdae ViralAdBlitz v1 (viraladblitz.com rebuild, Marty approved 2026-11-14): the network's text-ad home, local build, not deployed
- Free text ad for network members (InstantAdPay / LinkSpin sign-in or wallet, membership through the hub), one per member
- Member pages viraladblitz.com/<username>: own ad + the first 5 people above in the hub line with a live ad (by place) + 2 Boosted places
- Front page: amber ticker (Boosted starred), Top ads this week by verified clicks, today's numbers, ledger, contract proof
- Verified visitors / views / clicks (ticket + dwell + per-visitor dedupe + per-connection cap + bot filter, owner excluded)
- Boost $5 = 500 guaranteed views through VABShop: keeper-signed EIP-712 line voucher from the hub line, watcher, delivery
  counted per verified view with an audit row each, Network Ad Space text-ad finishing after 30 days (vabnas.js)
- Trust pack: /ledger, /contract, toasts, Telegram card per Boost (once), Terms / Earnings Disclaimer / Privacy (TrustClickz),
  network footer from the hub with tracked links, promo kit (21 creatives) + /promote, LinkSpin zone placeholders, hub report
- Old YFW links via the oldrefs map (admin load route); docstore MySQL documents + row tables
- qa/smoke.mjs 162/162 (stand-in hub, chain, Telegram, NAS; Playwright desktop + phone), qa/chain.mjs 20/20 (real VABShop on anvil)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-14 13:52:03 -06:00

36 lines
2.5 KiB
JavaScript

// Boost page: the live POL price for 1..10 Boosts and the Buy button (one-time, never a subscription).
(async function () {
VAB.renderNav('/boost'); VAB.renderFooter(); VAB.wire('other').catch(() => {});
const $ = VAB.$;
const c = await VAB.getConfig().catch(() => ({}));
const b = c.boost || { usd: 5, views: 500, maxQty: 10 };
$('bViews').textContent = VAB.n(b.views); $('bViews2').textContent = VAB.n(b.views); $('bDays').textContent = c.deliverDays || 30;
for (let i = 1; i <= (b.maxQty || 10); i++) { const o = document.createElement('option'); o.value = i; o.textContent = i + (i === 1 ? ' Boost' : ' Boosts'); $('bQty').appendChild(o); }
const live = !!(c.shop && c.shop.live);
const me = await VAB.getJSON('/api/me').catch(() => ({}));
const qty = () => Number($('bQty').value) || 1;
function who() {
if (!live) { $('bWho').textContent = 'Boosts open when the contract goes live. Post your free ad now.'; $('bBuy').disabled = true; return; }
$('bBuy').disabled = false;
$('bWho').textContent = me.signedIn ? 'Signed in as ' + (me.username ? '@' + me.username : VAB.short(me.address)) + '. Pay from this same wallet.' : 'Sign in on My page first, then pay from the same wallet.';
}
async function price() {
const n = qty(); $('bUsd').textContent = '$' + (b.usd * n); $('bViews2').textContent = VAB.n(b.views * n);
if (!live) { $('bPol').textContent = 'paid in POL at the live price'; return; }
const q = await VABBuy.quote(n).catch(() => ({ error: 'x' }));
$('bPol').textContent = q.error ? 'price unavailable right now' : 'about ' + VABBuy.fmtPol(q.wei, 2) + ' POL at today\'s price';
}
who(); await price(); $('bQty').onchange = price; setInterval(price, 60000);
let busy = false;
$('bBuy').onclick = async () => {
if (busy) return; busy = true; $('bBuy').disabled = true;
try {
if (!me.signedIn) { location.href = '/my'; return; }
const before = ((await VAB.getJSON('/api/my')).boosts || []).length;
const r = await VABBuy.run({ qty: qty(), done: async () => (((await VAB.getJSON('/api/my')).boosts || []).length > before) });
VAB.status((r.recorded ? 'Your Boost is live: your ad is starred on the ticker and its views are being delivered. Follow it on My page.' : 'Paid and confirmed. Your Boost shows on My page within a few minutes.') + (r.link ? ' Transaction: ' + r.link : ''), 'ok');
} catch (e) { VAB.status(String(e && e.message || e).slice(0, 400), 'err'); }
finally { busy = false; who(); }
};
})();