VBB v1 skeleton: off-chain loop engine, verified visitors, members, banners, leaderboards, admin; docstore + networksso from Downline Banners

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
martbost
2026-11-13 15:24:34 -06:00
commit 9d0dde4b57
28 changed files with 2374 additions and 0 deletions
+41
View File
@@ -0,0 +1,41 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1,viewport-fit=cover">
<title>Admin | Viral Banner Blitz</title>
<meta name="description" content="Viral Banner Blitz admin.">
<link rel="canonical" href="https://viralbannerblitz.com/admin">
<meta property="og:type" content="website">
<meta property="og:site_name" content="Viral Banner Blitz">
<meta property="og:title" content="Admin | Viral Banner Blitz">
<meta property="og:description" content="Viral Banner Blitz admin.">
<meta property="og:url" content="https://viralbannerblitz.com/admin">
<meta property="og:image" content="https://viralbannerblitz.com/art/og-share.png">
<meta property="og:image:width" content="1200">
<meta property="og:image:height" content="630">
<meta property="og:image:alt" content="Viral Banner Blitz: a community banner loop that moves with every verified visitor">
<meta name="twitter:card" content="summary_large_image">
<meta name="twitter:title" content="Admin | Viral Banner Blitz">
<meta name="twitter:description" content="Viral Banner Blitz admin.">
<meta name="twitter:image" content="https://viralbannerblitz.com/art/og-share.png">
<meta name="robots" content="noindex">
<meta name="theme-color" content="#0b1030">
<link rel="icon" type="image/svg+xml" href="/art/mark.svg"><link rel="icon" type="image/png" href="/art/icon-192.png"><link rel="apple-touch-icon" href="/art/icon-192.png">
<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Archivo:wght@700;800;900&family=Figtree:wght@400;500;600;700&family=JetBrains+Mono:wght@500;700&display=swap">
<link rel="stylesheet" href="/assets/vbb.css?v=1">
</head>
<body>
<main class="wrap">
<section class="hero"><h1>Admin</h1><p class="lead">Loop status and the cycle reward ledger. Rewards are recorded only; nothing is credited yet.</p></section>
<div class="card" id="tokCard"><div class="field"><label for="tok">Admin token</label><input id="tok" type="password" autocomplete="off"></div><button class="btn small" id="tokBtn">Open</button></div>
<div id="adm" hidden>
<div class="card"><h2>Status</h2><div class="stats" id="aStats"></div><pre class="mono small scroll" id="aRaw" style="white-space:pre-wrap;max-height:320px"></pre></div>
<div class="card"><h2>Rewards by member</h2><div class="scroll" id="aMembers"></div></div>
<div class="card"><h2>Ledger (newest first)</h2><div class="scroll" id="aLedger"></div></div>
</div>
<div id="status" class="note" hidden></div>
</main>
<script src="/assets/common.js?v=1"></script>
<script src="/assets/admin.js?v=1"></script>
</body>
</html>
+10
View File
@@ -0,0 +1,10 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 64 64" width="64" height="64">
<rect width="64" height="64" rx="15" fill="#141c4a"/>
<rect x="9" y="27" width="13" height="13" rx="3" fill="#5cc8ff"/>
<rect x="9" y="42" width="13" height="13" rx="3" fill="#f6f2e8"/>
<rect x="24" y="42" width="13" height="13" rx="3" fill="#ffb000"/>
<rect x="24" y="27" width="13" height="13" rx="3" fill="#f6f2e8" opacity=".35"/>
<path d="M22 20h9M17 25h8" stroke="#ff5b2e" stroke-width="3" stroke-linecap="round" opacity=".7"/>
<rect x="35" y="9" width="20" height="20" rx="4" fill="#ff5b2e" transform="rotate(12 45 19)"/>
<path d="M41 22l8-8m0 0h-6m6 0v6" stroke="#fff" stroke-width="2.6" stroke-linecap="round" stroke-linejoin="round" fill="none" transform="rotate(12 45 19)"/>
</svg>

After

Width:  |  Height:  |  Size: 792 B

+5
View File
@@ -0,0 +1,5 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 125 125" width="125" height="125">
<rect width="125" height="125" fill="#141c4a"/>
<text x="62.5" y="58" fill="#7a83b3" font-family="sans-serif" font-size="12" font-weight="700" text-anchor="middle">Image did</text>
<text x="62.5" y="74" fill="#7a83b3" font-family="sans-serif" font-size="12" font-weight="700" text-anchor="middle">not load</text>
</svg>

After

Width:  |  Height:  |  Size: 414 B

+25
View File
@@ -0,0 +1,25 @@
// Admin: status + the cycle reward ledger, read with the ADMIN_TOKEN (kept in this tab only).
(function () {
VBB.renderNav('');
const $ = VBB.$, esc = VBB.esc;
let tok = ''; try { tok = sessionStorage.getItem('vbb.admin') || ''; } catch (e) {}
const get = u => VBB.getJSON(u, { headers: { 'x-admin-token': tok } });
async function open() {
const s = await get('/api/admin/status');
if (s.error) { VBB.status('That token was not accepted.', 'err'); return; }
try { sessionStorage.setItem('vbb.admin', tok); } catch (e) {}
$('tokCard').hidden = true; $('adm').hidden = false; VBB.status('');
$('aStats').innerHTML = [['Loop filled', s.loop.filled + ' / ' + s.loop.size], ['Waiting', s.queue.length], ['Next shift', s.progress + ' / ' + s.config.perShift + (s.held ? ' (held)' : '')],
['Shifts today', s.today.shifts], ['Cycles today', s.today.cycles], ['Visitors today', s.today.visits], ['Cycles total', s.totals.cycles], ['Views recorded', VBB.n(s.ledger.views)], ['Views credited', VBB.n(s.ledger.credited)], ['Members', s.members]]
.map(x => '<div class="stat"><b>' + esc(x[1]) + '</b><span>' + esc(x[0]) + '</span></div>').join('');
$('aRaw').textContent = JSON.stringify(s, null, 2);
const l = await get('/api/admin/ledger?n=300');
const who = r => r.username ? '@' + r.username : VBB.short(r.address || r.owner);
$('aMembers').innerHTML = l.members && l.members.length ? '<table class="t"><tr><th>Member</th><th class="n">Cycles</th><th class="n">Views</th></tr>' + l.members.map(m => '<tr><td>' + esc(who(m)) + '</td><td class="n">' + m.cycles + '</td><td class="n">' + VBB.n(m.views) + '</td></tr>').join('') + '</table>' : '<p class="muted">No cycles yet.</p>';
$('aLedger').innerHTML = l.entries && l.entries.length ? '<table class="t"><tr><th>When (CT)</th><th>Entry</th><th>Banner</th><th>Member</th><th class="n">Views</th><th>Status</th></tr>'
+ l.entries.map(e => '<tr><td>' + esc(new Date(e.at).toLocaleString('en-US', { timeZone: 'America/Chicago' })) + '</td><td class="mono">' + esc(e.id) + '</td><td>#' + e.bannerId + '</td><td>' + esc(who(e)) + '</td><td class="n">' + VBB.n(e.views) + '</td><td>' + esc(e.status) + '</td></tr>').join('') + '</table>' : '<p class="muted">The ledger is empty.</p>';
}
$('tokBtn').onclick = () => { tok = $('tok').value.trim(); open(); };
$('tok').addEventListener('keydown', e => { if (e.key === 'Enter') $('tokBtn').click(); });
if (tok) open();
})();
+61
View File
@@ -0,0 +1,61 @@
// Shared page helpers (VBB namespace, modelled on Downline Banners' common.js): nav, footer, toasts, fetch helpers.
window.VBB = (function () {
let cfgP = null;
const $ = id => document.getElementById(id);
const esc = s => String(s == null ? '' : s).replace(/[&<>"']/g, c => ({ '&': '&amp;', '<': '&lt;', '>': '&gt;', '"': '&quot;', "'": '&#39;' }[c]));
const getConfig = () => cfgP || (cfgP = fetch('/api/config').then(r => r.json()));
const short = a => a ? a.slice(0, 6) + '...' + a.slice(-4) : '';
const framed = (() => { try { return window.top !== window.self; } catch (e) { return true; } })();
function status(msg, cls) { const el = $('status'); if (!el) return; el.hidden = !msg; el.className = 'note ' + (cls || ''); el.textContent = msg || ''; }
async function getJSON(url, opts) { const r = await fetch(url, opts); let j = {}; try { j = await r.json(); } catch (e) {} if (!r.ok && !j.error) j.error = 'Request failed (' + r.status + ')'; return j; }
const post = (url, body) => getJSON(url, { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify(body || {}) });
const n = x => Number(x || 0).toLocaleString('en-US');
function renderNav(active) {
const nav = document.createElement('nav'); nav.className = 'top';
const links = [['/', 'The loop'], ['/leaders', 'Leaderboards'], ['/how', 'How it works'], ['/packages', 'Packages'], ['/my', 'My Banners']];
nav.innerHTML = '<div class="wrap"><a class="brand" href="/"><img src="/art/mark.svg" alt="" width="36" height="36"><span><span class="wm">Viral Banner <b>Blitz</b></span>'
+ '<span class="by">Part of the Crypto Team Build Network</span></span></a><div class="links">'
+ links.map(l => '<a href="' + l[0] + '"' + (l[0] === active ? ' class="on" aria-current="page"' : '') + '>' + l[1] + '</a>').join('') + '</div></div>';
document.body.prepend(nav);
// inside a traffic-exchange frame, the member page opens in a new tab
if (framed) document.querySelectorAll('nav a[href="/my"]').forEach(a => { a.target = '_blank'; a.rel = 'noopener'; });
}
function renderFooter() {
const f = document.createElement('footer'); f.className = 'foot';
f.innerHTML = '<div class="wrap"><p><b>Viral Banner Blitz</b>, part of the Crypto Team Build Network</p>'
+ '<p>A banner that cycles earns advertising across the network, not cash. Nothing here is an income opportunity.</p>'
+ '<p><a href="/">The loop</a> &middot; <a href="/leaders">Leaderboards</a> &middot; <a href="/how">How it works</a> &middot; <a href="/packages">Packages</a> &middot; <a href="/my">My Banners</a></p></div>';
document.body.appendChild(f);
toasts();
}
// live cycle toasts: real cycles from the ledger only, bottom-left, one at a time, never older than 30 minutes
let toastsOn = false;
function toasts() {
if (toastsOn) return; toastsOn = true;
const seen = new Set(); let first = true;
const box = document.createElement('div'); box.className = 'toasts'; box.setAttribute('aria-live', 'polite'); document.body.appendChild(box);
const show = c => {
const el = document.createElement('a'); el.className = 'toast'; el.href = '/how';
el.innerHTML = '<b>' + (c.name ? esc(c.name) + '\'s banner' : 'A banner') + ' just cycled</b><br><span>' + n(c.views) + ' network ad views earned for its owner</span>';
box.appendChild(el); requestAnimationFrame(() => el.classList.add('in'));
setTimeout(() => { el.classList.remove('in'); setTimeout(() => el.remove(), 400); }, 7000);
};
const tick = async () => {
let d; try { d = await getJSON('/api/recent'); } catch (e) { return; } if (!d || !d.cycles) return;
const fresh = d.cycles.filter(c => !seen.has(c.id)); d.cycles.forEach(c => seen.add(c.id));
const list = first ? fresh.slice(0, 1) : fresh.reverse(); first = false;
list.slice(0, 3).forEach((c, i) => setTimeout(() => show(c), 1500 + i * 8000));
};
tick(); setInterval(tick, 25000);
}
function tile(t, extra) {
const a = document.createElement('a'); a.className = 'tile' + (extra && extra.cls ? ' ' + extra.cls : '');
a.href = t.href; a.target = '_blank'; a.rel = 'noopener';
a.innerHTML = '<img alt="' + esc(t.owner ? 'Banner by ' + t.owner : 'Member banner #' + t.id) + '" width="125" height="125" loading="lazy" referrerpolicy="no-referrer">'
+ (extra && extra.pos ? '<span class="pos">' + esc(extra.pos) + '</span>' : '') + (t.owner ? '<span class="who">' + esc(t.owner) + '</span>' : '');
const img = a.querySelector('img'); img.src = t.img; img.onerror = () => { img.onerror = null; img.src = '/art/tile-fallback.svg'; };
return a;
}
return { $, esc, getConfig, short, framed, status, getJSON, post, n, renderNav, renderFooter, tile };
})();
+14
View File
@@ -0,0 +1,14 @@
// Weekly leaderboards: top 10 by verified visitors sent, top 10 by distinct traffic sources (Central time week).
(async function () {
VBB.renderNav('/leaders'); VBB.renderFooter();
const $ = VBB.$, esc = VBB.esc;
const d = await VBB.getJSON('/api/leaders');
if (d.error) return VBB.status(d.error, 'err');
const wk = new Date(d.week + 'T12:00:00Z').toLocaleDateString('en-US', { month: 'long', day: 'numeric', timeZone: 'UTC' });
$('weekLbl').textContent = 'Week of Monday ' + wk + ', Central time. Resets every Monday at 12:00 AM. Only verified visitors count: a real browser, on the page a few seconds, once a day per visitor.';
const table = (rows, main) => rows.length ? '<table class="t"><tr><th>#</th><th>Member</th><th class="n">' + (main === 'visitors' ? 'Visitors' : 'Sources') + '</th><th class="n">' + (main === 'visitors' ? 'Sources' : 'Visitors') + '</th></tr>'
+ rows.map((r, i) => '<tr><td><span class="rank">' + (i + 1) + '</span></td><td>' + esc(r.name) + '</td><td class="n"><b>' + VBB.n(r[main]) + '</b></td><td class="n">' + VBB.n(main === 'visitors' ? r.sources : r.visitors) + '</td></tr>').join('') + '</table>'
: '<p class="muted">Nobody yet this week. Share your link from <a href="/my">My Banners</a> and take the top spot.</p>';
$('lbVisitors').innerHTML = table(d.visitors, 'visitors');
$('lbSources').innerHTML = table(d.sources, 'sources');
})();
+75
View File
@@ -0,0 +1,75 @@
// My Banners: sign in (network or wallet), credits, post a banner, banner states, share link, cycle rewards.
(async function () {
VBB.renderNav('/my'); VBB.renderFooter();
const $ = VBB.$, esc = VBB.esc;
const c = await VBB.getConfig().catch(() => ({}));
const me = await VBB.getJSON('/api/me');
if (!me.signedIn) {
// signed in on InstantAdPay already? one quick hop there and back signs you in here too
try { const ss = await VBB.getJSON('/api/sso/status'); if (ss && ss.check) { location.replace('/sso/start?mode=check&via=iap&to=' + encodeURIComponent('/my')); return; } } catch (e) {}
$('signin').hidden = false;
if (!c.sso) { $('ssoIap').hidden = true; $('ssoLs').hidden = true; }
$('signBtn').onclick = async () => {
try { VBB.status('Check your wallet for the sign-in message.'); await VBBWallet.signIn(); location.reload(); }
catch (e) { VBB.status(String(e && e.message || e).slice(0, 300), 'err'); }
};
return;
}
$('outBtn').onclick = async () => { await VBB.post('/api/auth/logout'); location.reload(); };
let uploaded = '';
function preview(src) { const p = $('preview'); p.innerHTML = src ? '<img alt="Preview" width="125" height="125">' : '125 x 125<br>preview'; if (src) p.querySelector('img').src = src; }
$('img').addEventListener('input', () => { uploaded = ''; $('fileNote').textContent = ''; const v = $('img').value.trim(); preview(/^https:\/\//.test(v) ? v : ''); });
$('file').addEventListener('change', async e => {
const f = e.target.files[0]; if (!f) return;
if (f.size > 100 * 1024) { VBB.status('That file is ' + Math.ceil(f.size / 1024) + ' KB. The limit is 100 KB.', 'err'); return; }
$('fileNote').textContent = 'Uploading...';
const r = await VBB.getJSON('/api/my/upload', { method: 'POST', headers: { 'Content-Type': 'application/octet-stream' }, body: f });
e.target.value = '';
if (r.error) { $('fileNote').textContent = ''; VBB.status(r.error, 'err'); return; }
uploaded = r.img; $('img').value = ''; $('fileNote').textContent = 'Uploaded: ' + f.name; preview(r.img); VBB.status('');
});
$('postBtn').onclick = async () => {
const img = uploaded || $('img').value.trim();
if (!img) return VBB.status('Add an image address or upload a file.', 'err');
$('postBtn').disabled = true; VBB.status('Checking your image and link...');
const r = await VBB.post('/api/my/banners', { img, link: $('link').value.trim() });
$('postBtn').disabled = false;
if (r.error) return VBB.status(r.error, 'err');
uploaded = ''; $('img').value = ''; $('link').value = ''; $('fileNote').textContent = ''; preview('');
VBB.status(r.banner.state === 'loop' ? 'Posted. Your banner went straight into the loop.' : 'Posted. Your banner is number ' + r.banner.position + ' in line.', 'ok');
load();
};
$('copyBtn').onclick = () => { $('share').select(); try { navigator.clipboard.writeText($('share').value); } catch (e) { document.execCommand('copy'); } VBB.status('Link copied.', 'ok'); };
const where = b => b.state === 'queued' ? '<span class="pill queued">Waiting</span><br>Number ' + b.position + ' of ' + b.of + ' in line'
: b.state === 'loop' ? '<span class="pill loop">In the loop</span><br>Place ' + b.place + ' of ' + b.of + ', rides out in about ' + b.shiftsToRideOut + ' shift' + (b.shiftsToRideOut === 1 ? '' : 's')
: '<span class="pill cycled">Cycled</span><br>' + (b.cycledAt ? new Date(b.cycledAt).toLocaleString() : '');
async function load() {
const d = await VBB.getJSON('/api/my');
if (d.error) return VBB.status(d.error, 'err');
$('dash').hidden = false;
$('me').textContent = d.username ? '@' + d.username + ' (' + VBB.short(d.address) + ')' : d.address;
const live = d.banners.filter(b => b.state !== 'cycled').length, cyc = d.banners.filter(b => b.state === 'cycled').length;
$('stats').innerHTML = [['Post credits', d.credits], ['Banners waiting or in the loop', live], ['Banners cycled', cyc], ['Network ad views earned', VBB.n(d.rewardViews)]]
.map(x => '<div class="stat"><b>' + esc(x[1]) + '</b><span>' + esc(x[0]) + '</span></div>').join('');
$('creditNote').textContent = (d.grantedNow ? 'Your free credit for today was just added. ' : d.freeToday ? 'Today\'s free credit is in. ' : '')
+ 'One free credit arrives each day you sign in (they bank up to ' + d.freeCreditCap + '). You can have up to ' + d.maxQueued + ' banners waiting at once.';
$('postBtn').disabled = d.credits < 1;
if (d.credits < 1) VBB.status('You have used your credits. Come back tomorrow for a free one.');
$('mine').innerHTML = d.banners.length ? '' : '<p class="muted">No banners yet. Post your first one above.</p>';
for (const b of d.banners) {
const el = document.createElement('div'); el.className = 'item';
el.innerHTML = '<img alt="Banner #' + b.id + '" width="72" height="72"><div class="s">' + where(b) + '<br><a target="_blank" rel="noopener"></a><br><span class="muted">' + VBB.n(b.clicks) + ' clicks</span></div>';
el.querySelector('img').src = b.img; const a = el.querySelector('a'); a.href = b.link; a.textContent = b.link.replace(/^https:\/\//, '').slice(0, 60);
$('mine').appendChild(el);
}
$('share').value = d.share;
$('weekStats').innerHTML = [['Verified visitors you sent this week', d.week.visitors], ['Traffic sources this week', d.week.sources]]
.map(x => '<div class="stat"><b>' + esc(x[1]) + '</b><span>' + esc(x[0]) + '</span></div>').join('');
$('rewards').innerHTML = d.rewards.length ? '<table class="t"><tr><th>When</th><th>Banner</th><th class="n">Network ad views</th><th>Status</th></tr>'
+ d.rewards.map(e => '<tr><td>' + esc(new Date(e.at).toLocaleString()) + '</td><td>#' + e.bannerId + '</td><td class="n">' + VBB.n(e.views) + '</td><td>' + (e.status === 'recorded' ? 'Recorded' : esc(e.status)) + '</td></tr>').join('') + '</table>'
: '<p class="muted">No cycles yet. Your first reward appears when one of your banners rides out of the loop.</p>';
}
load(); setInterval(load, 30000);
})();
+65
View File
@@ -0,0 +1,65 @@
// The splash: the loop grid, the next-shift bar, the waiting queue, and this visitor's verified visit.
(async function () {
VBB.renderNav('/'); VBB.renderFooter();
const $ = VBB.$, esc = VBB.esc;
const c = await VBB.getConfig().catch(() => ({}));
document.querySelectorAll('[data-k=perShift]').forEach(el => { el.textContent = c.perShift || 10; });
document.querySelectorAll('[data-k=views]').forEach(el => { el.textContent = VBB.n(c.viewsPerCycle || 150); });
let lastLoop = null, known = new Set(), firstPaint = true;
function render(d) {
const pct = Math.min(100, Math.round(d.progress / d.perShift * 100));
$('prog').innerHTML = d.progress + '<small> / ' + d.perShift + '</small>';
$('bar').style.width = pct + '%'; $('barWrap').setAttribute('aria-valuemax', d.perShift); $('barWrap').setAttribute('aria-valuenow', d.progress);
$('progLbl').textContent = d.held ? 'bar full: the next banner posted shifts the loop' : 'verified visitors toward the next shift';
const t = d.today || {};
$('today').textContent = VBB.n(t.shifts) + ' shifts and ' + VBB.n(t.cycles) + ' cycles today';
// the loop
const ids = d.loop.map(x => x.id).join(',');
if (ids !== lastLoop) {
lastLoop = ids; const g = $('loop'); g.innerHTML = '';
const full = d.loop.length >= d.loopSize;
d.loop.forEach((t, i) => {
const last = full && i === d.loop.length - 1;
const el = VBB.tile(t, { pos: last ? 'NEXT OUT' : String(i + 1), cls: (last ? 'next' : '') + (!firstPaint && !known.has(t.id) ? ' fresh' : '') });
g.appendChild(el); known.add(t.id);
});
for (let i = d.loop.length; i < d.loopSize; i++) {
const a = document.createElement('a'); a.className = 'tile open'; a.href = '/my';
a.innerHTML = '<b>+</b>Open place<br>post yours'; g.appendChild(a);
}
firstPaint = false;
}
$('loopInfo').textContent = d.loop.length + ' of ' + d.loopSize + ' places filled';
// the queue
const q = $('queue'); q.innerHTML = '';
d.queue.forEach((t, i) => q.appendChild(VBB.tile(t, { pos: '#' + (i + 1) })));
$('queueEmpty').hidden = d.waiting > 0;
$('queueInfo').textContent = d.waiting ? VBB.n(d.waiting) + ' waiting' + (d.waiting > d.queue.length ? ', first ' + d.queue.length + ' shown' : '') : '';
}
async function load() { const d = await VBB.getJSON('/api/splash'); if (!d.error) render(d); }
await load(); setInterval(load, 8000);
// ---- this visit: a ticket now, redeemed once the page has been visible for visitSeconds ----
const note = $('visitNote');
const qs = new URLSearchParams(location.search);
const src = document.referrer || ''; // inside a traffic-exchange frame this is the exchange: the traffic source
const start = await VBB.post('/api/visit/start', { ref: qs.get('ref') || '', src }).catch(() => ({}));
if (!start || !start.ticket) { note.textContent = 'Share the loop: every verified visitor moves it forward.'; return; }
if (start.already) { note.textContent = 'Your visit already counted today. Thanks for pushing the loop.'; note.className = 'visit-note ok'; return; }
const need = (start.seconds || 6) * 1000;
let visible = 0, since = document.visibilityState === 'visible' ? Date.now() : 0, sent = false;
document.addEventListener('visibilitychange', () => {
if (document.visibilityState === 'visible') since = Date.now();
else if (since) { visible += Date.now() - since; since = 0; }
});
const timer = setInterval(async () => {
const v = visible + (since ? Date.now() - since : 0);
const left = Math.max(0, Math.ceil((need - v) / 1000));
if (left > 0) { note.textContent = 'Your visit counts toward the next shift in ' + left + ' second' + (left === 1 ? '' : 's') + '.'; return; }
if (sent) return; sent = true; clearInterval(timer);
const r = await VBB.post('/api/visit/seen', { ticket: start.ticket, visibleMs: v }).catch(() => ({}));
if (r.counted) { note.className = 'visit-note ok'; note.textContent = r.shifted ? 'Counted, and your visit shifted the loop!' : 'Counted. You pushed the loop one step closer to the next shift.'; load(); }
else note.textContent = r.why === 'already' ? 'Your visit already counted today. Thanks for pushing the loop.' : 'Thanks for visiting the loop.';
}, 500);
})();
+10
View File
@@ -0,0 +1,10 @@
// 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);
})();
+142
View File
@@ -0,0 +1,142 @@
/* Viral Banner Blitz. Own look (2026-11-13): midnight navy, signal orange and amber, Archivo + Figtree.
Not the InstantAdPay mint, not the Downline Banners ultraviolet + lime. Neutral class names (no "ad"/"banner" words:
ad blockers hide elements with those). */
:root{
--bg:#0b1030;--bg2:#10173f;--panel:#141c4a;--panel2:#1a2358;--ink:#f6f2e8;--muted:#a9b0d4;--faint:#7a83b3;
--line:rgba(255,255,255,.09);--line2:rgba(255,255,255,.16);
--hot:#ff5b2e;--hot-ink:#1a0800;--hot-soft:rgba(255,91,46,.14);--amber:#ffb000;--amber-soft:rgba(255,176,0,.13);
--sky:#5cc8ff;--sky-soft:rgba(92,200,255,.13);--ok:#3ddc97;--ok-soft:rgba(61,220,151,.13);--bad:#ff6b6b;--bad-soft:rgba(255,107,107,.13);
--disp:"Archivo","Arial Black",system-ui,sans-serif;--body:"Figtree","Segoe UI",system-ui,sans-serif;--mono:"JetBrains Mono",ui-monospace,Consolas,monospace;
--r:18px;--tile:125px;color-scheme:dark}
*{box-sizing:border-box}
html{-webkit-text-size-adjust:100%}
body{margin:0;background:var(--bg);color:var(--ink);font:16px/1.55 var(--body);min-height:100vh;
background-image:radial-gradient(60% 40% at 15% -5%,rgba(255,91,46,.16),transparent 70%),radial-gradient(50% 35% at 95% 0%,rgba(92,200,255,.10),transparent 70%),
radial-gradient(rgba(255,255,255,.035) 1px,transparent 1px);background-size:auto,auto,22px 22px;background-attachment:fixed,fixed,scroll}
a{color:var(--amber)} a:hover{color:#ffd166}
.wrap{max-width:1180px;margin:0 auto;padding-left:max(16px,env(safe-area-inset-left,0px));padding-right:max(16px,env(safe-area-inset-right,0px))}
h1,h2,h3{font-family:var(--disp);line-height:1.08;margin:0 0 10px;letter-spacing:-.01em;text-wrap:balance}
h1{font-size:clamp(30px,5.2vw,58px);font-weight:900}
h2{font-size:clamp(20px,2.6vw,26px);font-weight:800}
h3{font-size:17px;font-weight:700}
p{margin:8px 0}
.muted{color:var(--muted)} .small{font-size:13.5px} .mono{font-family:var(--mono)} .center{text-align:center}
/* nav */
nav.top{position:sticky;top:0;z-index:30;background:rgba(11,16,48,.86);backdrop-filter:blur(10px);-webkit-backdrop-filter:blur(10px);border-bottom:1px solid var(--line)}
nav.top .wrap{display:flex;align-items:center;gap:14px;min-height:62px;flex-wrap:wrap;padding-top:6px;padding-bottom:6px}
.brand{display:flex;align-items:center;gap:10px;text-decoration:none;color:var(--ink);min-width:0;margin-right:auto}
.brand img{flex:none}
.brand .wm{font:900 19px/1 var(--disp);letter-spacing:-.02em;white-space:nowrap}
.brand .wm b{color:var(--hot)}
.brand .by{display:block;font:500 11px/1.2 var(--body);color:var(--faint);letter-spacing:.02em;margin-top:3px}
nav.top .links{display:flex;gap:4px;flex-wrap:wrap}
nav.top .links a{color:var(--muted);text-decoration:none;font-weight:600;font-size:14px;padding:7px 11px;border-radius:999px}
nav.top .links a:hover{color:var(--ink);background:var(--line)}
nav.top .links a.on{color:var(--hot-ink);background:var(--amber)}
@media (max-width:720px){nav.top .links{width:100%;overflow-x:auto;flex-wrap:nowrap;scrollbar-width:none;margin:0 -4px 2px}nav.top .links::-webkit-scrollbar{display:none}nav.top .links a{flex:none}}
/* hero */
.hero{padding:34px 0 8px}
.hero .eyebrow{display:inline-flex;align-items:center;gap:8px;font:600 12px/1 var(--mono);letter-spacing:.14em;text-transform:uppercase;color:var(--amber);margin-bottom:14px}
.hero .eyebrow i{width:8px;height:8px;border-radius:50%;background:var(--hot);box-shadow:0 0 0 4px var(--hot-soft);animation:pulse 1.8s ease-in-out infinite}
.hero h1 em{font-style:normal;color:var(--hot)}
.hero .lead{color:var(--muted);font-size:clamp(16px,1.8vw,18.5px);max-width:720px}
@keyframes pulse{50%{box-shadow:0 0 0 8px rgba(255,91,46,0)}}
/* buttons */
.btn{display:inline-flex;align-items:center;justify-content:center;gap:8px;font:800 15px/1 var(--disp);letter-spacing:.01em;padding:13px 20px;border-radius:12px;border:0;cursor:pointer;
background:var(--hot);color:#fff;text-decoration:none;box-shadow:0 10px 30px -12px rgba(255,91,46,.8);transition:transform .12s ease,filter .12s ease}
.btn:hover{color:#fff;filter:brightness(1.08);transform:translateY(-1px)}
.btn:disabled{opacity:.5;cursor:not-allowed;transform:none}
.btn.sec{background:var(--panel2);color:var(--ink);box-shadow:none;border:1px solid var(--line2)}
.btn.amber{background:var(--amber);color:var(--hot-ink);box-shadow:0 10px 30px -14px rgba(255,176,0,.8)}
.btn.quiet{background:transparent;color:var(--muted);box-shadow:none;border:1px solid var(--line)}
.btn.small{padding:9px 13px;font-size:13px;border-radius:10px}
.row{display:flex;gap:10px;flex-wrap:wrap;align-items:center}
/* panels */
.card{background:linear-gradient(180deg,var(--panel),var(--bg2));border:1px solid var(--line2);border-radius:var(--r);padding:20px;margin:16px 0;box-shadow:0 24px 60px -40px rgba(0,0,0,.9)}
.card>h2:first-child,.card>h3:first-child{margin-top:0}
.note{border-radius:12px;padding:10px 14px;margin:12px 0;background:var(--sky-soft);border:1px solid rgba(92,200,255,.3);font-size:14.5px}
.note.err{background:var(--bad-soft);border-color:var(--bad)} .note.ok{background:var(--ok-soft);border-color:var(--ok)}
.stats{display:grid;grid-template-columns:repeat(auto-fit,minmax(150px,1fr));gap:10px;margin:12px 0}
.stat{background:var(--bg2);border:1px solid var(--line);border-radius:14px;padding:12px 14px}
.stat b{display:block;font:800 24px/1.15 var(--disp);font-variant-numeric:tabular-nums}
.stat span{color:var(--muted);font-size:13px}
/* the shift meter */
.meter{background:var(--bg2);border:1px solid var(--line2);border-radius:var(--r);padding:16px 18px;margin:18px 0 6px}
.meter-top{display:flex;align-items:baseline;gap:12px;flex-wrap:wrap;margin-bottom:10px}
.meter-top .big{font:900 34px/1 var(--disp);font-variant-numeric:tabular-nums;color:var(--amber)}
.meter-top .big small{font-size:18px;color:var(--muted);font-weight:700}
.meter-top .lbl{font-weight:600}
.meter-top .side{margin-left:auto;color:var(--muted);font-size:13.5px}
.bar{position:relative;height:16px;border-radius:999px;background:rgba(255,255,255,.07);overflow:hidden}
.bar i{position:absolute;inset:0 auto 0 0;width:0;border-radius:999px;background:linear-gradient(90deg,var(--hot),var(--amber));transition:width .6s cubic-bezier(.2,.8,.2,1)}
.bar i::after{content:"";position:absolute;inset:0;background:repeating-linear-gradient(115deg,rgba(255,255,255,.18) 0 10px,transparent 10px 20px);animation:slide 1.2s linear infinite}
@keyframes slide{to{background-position:40px 0}}
.ticks{display:flex;justify-content:space-between;margin-top:6px;font:500 11px var(--mono);color:var(--faint)}
.visit-note{font-size:13.5px;color:var(--muted);margin-top:10px;min-height:20px}
.visit-note.ok{color:var(--ok)}
/* the loop grid: 125x125 tiles */
.loop-head{display:flex;align-items:flex-end;gap:12px;flex-wrap:wrap;margin:26px 0 10px}
.loop-head h2{margin:0}
.loop-head .side{margin-left:auto;color:var(--muted);font-size:13.5px}
.grid{display:grid;grid-template-columns:repeat(auto-fill,var(--tile));gap:10px;justify-content:center}
.tile{position:relative;display:block;width:var(--tile);aspect-ratio:1;border-radius:12px;overflow:hidden;background:var(--panel);border:1px solid var(--line2);line-height:0;text-decoration:none}
.tile img{width:100%;height:100%;object-fit:cover;display:block}
.tile .pos{position:absolute;left:5px;top:5px;font:700 10.5px/1 var(--mono);background:rgba(11,16,48,.82);color:var(--ink);padding:3px 5px;border-radius:6px}
.tile .who{position:absolute;left:0;right:0;bottom:0;font:600 10.5px/1.2 var(--body);background:linear-gradient(0deg,rgba(11,16,48,.92),transparent);color:var(--ink);padding:14px 6px 5px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;opacity:0;transition:opacity .15s}
.tile:hover .who,.tile:focus-visible .who{opacity:1}
.tile.next{border:2px solid var(--hot);box-shadow:0 0 0 4px var(--hot-soft)}
.tile.next .pos{background:var(--hot);color:#fff}
.tile.fresh{animation:enter .7s cubic-bezier(.2,.8,.2,1)}
@keyframes enter{from{transform:scale(.6);opacity:0}}
.tile.open{display:flex;align-items:center;justify-content:center;flex-direction:column;gap:4px;border:1.5px dashed var(--line2);background:transparent;color:var(--faint);font:600 12px/1.25 var(--body);text-align:center;padding:8px}
.tile.open:hover{border-color:var(--amber);color:var(--amber)}
.tile.open b{font:900 22px/1 var(--disp)}
.queue{display:flex;gap:8px;overflow-x:auto;padding:4px 0 10px;scrollbar-width:thin}
.queue .tile{--tile:72px;flex:none;border-radius:9px}
.queue .tile .pos{font-size:9.5px}
.legend{display:flex;gap:16px;flex-wrap:wrap;color:var(--muted);font-size:13px;margin:10px 0 0}
.legend span{display:inline-flex;align-items:center;gap:6px}
.legend i{width:12px;height:12px;border-radius:3px;border:2px solid var(--hot)}
.legend i.n{border:1px solid var(--line2);background:var(--panel)}
@media (max-width:600px){:root{--tile:calc((100vw - 32px - 30px) / 4)}.grid{grid-template-columns:repeat(4,var(--tile));gap:10px}.meter-top .big{font-size:28px}}
/* steps */
.how{display:grid;grid-template-columns:repeat(auto-fit,minmax(220px,1fr));gap:12px;margin:12px 0;padding:0;list-style:none;counter-reset:s}
.how li{counter-increment:s;background:var(--bg2);border:1px solid var(--line);border-radius:14px;padding:14px 14px 14px 52px;position:relative}
.how li::before{content:counter(s);position:absolute;left:14px;top:14px;width:26px;height:26px;border-radius:8px;background:var(--amber);color:var(--hot-ink);font:900 14px/26px var(--disp);text-align:center}
.how li b{display:block;margin-bottom:2px}
/* tables + forms */
table.t{width:100%;border-collapse:collapse;font-size:14.5px}
table.t th,table.t td{text-align:left;padding:9px 8px;border-bottom:1px solid var(--line);vertical-align:middle}
table.t th{color:var(--muted);font:600 11.5px var(--mono);letter-spacing:.08em;text-transform:uppercase}
table.t td.n{text-align:right;font-family:var(--mono);font-variant-numeric:tabular-nums}
table.t tr.me td{background:var(--amber-soft)}
.scroll{overflow-x:auto}
.rank{display:inline-grid;place-items:center;width:26px;height:26px;border-radius:8px;background:var(--panel2);font:800 13px var(--disp)}
tr:nth-child(2) .rank{background:var(--amber);color:var(--hot-ink)}
.field{display:flex;flex-direction:column;gap:5px;margin:10px 0}
.field label{font-size:13.5px;color:var(--muted);font-weight:600}
.field input{background:#0a0f2a;border:1px solid var(--line2);border-radius:10px;padding:11px 12px;color:var(--ink);font:14px var(--mono);width:100%}
.field input:focus{outline:2px solid var(--amber);outline-offset:1px}
.post-grid{display:grid;grid-template-columns:auto 1fr;gap:18px;align-items:start}
@media (max-width:600px){.post-grid{grid-template-columns:1fr}}
.preview{width:125px;height:125px;border-radius:12px;border:1.5px dashed var(--line2);display:grid;place-items:center;color:var(--faint);font-size:12px;text-align:center;overflow:hidden;background:var(--bg2)}
.preview img{width:125px;height:125px;object-fit:cover;display:block}
.mine{display:grid;grid-template-columns:repeat(auto-fill,minmax(250px,1fr));gap:12px}
.mine .item{display:flex;gap:12px;background:var(--bg2);border:1px solid var(--line);border-radius:14px;padding:10px;align-items:center}
.mine .item img{width:72px;height:72px;border-radius:9px;object-fit:cover;flex:none}
.mine .item .s{font-size:13.5px;min-width:0}
.mine .item .s a{word-break:break-all}
.pill{display:inline-block;font:700 11px/1 var(--mono);letter-spacing:.06em;text-transform:uppercase;padding:4px 8px;border-radius:999px;margin-bottom:5px}
.pill.queued{background:var(--sky-soft);color:var(--sky)} .pill.loop{background:var(--amber-soft);color:var(--amber)} .pill.cycled{background:var(--ok-soft);color:var(--ok)}
.share{display:flex;gap:8px;flex-wrap:wrap}.share input{flex:1;min-width:200px}
.soon{border:1.5px dashed var(--line2);border-radius:var(--r);padding:26px 20px;text-align:center}
.soon .tag{display:inline-block;font:700 12px var(--mono);letter-spacing:.12em;text-transform:uppercase;color:var(--hot);background:var(--hot-soft);padding:5px 10px;border-radius:999px;margin-bottom:10px}
/* footer + toasts */
footer.foot{margin-top:48px;padding:28px 0 40px;border-top:1px solid var(--line);color:var(--muted);font-size:13.5px;text-align:center}
footer.foot a{color:var(--muted)} footer.foot p{margin:6px 0}
.toasts{position:fixed;left:max(16px,env(safe-area-inset-left,0px));bottom:max(16px,env(safe-area-inset-bottom,0px));z-index:50;display:flex;flex-direction:column;gap:8px;pointer-events:none}
.toast{pointer-events:auto;display:block;max-width:300px;background:var(--panel2);border:1px solid rgba(255,176,0,.4);border-radius:14px;padding:10px 14px;color:var(--ink);font-size:13.5px;line-height:1.35;
box-shadow:0 14px 34px -14px rgba(0,0,0,.9);opacity:0;transform:translateY(10px);transition:opacity .35s ease,transform .35s ease;text-decoration:none}
.toast.in{opacity:1;transform:none} .toast span{color:var(--muted);font-size:12.5px}
[hidden]{display:none!important}
@media (prefers-reduced-motion:reduce){*{animation:none!important;transition:none!important}}
+199
View File
@@ -0,0 +1,199 @@
// Viral Banner Blitz wallet sign-in: Downline Banners' wallet.js (same AppKit build, chain guard, dead-session recovery)
// with the buy functions removed. VBB v1 only signs a free sign-in message; it never sends a transaction.
window.VBBWallet = (function () {
const pad = v => BigInt(v).toString(16).padStart(64, '0');
const padAddr = a => { if (!a) return pad(0); if (!/^0x[0-9a-fA-F]{40}$/.test(a)) throw new Error('Bad address: ' + a); return a.slice(2).toLowerCase().padStart(64, '0'); };
// Normalize a chainId to a decimal number. eth_chainId is meant to return a
// hex string, but some wallets return a number or a decimal string — compare
// numerically so a wallet's shape never crashes the flow.
const chainNum = v => {
if (v == null) return NaN;
if (typeof v === 'number') return v;
const s = String(v).trim();
return /^0x/i.test(s) ? parseInt(s, 16) : parseInt(s, 10);
};
const APPKIT_URL = 'https://cdn.jsdelivr.net/npm/@reown/appkit-cdn@1.8.23/dist/appkit.js';
let modal = null, akPromise = null, provider = null;
async function initAppKit(c) {
if (modal) return modal;
if (akPromise) return akPromise;
akPromise = (async () => {
const mod = await import(APPKIT_URL);
const { createAppKit, WagmiAdapter, networks } = mod;
const netMap = { 80002: networks.polygonAmoy, 137: networks.polygon, 31337: networks.hardhat || networks.localhost };
const base = netMap[Number(c.chainId)] || networks.polygonAmoy;
// Override the chain's RPC with our clean public endpoint. AppKit's built-in
// networks advertise the WalletConnect RPC proxy
// (rpc.walletconnect.org/v1/?chainId=…&projectId=…) as the chain RPC, and
// wallets reject that query-string URL as "Invalid URL" when adding/switching
// the network — the cause of Trust's "Invalid URL", MetaMask's switch loop,
// and the failed mobile buy (the chain switch never completed).
const rpc = String(c.rpc || '').trim();
const net = rpc ? Object.assign({}, base, { rpcUrls: { default: { http: [rpc] }, public: { http: [rpc] } } }) : base;
// Accept the wallet's usual networks too, so AppKit doesn't trap the user in
// its own "Switch Network" modal — that modal loops on a testnet the wallet
// can't auto-add. We switch to `net` ourselves (wallet_addEthereumChain adds
// + switches in one step) and sendTx hard-guards the chain before signing.
const allNets = [net];
for (const k of ['polygon', 'mainnet']) {
try { const n = networks[k]; if (n && n.id !== net.id) allNets.push(n); } catch (e) {}
}
const projectId = String(c.walletConnectProjectId || '').trim();
const wagmiAdapter = new WagmiAdapter({ networks: allNets, projectId });
modal = createAppKit({
adapters: [wagmiAdapter], networks: allNets, projectId, defaultNetwork: net,
metadata: { name: 'Viral Banner Blitz', description: 'A community banner loop that moves with every verified visitor.',
url: location.origin, icons: [location.origin + '/logo-icon.png'] },
features: { analytics: false, email: false, socials: [] },
// Picker order: wallets without Trust's balance-proportion block go first.
// Trust Wallet is NOT excluded; it just drops out of the featured row into
// "All wallets" (Marty, 2026-09-09: move Trust to the bottom, not off).
featuredWalletIds: [
'0b415a746fb9ee99cce155c2ceca0c6f6061b1dbca2d722b3ba16381d0562150', // SafePal (recommended, listed first)
'c57ca95b47569778a828d19178114f4db188b89b763c899ba0be274e97267d96', // MetaMask
'a797aa35c0fadbfc1a53e7f675162ed5226968b44a19ee3d24385c64d1d3c393', // Phantom
'fd20dc426fb37566d803205b19bbc1d4096b248ac04548e3cfb6b3a38bd033aa' // Coinbase Wallet
]
});
return modal;
})();
return akPromise;
}
function currentAddress() { try { return (modal && modal.getAddress && modal.getAddress()) || null; } catch (e) { return null; } }
function waitForConnection(timeoutMs) {
if (currentAddress()) return Promise.resolve(currentAddress());
return new Promise((resolve, reject) => {
let done = false, unsub = null;
const finish = (addr, err) => { if (done) return; done = true; try { unsub && unsub(); } catch (e) {} err ? reject(err) : resolve(addr); };
try { unsub = modal.subscribeAccount(acc => { if (acc && acc.isConnected && acc.address) finish(acc.address); }); } catch (e) {}
const t0 = Date.now();
(function poll() {
if (done) return;
const a = currentAddress();
if (a) return finish(a);
if (Date.now() - t0 > (timeoutMs || 180000)) return finish(null, new Error('Wallet connection timed out. Tap Connect and try again.'));
setTimeout(poll, 400);
})();
});
}
async function resolveProvider() {
for (let i = 0; i < 20; i++) {
try { const p = modal.getWalletProvider ? await Promise.resolve(modal.getWalletProvider()) : null; if (p && p.request) return p; } catch (e) {}
await new Promise(r => setTimeout(r, 300));
}
throw new Error('Could not reach your wallet. Try connecting again.');
}
function eth() { if (!provider) throw new Error('Connect your wallet first.'); return provider; }
const isInjected = () => !!(provider && window.ethereum && (provider === window.ethereum || provider.isMetaMask));
// the account the wallet will actually sign with: for an injected wallet (MetaMask
// extension) that is its active account, which can differ from AppKit's cached one
async function activeAddress(fallback) {
if (isInjected()) { try { const a = await provider.request({ method: 'eth_accounts' }); if (a && a[0]) return a[0]; } catch (e) {} }
return fallback || currentAddress();
}
// Force the wallet's own account picker. Injected wallets stay connected to the
// site, so a plain disconnect/reconnect never shows one: asking for permissions
// again makes MetaMask open its account-selection prompt, and whatever the user
// ticks becomes the active account. WalletConnect wallets fall back to a fresh
// session (the picker + the wallet app's own account choice).
async function pickAccount() {
const c = await VBB.getConfig();
await initAppKit(c);
const inj = window.ethereum;
if (inj && inj.request) {
try {
await inj.request({ method: 'wallet_requestPermissions', params: [{ eth_accounts: {} }] });
const accs = await inj.request({ method: 'eth_accounts' });
if (accs && accs[0]) { provider = inj; await ensureChain(c).catch(() => {}); return accs[0]; }
} catch (e) {
if (e && (e.code === 4001 || /reject|denied/i.test(String(e.message || '')))) throw new Error('You closed the account picker. Pick the account you want and try again.');
}
}
return freshConnect(c);
}
// A WalletConnect session can die underneath AppKit's cached "connected"
// state: the wallet app rejects or kills it (Trust does this after its own
// security stop), the phone sleeps, the relay drops. AppKit still reports an
// address, so the next request fails with a "disconnected" style error.
// Detect that, wipe the stale session, and re-open the picker for a fresh one.
const DEAD_RE = /disconnect|not connected|no matching key|session (topic|expired|deleted|not found)|call connect|please call connect|missing or invalid|relay/i;
const isDead = e => DEAD_RE.test(String((e && e.message) || e || ''));
async function freshConnect(c) {
try { VBB.status('Your wallet session dropped. Reconnect in the picker…'); } catch (e) {}
await disconnect();
try { await modal.open(); } catch (e) {}
const addr = await waitForConnection(180000);
try { if (modal && modal.close) await modal.close(); } catch (e) {}
provider = await resolveProvider();
await ensureChain(c).catch(() => {});
return addr;
}
async function connect() {
const c = await VBB.getConfig();
await initAppKit(c);
let addr = currentAddress();
if (!addr) {
// give AppKit a moment to rehydrate an existing session before popping the
// picker — otherwise an already-connected wallet still gets the modal
for (let i = 0; i < 8 && !addr; i++) { await new Promise(r => setTimeout(r, 150)); addr = currentAddress(); }
}
if (!addr) { try { await modal.open(); } catch (e) {} addr = await waitForConnection(180000); }
try { if (modal && modal.close) await modal.close(); } catch (e) {} // dismiss the picker once we're connected
provider = await resolveProvider();
// probe the session: a dead WalletConnect session answers with a disconnect error
try { await provider.request({ method: 'eth_chainId' }); }
catch (e) { if (isDead(e)) return freshConnect(c); }
await ensureChain(c).catch(() => {}); // AppKit already connects on the right network; switch is best-effort
return addr;
}
async function ensureChain(c) {
const want = '0x' + Number(c.chainId).toString(16);
let cur; try { cur = await eth().request({ method: 'eth_chainId' }); } catch (e) { return; }
if (chainNum(cur) === Number(c.chainId)) return;
try {
await eth().request({ method: 'wallet_switchEthereumChain', params: [{ chainId: want }] });
} catch (e) {
// any failure (not just 4902): try to add the chain — wallet_addEthereumChain
// adds AND switches in one step, which is what unblocks wallets that can't
// otherwise reach a chain they don't already have (e.g. a testnet).
const addParams = { chainId: want, chainName: c.chainName, nativeCurrency: { name: 'POL', symbol: 'POL', decimals: 18 }, rpcUrls: [c.rpc] };
if (c.explorer && /^https?:\/\//i.test(c.explorer)) addParams.blockExplorerUrls = [c.explorer];
try { await eth().request({ method: 'wallet_addEthereumChain', params: [addParams] }); } catch (e2) {}
}
}
// SIWE: challenge -> personal_sign -> verify (server sets the session cookie)
async function signIn(opts) {
const addr = (opts && opts.pick) ? await pickAccount() : await activeAddress(await connect());
const ch = await (await fetch('/api/auth/challenge', { method: 'POST',
headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ address: addr }) })).json();
if (ch.error) throw new Error(ch.error);
// hex-encode the message (Trust and others require hex for personal_sign)
const hexMsg = '0x' + Array.from(new TextEncoder().encode(ch.message)).map(b => b.toString(16).padStart(2, '0')).join('');
const sig = await eth().request({ method: 'personal_sign', params: [hexMsg, addr] });
const r = await (await fetch('/api/auth/verify', { method: 'POST',
headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ address: addr, signature: sig, asPosition: !!(opts && opts.asPosition) }) })).json();
if (r.error) throw new Error(r.error);
return r;
}
async function disconnect() {
// AppKit's disconnect can hang on the WalletConnect relay (esp. mobile) —
// never block on it, so the UI can't get stuck "disconnecting".
try { if (modal && modal.disconnect) await Promise.race([modal.disconnect(), new Promise(r => setTimeout(r, 1200))]); } catch (e) {}
provider = null;
try { Object.keys(localStorage).forEach(k => { if (/wc@2|walletconnect|w3m|wcm|reown|wagmi|appkit/i.test(k)) localStorage.removeItem(k); }); } catch (e) {}
}
function walletName() { try { const w = modal && modal.getWalletInfo && modal.getWalletInfo(); return (w && w.name) || ''; } catch (e) { return ''; } }
return { connect, signIn, disconnect, address: currentAddress, activeAddress, pickAccount, walletName };
})();
+55
View File
@@ -0,0 +1,55 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1,viewport-fit=cover">
<title>How It Works | Viral Banner Blitz</title>
<meta name="description" content="How the Viral Banner Blitz loop works: post a 125x125 banner, every verified visitor moves the loop, and a banner that rides out earns network ad views.">
<link rel="canonical" href="https://viralbannerblitz.com/how">
<meta property="og:type" content="website">
<meta property="og:site_name" content="Viral Banner Blitz">
<meta property="og:title" content="How It Works | Viral Banner Blitz">
<meta property="og:description" content="How the Viral Banner Blitz loop works: post a 125x125 banner, every verified visitor moves the loop, and a banner that rides out earns network ad views.">
<meta property="og:url" content="https://viralbannerblitz.com/how">
<meta property="og:image" content="https://viralbannerblitz.com/art/og-share.png">
<meta property="og:image:width" content="1200">
<meta property="og:image:height" content="630">
<meta property="og:image:alt" content="Viral Banner Blitz: a community banner loop that moves with every verified visitor">
<meta name="twitter:card" content="summary_large_image">
<meta name="twitter:title" content="How It Works | Viral Banner Blitz">
<meta name="twitter:description" content="How the Viral Banner Blitz loop works: post a 125x125 banner, every verified visitor moves the loop, and a banner that rides out earns network ad views.">
<meta name="twitter:image" content="https://viralbannerblitz.com/art/og-share.png">
<meta name="theme-color" content="#0b1030">
<link rel="icon" type="image/svg+xml" href="/art/mark.svg"><link rel="icon" type="image/png" href="/art/icon-192.png"><link rel="apple-touch-icon" href="/art/icon-192.png">
<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Archivo:wght@700;800;900&family=Figtree:wght@400;500;600;700&family=JetBrains+Mono:wght@500;700&display=swap">
<link rel="stylesheet" href="/assets/vbb.css?v=1">
</head>
<body>
<main class="wrap">
<section class="hero"><h1>How the loop works</h1><p class="lead">One public page, one shared loop. The whole community moves it with real visitors.</p></section>
<ol class="how">
<li><b>Sign in, get a credit</b>Sign in through InstantAdPay, LinkSpin or a wallet. Every day you sign in you get one free post credit.</li>
<li><b>Post a banner</b>A 125x125 image and a link. It waits in line, then enters the loop at the front.</li>
<li><b>Visitors move the loop</b>Every <span data-k="perShift">10</span> verified visitors shift every banner one place forward.</li>
<li><b>Ride out, earn advertising</b>The banner at the end rides out. It has cycled, and you earn <span data-k="views">150</span> network ad views.</li>
</ol>
<div class="card">
<h2>What counts as a verified visitor</h2>
<p>A real browser that keeps the loop page open and visible for about <span data-k="secs">6</span> seconds. Each visitor counts once every 24 hours. Bots, crawlers and repeat visits do not count, and only a few visitors per internet connection count each day.</p>
</div>
<div class="card">
<h2>What a cycle earns</h2>
<p>A cycle earns network ad views: advertising for your own offers across the Crypto Team Build Network (InstantAdPay, LinkSpin and the network banner boards). It is advertising, not cash, and nothing here promises income.</p>
<p class="muted small">Right now each cycle is recorded on your My Banners page. Adding those views to your network advertising is the next step and is not switched on yet.</p>
</div>
<div class="card">
<h2>Weekly leaderboards</h2>
<p>Share your link (it ends in <span class="mono">?ref=</span> and your network username). The leaderboards count the verified visitors you send each week and how many different websites they came from.</p>
<div class="row"><a class="btn small" href="/my">Get my link</a><a class="btn quiet small" href="/leaders">See the leaders</a></div>
</div>
<div id="status" class="note" hidden></div>
</main>
<script src="/assets/common.js?v=1"></script>
<script src="/assets/static.js?v=1"></script>
</body>
</html>
+61
View File
@@ -0,0 +1,61 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1,viewport-fit=cover">
<title>Viral Banner Blitz | The banner loop the whole community pushes</title>
<meta name="description" content="A shared loop of 125x125 member banners. Every verified visitor moves it forward, and a banner that rides out of the loop earns advertising across the Crypto Team Build Network. Free to post once a day.">
<link rel="canonical" href="https://viralbannerblitz.com/">
<meta property="og:type" content="website">
<meta property="og:site_name" content="Viral Banner Blitz">
<meta property="og:title" content="Viral Banner Blitz | The banner loop the whole community pushes">
<meta property="og:description" content="A shared loop of 125x125 member banners. Every verified visitor moves it forward, and a banner that rides out of the loop earns advertising across the Crypto Team Build Network. Free to post once a day.">
<meta property="og:url" content="https://viralbannerblitz.com/">
<meta property="og:image" content="https://viralbannerblitz.com/art/og-share.png">
<meta property="og:image:width" content="1200">
<meta property="og:image:height" content="630">
<meta property="og:image:alt" content="Viral Banner Blitz: a community banner loop that moves with every verified visitor">
<meta name="twitter:card" content="summary_large_image">
<meta name="twitter:title" content="Viral Banner Blitz | The banner loop the whole community pushes">
<meta name="twitter:description" content="A shared loop of 125x125 member banners. Every verified visitor moves it forward, and a banner that rides out of the loop earns advertising across the Crypto Team Build Network. Free to post once a day.">
<meta name="twitter:image" content="https://viralbannerblitz.com/art/og-share.png">
<script type="application/ld+json">{"@context":"https://schema.org","@graph":[{"@type":"WebSite","name":"Viral Banner Blitz","url":"https://viralbannerblitz.com/"},{"@type":"Organization","name":"Viral Banner Blitz","url":"https://viralbannerblitz.com/","logo":"https://viralbannerblitz.com/art/icon-192.png","parentOrganization":{"@type":"Organization","name":"Crypto Team Build Network","url":"https://cryptoteambuild.com"}}]}</script>
<meta name="theme-color" content="#0b1030">
<link rel="icon" type="image/svg+xml" href="/art/mark.svg"><link rel="icon" type="image/png" href="/art/icon-192.png"><link rel="apple-touch-icon" href="/art/icon-192.png">
<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Archivo:wght@700;800;900&family=Figtree:wght@400;500;600;700&family=JetBrains+Mono:wght@500;700&display=swap">
<link rel="stylesheet" href="/assets/vbb.css?v=1">
</head>
<body>
<main class="wrap">
<section class="hero">
<div class="eyebrow"><i></i>Live loop</div>
<h1>Every visitor pushes the loop. <em>Ride it out, earn advertising.</em></h1>
<p class="lead">This page is the loop: member banners in 125x125 tiles. Every <b data-k="perShift">10</b> verified visitors shift it one place, and the banner at the end rides out. That banner has cycled, and its owner earns <b data-k="views">150</b> network ad views.</p>
<div class="row"><a class="btn" href="/my">Post your banner free</a><a class="btn sec" href="/how">How it works</a></div>
</section>
<section class="meter" aria-label="Next shift">
<div class="meter-top"><span class="big" id="prog">0<small> / 10</small></span><span class="lbl" id="progLbl">verified visitors toward the next shift</span><span class="side" id="today"></span></div>
<div class="bar" role="progressbar" aria-valuemin="0" id="barWrap"><i id="bar"></i></div>
<div class="visit-note" id="visitNote">Stay on this page for a few seconds and your visit counts toward the next shift.</div>
</section>
<div class="loop-head"><h2>The loop</h2><span class="side" id="loopInfo"></span></div>
<div class="grid" id="loop" aria-live="polite"></div>
<div class="legend"><span><i></i>Rides out at the next shift</span><span><i class="n"></i>Newest enters top left</span></div>
<div class="loop-head"><h2>Waiting to enter</h2><span class="side" id="queueInfo"></span></div>
<div class="queue" id="queue"></div>
<p class="muted small" id="queueEmpty" hidden>Nobody is waiting. A banner posted now enters the loop at the next shift.</p>
<div class="card">
<h3>Send visitors, move up the leaderboard</h3>
<p class="muted">Share your link from My Banners. Every verified visitor it brings moves the loop for everyone, and the weekly leaderboards count the visitors you send and how many different traffic sources they came from.</p>
<div class="row"><a class="btn amber small" href="/leaders">This week's leaders</a><a class="btn quiet small" href="/my">Get my link</a></div>
</div>
<div id="status" class="note" hidden></div>
</main>
<script src="/assets/common.js?v=1"></script>
<script src="/assets/splash.js?v=1"></script>
</body>
</html>
+37
View File
@@ -0,0 +1,37 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1,viewport-fit=cover">
<title>Weekly Leaderboards | Viral Banner Blitz</title>
<meta name="description" content="The members sending the most verified visitors to the Viral Banner Blitz loop this week, and the most different traffic sources.">
<link rel="canonical" href="https://viralbannerblitz.com/leaders">
<meta property="og:type" content="website">
<meta property="og:site_name" content="Viral Banner Blitz">
<meta property="og:title" content="Weekly Leaderboards | Viral Banner Blitz">
<meta property="og:description" content="The members sending the most verified visitors to the Viral Banner Blitz loop this week, and the most different traffic sources.">
<meta property="og:url" content="https://viralbannerblitz.com/leaders">
<meta property="og:image" content="https://viralbannerblitz.com/art/og-share.png">
<meta property="og:image:width" content="1200">
<meta property="og:image:height" content="630">
<meta property="og:image:alt" content="Viral Banner Blitz: a community banner loop that moves with every verified visitor">
<meta name="twitter:card" content="summary_large_image">
<meta name="twitter:title" content="Weekly Leaderboards | Viral Banner Blitz">
<meta name="twitter:description" content="The members sending the most verified visitors to the Viral Banner Blitz loop this week, and the most different traffic sources.">
<meta name="twitter:image" content="https://viralbannerblitz.com/art/og-share.png">
<meta name="theme-color" content="#0b1030">
<link rel="icon" type="image/svg+xml" href="/art/mark.svg"><link rel="icon" type="image/png" href="/art/icon-192.png"><link rel="apple-touch-icon" href="/art/icon-192.png">
<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Archivo:wght@700;800;900&family=Figtree:wght@400;500;600;700&family=JetBrains+Mono:wght@500;700&display=swap">
<link rel="stylesheet" href="/assets/vbb.css?v=1">
</head>
<body>
<main class="wrap">
<section class="hero"><div class="eyebrow"><i></i>This week</div><h1>Weekly leaderboards</h1><p class="lead" id="weekLbl">Monday to Sunday, Central time. Only verified visitors count: a real browser, on the page a few seconds, once a day per visitor.</p></section>
<div class="card"><h2>Most visitors sent</h2><div class="scroll" id="lbVisitors"></div></div>
<div class="card"><h2>Most traffic sources</h2><p class="muted small">Different websites your visitors came from (the referring site), so spreading your link widely counts.</p><div class="scroll" id="lbSources"></div></div>
<div id="status" class="note" hidden></div>
</main>
<script src="/assets/common.js?v=1"></script>
<script src="/assets/leaders.js?v=1"></script>
</body>
</html>
+80
View File
@@ -0,0 +1,80 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1,viewport-fit=cover">
<title>My Banners | Viral Banner Blitz</title>
<meta name="description" content="Post your 125x125 banner into the loop, see where each banner stands, and share your link.">
<link rel="canonical" href="https://viralbannerblitz.com/my">
<meta property="og:type" content="website">
<meta property="og:site_name" content="Viral Banner Blitz">
<meta property="og:title" content="My Banners | Viral Banner Blitz">
<meta property="og:description" content="Post your 125x125 banner into the loop, see where each banner stands, and share your link.">
<meta property="og:url" content="https://viralbannerblitz.com/my">
<meta property="og:image" content="https://viralbannerblitz.com/art/og-share.png">
<meta property="og:image:width" content="1200">
<meta property="og:image:height" content="630">
<meta property="og:image:alt" content="Viral Banner Blitz: a community banner loop that moves with every verified visitor">
<meta name="twitter:card" content="summary_large_image">
<meta name="twitter:title" content="My Banners | Viral Banner Blitz">
<meta name="twitter:description" content="Post your 125x125 banner into the loop, see where each banner stands, and share your link.">
<meta name="twitter:image" content="https://viralbannerblitz.com/art/og-share.png">
<meta name="robots" content="noindex">
<meta name="theme-color" content="#0b1030">
<link rel="icon" type="image/svg+xml" href="/art/mark.svg"><link rel="icon" type="image/png" href="/art/icon-192.png"><link rel="apple-touch-icon" href="/art/icon-192.png">
<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Archivo:wght@700;800;900&family=Figtree:wght@400;500;600;700&family=JetBrains+Mono:wght@500;700&display=swap">
<link rel="stylesheet" href="/assets/vbb.css?v=1">
</head>
<body>
<main class="wrap">
<section class="hero"><h1>My Banners</h1><p class="lead">Post a banner, watch it move through the loop, and share your link.</p></section>
<div class="card" id="signin" hidden>
<h2>Sign in</h2>
<p class="muted">Already a member of InstantAdPay or LinkSpin? Sign in through the network with one tap. Or sign a free message with SafePal or any other crypto wallet.</p>
<div class="row">
<a class="btn" id="ssoIap" href="/sso/start?mode=go&amp;via=iap&amp;to=%2Fmy">Sign in with InstantAdPay</a>
<a class="btn sec" id="ssoLs" href="/sso/start?mode=go&amp;via=linkspin&amp;to=%2Fmy">Sign in with LinkSpin</a>
<button class="btn sec" id="signBtn">Sign in with a wallet</button>
</div>
<p class="muted small">The wallet signature is free. It cannot move funds or approve anything.</p>
</div>
<div id="dash" hidden>
<div class="card">
<div class="row" style="justify-content:space-between"><div><span class="muted small">Signed in as</span> <span class="mono" id="me"></span></div><button class="btn quiet small" id="outBtn">Sign out</button></div>
<div class="stats" id="stats"></div>
<p class="muted small" id="creditNote"></p>
</div>
<div class="card" id="postCard">
<h2>Post a banner</h2>
<p class="muted small">125x125 PNG, JPG or GIF, up to 100 KB (250x250 also works for sharp screens). Link: https, a page that loads and allows frames. One post uses one credit.</p>
<div class="post-grid">
<div class="preview" id="preview">125 x 125<br>preview</div>
<div>
<div class="field"><label for="img">Image address (https), or upload a file</label><input id="img" placeholder="https://your-site.com/banner.png" autocomplete="off"></div>
<div class="row"><label class="btn sec small">Upload image<input type="file" id="file" accept="image/png,image/jpeg,image/gif" hidden></label><span class="muted small" id="fileNote"></span></div>
<div class="field"><label for="link">Target link (https)</label><input id="link" placeholder="https://your-site.com/page" autocomplete="off"></div>
<button class="btn" id="postBtn">Post to the loop</button>
</div>
</div>
</div>
<div class="card"><h2>Your banners</h2><div class="mine" id="mine"></div></div>
<div class="card">
<h2>Your link</h2>
<p class="muted small">Visitors who arrive through this link and stay a few seconds count for you on the weekly leaderboards. A visitor counts once a day.</p>
<div class="share"><input class="mono" id="share" readonly aria-label="Your link"><button class="btn sec small" id="copyBtn">Copy</button></div>
<div class="stats" id="weekStats"></div>
</div>
<div class="card"><h2>Cycle rewards</h2><p class="muted small">Each banner that rides out of the loop earns network ad views. They are recorded here now and will be added to your InstantAdPay or LinkSpin advertising when that link goes live. Ad views buy advertising, not income.</p><div class="scroll" id="rewards"></div></div>
</div>
<div id="status" class="note" hidden></div>
</main>
<script src="/assets/common.js?v=1"></script>
<script src="/assets/wallet.js?v=1"></script>
<script src="/assets/my.js?v=1"></script>
</body>
</html>
+42
View File
@@ -0,0 +1,42 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1,viewport-fit=cover">
<title>Packages | Viral Banner Blitz</title>
<meta name="description" content="Viral Banner Blitz packages are coming soon: one-time purchases, never a subscription. Until then, post free once a day.">
<link rel="canonical" href="https://viralbannerblitz.com/packages">
<meta property="og:type" content="website">
<meta property="og:site_name" content="Viral Banner Blitz">
<meta property="og:title" content="Packages | Viral Banner Blitz">
<meta property="og:description" content="Viral Banner Blitz packages are coming soon: one-time purchases, never a subscription. Until then, post free once a day.">
<meta property="og:url" content="https://viralbannerblitz.com/packages">
<meta property="og:image" content="https://viralbannerblitz.com/art/og-share.png">
<meta property="og:image:width" content="1200">
<meta property="og:image:height" content="630">
<meta property="og:image:alt" content="Viral Banner Blitz: a community banner loop that moves with every verified visitor">
<meta name="twitter:card" content="summary_large_image">
<meta name="twitter:title" content="Packages | Viral Banner Blitz">
<meta name="twitter:description" content="Viral Banner Blitz packages are coming soon: one-time purchases, never a subscription. Until then, post free once a day.">
<meta name="twitter:image" content="https://viralbannerblitz.com/art/og-share.png">
<meta name="theme-color" content="#0b1030">
<link rel="icon" type="image/svg+xml" href="/art/mark.svg"><link rel="icon" type="image/png" href="/art/icon-192.png"><link rel="apple-touch-icon" href="/art/icon-192.png">
<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Archivo:wght@700;800;900&family=Figtree:wght@400;500;600;700&family=JetBrains+Mono:wght@500;700&display=swap">
<link rel="stylesheet" href="/assets/vbb.css?v=1">
</head>
<body>
<main class="wrap">
<section class="hero"><h1>Packages</h1><p class="lead">Extra post credits and banner extras are on the way.</p></section>
<div class="soon">
<div class="tag">Coming soon</div>
<h2>One-time purchases. Never a subscription.</h2>
<p class="muted">Every package will be a single purchase you make once. Nothing renews, nothing bills you again.</p>
<p class="muted">Until packages open, every member gets one free post credit each day they sign in.</p>
<div class="row" style="justify-content:center;margin-top:14px"><a class="btn" href="/my">Use my free credit</a></div>
</div>
<div id="status" class="note" hidden></div>
</main>
<script src="/assets/common.js?v=1"></script>
<script src="/assets/static.js?v=1"></script>
</body>
</html>