// Join the network free (/join) and confirm the email (/confirm?t=). The join is booked to the reshare link the visitor came through. (async function () { const $ = VAS.$; if ($('joinForm')) { const f = await VAS.getJSON('/api/join/form'); if (f.via && f.via.resharer) $('viaNote').textContent = 'You came through @' + f.via.resharer + '\'s reshare of "' + f.via.headline + '". One free account for every network site.'; $('joinForm').addEventListener('submit', async e => { e.preventDefault(); const r = await VAS.post('/api/join', { email: $('email').value.trim(), username: $('username').value.trim(), form: f.form }); if (r.error) return VAS.status(r.error, 'err'); $('joinForm').hidden = true; VAS.status(r.mailed ? 'Check your inbox: open the link we sent to confirm your email.' : 'Thanks. This is the staging copy, so no email is sent: the confirm link is on the admin page for testing.', 'ok'); }); } else { const t = new URLSearchParams(location.search).get('t') || ''; const r = await VAS.post('/api/confirm', { t }); if (r.error) return VAS.status(r.error, 'err'); VAS.status('Your email is confirmed. Welcome to the network. Sign in with your network account to post your own ad.', 'ok'); } })();