diff --git a/public/assets/promo.js b/public/assets/promo.js index f02744a..eb91fff 100644 --- a/public/assets/promo.js +++ b/public/assets/promo.js @@ -203,21 +203,13 @@ window.IAPPromo = (function () { if (vp && token && vp.dataset.filled !== token) { vp.dataset.filled = token; const origin = 'https://instantadpay.com', enc = encodeURIComponent; - const build = raw => { - let s = String(raw || '').trim(); if (!s) return ''; - if (!/^https?:\/\//i.test(s)) s = origin + (s.charAt(0) === '/' ? '' : '/') + s; - let x; try { x = new URL(s); } catch (e) { return ''; } - if (!/(^|\.)instantadpay\.com$/i.test(x.hostname) || /^\/(join|from|api|admin)(\/|$)/.test(x.pathname)) return ''; - x.searchParams.delete('ref'); x.searchParams.set('ref', token); - return origin + x.pathname + x.search; - }; + const build = path => { if (!path) return ''; let x; try { x = new URL(origin + path); } catch (e) { return ''; } x.searchParams.set('ref', token); return origin + x.pathname + x.search; }; const render = () => { - const typed = $('viralUrl').value.trim(); - const l = build(typed || vp.value); - $('viralLink').textContent = l || (typed ? 'That is not a page on instantadpay.com.' : '…'); + const l = build(vp.value); + $('viralLink').textContent = l || '…'; const sh = $('viralShare'); sh.innerHTML = ''; if (!l) return; - const title = (!typed && vp.selectedOptions[0]) ? vp.selectedOptions[0].textContent.replace(/^Article: /, '') : 'InstantAdPay'; + const title = vp.selectedOptions[0] ? vp.selectedOptions[0].textContent.replace(/^Article: /, '') : 'InstantAdPay'; [linkBtn('https://x.com/intent/tweet?url=' + enc(l) + '&text=' + enc(title), 'X'), linkBtn('https://www.facebook.com/sharer/sharer.php?u=' + enc(l), 'Facebook'), linkBtn('https://t.me/share/url?url=' + enc(l) + '&text=' + enc(title), 'Telegram'), @@ -227,8 +219,7 @@ window.IAPPromo = (function () { if (navigator.share) { const b = document.createElement('button'); b.className = 'btn small sec'; b.type = 'button'; b.textContent = 'Share'; b.onclick = async () => { try { await navigator.share({ title, url: l }); } catch (e) {} }; sh.appendChild(b); } }; fetch('/api/pages').then(r => r.json()).then(r => { vp.innerHTML = (r.pages || []).map(pg => '').join(''); render(); }).catch(() => { vp.innerHTML = ''; render(); }); - vp.onchange = () => { $('viralUrl').value = ''; render(); }; - $('viralUrl').oninput = render; + vp.onchange = render; $('viralCopy').onclick = async () => { const l = $('viralLink').textContent; if (!/^https:/.test(l)) return; try { await navigator.clipboard.writeText(l); status('Link copied.', 'ok'); } catch (e) { status('Copy failed.', 'bad'); } }; } // objections diff --git a/public/my.html b/public/my.html index 8ac0393..2aeb701 100644 --- a/public/my.html +++ b/public/my.html @@ -748,11 +748,8 @@ - +