// Promote page (2026-11-14): the promo kit from /api/promo-kit with the member's network username in every link. // Username: ?u= first, then the signed-in member's (My Banners), then the last one typed here (this browser only). (async function () { VBB.renderNav('/promote'); VBB.renderFooter(); const $ = VBB.$; const RE = /^(?:[A-Za-z0-9_.-]{2,40}|0x[0-9a-fA-F]{40})$/; let u = new URLSearchParams(location.search).get('u') || ''; let signed = false; if (!RE.test(u)) { u = ''; try { const me = await VBB.getJSON('/api/me'); if (me.signedIn) { u = me.username || me.address || ''; signed = true; } } catch (e) {} } if (!u) { try { u = localStorage.getItem('kit.u') || ''; } catch (e) {} if (!RE.test(u)) u = ''; } $('whoIn').value = u; if (signed) $('whoNote').textContent = 'Signed in: your links below use ' + (u.startsWith('0x') ? 'your wallet (no network username found yet)' : '@' + u) + '.'; async function show(name) { try { await KitPage.load($('kit'), name); VBB.status(''); } catch (e) { VBB.status('Could not load the kit. Try again in a moment.', 'err'); } } $('whoForm').addEventListener('submit', e => { e.preventDefault(); const v = $('whoIn').value.trim().replace(/^@/, ''); if (v && !RE.test(v)) return VBB.status('That does not look like a username: letters, numbers, dot, dash or underscore.', 'err'); try { localStorage.setItem('kit.u', v); } catch (e2) {} show(v); }); show(u); })();