Footer network links carry a referral username (Marty 2026-11-15): the signed-in member's own, else the ?ref= the visitor came in on; tracked links as s1, plain links as ?ref=, none for Earners Corner. common.js?v=8

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
martbost
2026-11-15 07:54:20 -06:00
parent 47cb360204
commit 6798503c1f
13 changed files with 26 additions and 16 deletions
+14 -4
View File
@@ -58,12 +58,22 @@ window.VBB = (function () {
// "Part of the network": the list comes from the hub through /api/network-sites, the built-in copy if it does not answer
const NET = [['iap', 'InstantAdPay', 'https://instantadpay.com'], ['linkspin', 'LinkSpin', 'https://linkspin.app'], ['dlb', 'Downline Banners', 'https://downlinebanners.com'],
['vbb', 'Viral Banner Blitz', 'https://viralbannerblitz.com'], ['stackpol', 'Stack POL', 'https://stackpol.com'], ['earnerscorner', 'Earners Corner', 'https://earnerscorner.com']].map(a => ({ id: a[0], name: a[1], url: a[2] }));
// the footer links carry a referral username (Marty 2026-11-15): the signed-in member's own, else the ?ref= this visitor came in on
// (vbb.ref cookie, usernames only). Tracked links get it as s1 (LinkSpin sends it on as ?ref=), plain links as ?ref=. Earners Corner takes none.
const REF_RE = /^[A-Za-z0-9_.-]{1,40}$/;
const refCookie = () => { const m = document.cookie.match(/(?:^|;\s*)vbb\.ref=([^;]*)/); try { const v = m ? decodeURIComponent(m[1]) : ''; return REF_RE.test(v) && !/^0x[0-9a-f]{40}$/i.test(v) ? v : ''; } catch (e) { return ''; } };
function withRef(s, ref) {
const href = s.go || s.url; if (!ref || s.id === 'earnerscorner') return href;
try { const u = new URL(href); u.searchParams.set(s.go ? 's1' : 'ref', ref); return u.toString(); } catch (e) { return href; }
}
function netLine(el) {
if (!el) return;
const paint = list => { el.innerHTML = '<b>Part of the network</b> &middot; One account across the network: ' + list.map(s => (s.id === 'vbb' || /viralbannerblitz\.com/.test(s.url))
? '<span class="here" aria-current="page">' + esc(s.name) + '</span>' : '<a href="' + esc(s.go || s.url) + '" target="_blank" rel="noopener nofollow">' + esc(s.name) + '</a>').join(' &middot; '); };
paint(NET);
fetch('/api/network-sites').then(r => r.json()).then(l => { if (Array.isArray(l) && l.length) paint(l); }).catch(() => {});
let list = NET; let ref = refCookie();
const paint = () => { el.innerHTML = '<b>Part of the network</b> &middot; One account across the network: ' + list.map(s => (s.id === 'vbb' || /viralbannerblitz\.com/.test(s.url))
? '<span class="here" aria-current="page">' + esc(s.name) + '</span>' : '<a href="' + esc(withRef(s, ref)) + '" target="_blank" rel="noopener nofollow">' + esc(s.name) + '</a>').join(' &middot; '); };
paint();
fetch('/api/network-sites').then(r => r.json()).then(l => { if (Array.isArray(l) && l.length) { list = l; paint(); } }).catch(() => {});
fetch('/api/me', { credentials: 'same-origin' }).then(r => r.json()).then(m => { if (m && m.signedIn && m.username && REF_RE.test(m.username)) { ref = m.username; paint(); } }).catch(() => {});
}
// live toasts: real cycles, purchases and prize payouts only, bottom-left, one at a time, never older than 30 minutes
let toastsOn = false;