// public blog pages: the shared nav (with wallet status) and footer, nothing else (function () { try { IAP.renderNav(location.pathname.indexOf('/leaderboard') === 0 ? 'leaderboard' : 'blog'); } catch (e) {} })(); // Viral links (2026-09-21): a signed-in member sees this article's address with their own ?ref= on the // end, and the share buttons carry it too. Whoever opens it is tagged to them like an invite link. (async function () { try { const share = document.querySelector('p.share'); if (!share) return; const me = await (await fetch('/api/me')).json(); const tok = me && me.signedIn && (me.username || me.refCode); if (!tok) return; const link = 'https://instantadpay.com' + location.pathname + '?ref=' + encodeURIComponent(tok); share.querySelectorAll('a').forEach(a => { a.href = a.href.replace(encodeURIComponent('https://instantadpay.com' + location.pathname), encodeURIComponent(link)); }); const bar = document.createElement('div'); bar.id = 'viralBar'; bar.style.cssText = 'margin-top:18px;padding:12px 14px;border:1px solid var(--line);border-radius:12px;background:var(--card, rgba(255,255,255,.03));display:flex;gap:10px;align-items:center;flex-wrap:wrap'; bar.innerHTML = '
Your link for this article
' + link.replace(/[&<>]/g, '') + '
Share this and anyone who joins from it is yours, same as your invite link.
'; bar.querySelector('button').onclick = async () => { try { await navigator.clipboard.writeText(link); IAP.status('Link copied.', 'ok'); } catch (e) { IAP.status('Copy failed.', 'bad'); } }; share.parentNode.insertBefore(bar, share); } catch (e) {} })();