// Printable half-sheet handouts with the member's QR + invite link. // The ref token (username, share code or member #) comes from ?ref=, then // localStorage (set by Promo tools), then the signed-in account. (function () { 'use strict'; var $ = function (id) { return document.getElementById(id); }; var ORIGIN = location.origin; var DESIGNS = [ { angle: 'instant', tag: 'Polygon · same-transaction payouts', h: 'Advertise & earn.
Paid on-chain, instantly.', lead: 'Every ad package splits to real wallets the second it sells. No pending. No withdraw button.', bullets: ['Free to join with just an email', 'Ad packages from $5, seven ad formats', 'Every payout public on the blockchain'] }, { angle: 'adspend', tag: 'For marketers who buy traffic', h: 'You were buying ads anyway.', lead: 'Here the ad spend in your line pays you, in the same transaction, on a public ledger.', bullets: ['Banners, text, login, solo, video, featured, visits', 'Dwell-timed views: real people, not scripts', '50 / 20 / 10 sponsor split, written in code'] }, { angle: 'free', tag: 'Costs nothing to try', h: 'Watch first.
Spend never.', lead: 'Join free, view a few ads, earn credits, and run your first campaign for zero dollars.', bullets: ['Email sign-in, no password, no wallet needed', 'Earn credits for your attention every day', 'Upgrade only if you want more reach'] } ]; function getRef() { var q = new URLSearchParams(location.search).get('ref'); if (q && /^[A-Za-z0-9_]{1,20}$/.test(q)) return q; try { var s = localStorage.getItem('iap.ref'); if (s && /^[A-Za-z0-9_]{1,20}$/.test(s)) return s; } catch (e) {} return ''; } function qrSvg(url) { try { var q = qrcode(0, 'M'); q.addData(url); q.make(); return q.createSvgTag({ cellSize: 4, margin: 2, scalable: true }); } catch (e) { return ''; } } function el(tag, cls, html) { var d = document.createElement(tag); if (cls) d.className = cls; if (html != null) d.innerHTML = html; return d; } function card(d, url, shortUrl) { var hs = el('div', 'hs'); hs.appendChild(el('div', 'lines')); var inner = el('div', 'in'); var logo = el('img', 'logo'); logo.src = '/logo.png'; logo.alt = 'InstantAdPay'; inner.appendChild(logo); inner.appendChild(el('span', 'tag', d.tag)); inner.appendChild(el('h2', null, d.h)); inner.appendChild(el('p', 'lead', d.lead)); var ul = el('ul'); d.bullets.forEach(function (b) { ul.appendChild(el('li', null, b)); }); inner.appendChild(ul); inner.appendChild(el('div', 'foot', 'Scan the code or visit ' + shortUrl + '')); hs.appendChild(inner); var ov = el('div', 'hs-qrov'); ov.appendChild(el('div', 'q', url ? qrSvg(url) : '
')); ov.appendChild(el('div', 'scan', 'SCAN ME')); ov.appendChild(el('div', 'lnk', shortUrl)); hs.appendChild(ov); hs.appendChild(el('div', 'hs-disc', 'Advertising, not investing. No income is guaranteed; results depend on your effort. Crypto carries risk of loss.')); return hs; } function build(ref) { var wrap = $('halfsheets'); wrap.innerHTML = ''; DESIGNS.forEach(function (d) { var url = ref ? ORIGIN + '/join/' + ref + '?v=' + d.angle : ''; var shortUrl = ref ? 'instantadpay.com/join/' + ref : 'instantadpay.com'; var page = el('div', 'hs-page'); var pr = el('button', 'btn small hs-print', 'Print this one'); pr.type = 'button'; pr.addEventListener('click', function () { document.body.classList.add('print-one'); page.classList.add('printing'); window.print(); setTimeout(function () { document.body.classList.remove('print-one'); page.classList.remove('printing'); }, 400); }); page.appendChild(pr); page.appendChild(card(d, url, shortUrl)); page.appendChild(el('div', 'hs-cut', '✂ cut here')); var copy = card(d, url, shortUrl); copy.classList.add('hs-copy'); page.appendChild(copy); wrap.appendChild(page); }); } var input = $('flRef'); var ref = getRef(); if (ref) input.value = ref; build(ref); input.addEventListener('input', function () { var v = input.value.trim(); if (!v || /^[A-Za-z0-9_]{1,20}$/.test(v)) { build(v); try { if (v) localStorage.setItem('iap.ref', v); } catch (e) {} } }); if (!ref) { // signed-in member without a stored ref: ask the site fetch('/api/me').then(function (r) { return r.json(); }).then(function (me) { var t = me && me.signedIn && (me.username || me.refCode || me.memberId); if (t && !input.value) { input.value = String(t); build(String(t)); } }).catch(function () {}); } })();