// Promote page renderer (2026-11-14). Draws a promo kit (GET /api/promo-kit) into a container: links, creatives grouped by angle, // swipe lines, headlines, an email and social posts, each with a copy button. Same file on Downline Banners, Viral Banner Blitz and ViralAdBlitz; // the page script decides the username and the look comes from the site's own CSS (.card, .btn, .kit-*). window.KitPage = (function () { const esc = s => String(s == null ? '' : s).replace(/[&<>"']/g, c => ({ '&': '&', '<': '<', '>': '>', '"': '"', "'": ''' }[c])); async function copy(text, btn) { try { await navigator.clipboard.writeText(text); } catch (e) { const t = document.createElement('textarea'); t.value = text; document.body.appendChild(t); t.select(); try { document.execCommand('copy'); } catch (e2) {} t.remove(); } if (btn) { const o = btn.textContent; btn.textContent = 'Copied'; setTimeout(() => { btn.textContent = o; }, 1400); } } const TXT = []; const cb = (text, label, cls) => { TXT.push(text); return ''; }; // on the kit's own site, show creatives from this origin (same files; the copied URL stays absolute) function local(url, k) { try { const u = new URL(url); return u.hostname === k.site && location.hostname !== k.site ? u.pathname : url; } catch (e) { return url; } } const row = (label, url, cls) => '
' + esc(url) + 'Every link, creative and line below carries ' + esc(k.username) + '.
' : 'Add your network username above so these links carry it.
') + k.links.map(l => row(l.label, l.url, '') + (l.tracked ? row(l.label + ', tracked', l.tracked, 'sec') : '')).join('') + (k.links.some(l => l.tracked) ? 'A tracked link goes through LinkSpin first, so the network can see which site sent the visit, then opens the same page with your username. Use either one.
' : '') + 'Download them, or copy the HTML: it already links to you.
For chats, comments, text ads and signatures.
' + k.lines.map(t => '' + esc(t) + '
' + cb(t) + '' + esc(t) + '
' + cb(t) + 'Subject' + esc(k.email.subject) + '
' + cb(k.email.subject, 'Copy subject') + '' + esc(k.email.body) + '
' + esc(t) + '
' + esc(k.note) + '
'; root.innerHTML = h; root.querySelectorAll('[data-kc]').forEach(b => b.addEventListener('click', () => copy(TXT[Number(b.dataset.kc)], b))); root.querySelectorAll('[data-ka]').forEach(b => b.addEventListener('click', () => { root.querySelectorAll('[data-ka]').forEach(x => x.classList.toggle('on', x === b)); root.querySelectorAll('[data-ks]').forEach(s => { s.hidden = s.dataset.ks !== b.dataset.ka; }); })); } async function load(root, u) { const r = await fetch('/api/promo-kit' + (u ? '?u=' + encodeURIComponent(u) : ''), { cache: 'no-store' }); const k = await r.json(); render(root, k); return k; } return { render, load, copy }; })();