AI ad writer on LinkSpin (Marty 2026-11-17: "do it on the other sites too"): "Write my ad from my link" on the Ads screen text ads (60/140) and "Write my headline from my link" in the page builder (headline 90 + subhead 200), both asking the network hub (hubadwriter.js, POST /v1/adwriter) through GET/POST /api/my/adwriter; shown only when the hub says on; chatbot fact, KNOWLEDGE_DATE 2026-11-17; ads-screen.js/pages-screen.js ?v=20261117aiw. Plus the PolHunter embed on the home page (3 tiles) with polhunter.com in script-src and connect-src (punch list L2)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
// viewer, member zones and the partner network, and earn credits by viewing. Types are limited to the three Marty chose.
|
||||
(function () {
|
||||
const $ = id => document.getElementById(id); const esc = CR.esc, fmt = CR.fmt, api = CR.api, toast = CR.toast, dialog = CR.dialog;
|
||||
let D = null, EARN = null, TYPE = 'banner', SPINS = [], HOSTS = [], IMG = '';
|
||||
let D = null, EARN = null, TYPE = 'banner', SPINS = [], HOSTS = [], IMG = '', AIW = false;
|
||||
CR.mount({ active: 'ads', title: 'Ads', sub: 'loading', actions: '<button class="btn pri" type="button" id="newBtn">+ New ad</button>' });
|
||||
const NOTE = {
|
||||
banner: 'Runs in the ad viewer, in every member zone on outside sites, and on the partner network. Views are timed on the server. Spends purchased or earned credits.',
|
||||
@@ -148,7 +148,7 @@
|
||||
window.addEventListener('storage', e => { if (e.key === 'iap-view-done') earnRefresh(); });
|
||||
$('earnClaim').addEventListener('click', async () => { try { const r = await api('/api/my/claim', {}); toast('+' + r.credited + ' credits' + (r.streakDay > 1 ? ', streak day ' + r.streakDay : '') + '. Spend them on an ad.'); load(); } catch (e) { toast(e.message, true); } });
|
||||
// -- composer
|
||||
function setType(t) { TYPE = t; document.querySelectorAll('#typeChips .chip').forEach(c => c.classList.toggle('on', c.dataset.t === t)); $('typeNote').textContent = t === 'login' ? loginNote() : NOTE[t]; $('bannerFields').hidden = t !== 'banner'; $('textFields').hidden = t !== 'text'; $('fCap').parentElement.hidden = t === 'login';
|
||||
function setType(t) { TYPE = t; document.querySelectorAll('#typeChips .chip').forEach(c => c.classList.toggle('on', c.dataset.t === t)); $('typeNote').textContent = t === 'login' ? loginNote() : NOTE[t]; $('bannerFields').hidden = t !== 'banner'; $('textFields').hidden = t !== 'text'; $('aiRow').hidden = t !== 'text' || !AIW; $('fCap').parentElement.hidden = t === 'login';
|
||||
const L = slotInfo(), full = t === 'login' && !L.free; const fb = $('fBudget');
|
||||
if (t === 'login') { fb.dataset.keep = fb.dataset.keep || fb.value; fb.value = L.credits; fb.readOnly = true; } else { if (fb.readOnly && fb.dataset.keep) fb.value = fb.dataset.keep; delete fb.dataset.keep; fb.readOnly = false; }
|
||||
$('fGo').disabled = false; $('fGo').textContent = full ? 'Reserve the next slot' : 'Launch'; $('fGo').title = full ? 'All login-ad slots are taken: pay now for a place in line' : '';
|
||||
@@ -185,6 +185,23 @@
|
||||
setType(TYPE);
|
||||
});
|
||||
$('fCancel').addEventListener('click', () => { $('composer').hidden = true; });
|
||||
// the AI ad writer (Marty 2026-11-17): 3 text ads the network hub writes only from the member's own page; picking one fills the
|
||||
// headline and line to edit. Shown only when the hub answers it is on.
|
||||
CR.get('/api/my/adwriter').then(w => { AIW = !!(w && w.on); if (!$('composer').hidden) setType(TYPE); }).catch(() => { AIW = false; });
|
||||
{ let opts = [];
|
||||
$('aiWrite').addEventListener('click', async () => {
|
||||
const box = $('aiList'), url = $('fTarget').value.trim(); box.hidden = false;
|
||||
if (!/^https?:\/\/\S+\.\S+/i.test(url)) { box.innerHTML = '<span class="muted">Put your link in Where the click goes first (starting with https://), or pick a spin link, then tap the button again.</span>'; $('fTarget').focus(); return; }
|
||||
$('aiWrite').disabled = true; box.innerHTML = '<span class="muted">Reading your page and writing 3 ads. This takes a few seconds...</span>';
|
||||
let r; try { r = await api('/api/my/adwriter', { url, kind: 'text' }); } catch (e) { r = { error: e.message || 'The ad writer did not answer. Try again in a minute.' }; }
|
||||
$('aiWrite').disabled = false;
|
||||
if (r.error) { box.innerHTML = '<span class="bad">' + esc(r.error) + '</span>'; return; }
|
||||
opts = r.options || [];
|
||||
box.innerHTML = '<div class="muted" style="font-size:12px;margin-bottom:6px">Tap one to use it. Check every word is true for your offer before you launch.' + (typeof r.left === 'number' ? ' Ad writes left today: ' + r.left + '.' : '') + '</div>'
|
||||
+ opts.map((o, i) => '<button type="button" class="btn ghost" data-ai="' + i + '" style="display:block;width:100%;text-align:left;margin:0 0 6px;white-space:normal;height:auto"><b>' + esc(o.headline) + '</b><br><span class="ink2">' + esc(o.line || '') + '</span></button>').join('');
|
||||
box.querySelectorAll('button[data-ai]').forEach(b => b.addEventListener('click', () => { const o = opts[Number(b.dataset.ai)]; $('fTitle').value = o.headline; $('fBody').value = o.line || ''; box.hidden = true; preview(); toast('Filled in. Edit it as you like, then tap Launch.'); }));
|
||||
});
|
||||
}
|
||||
$('fGo').addEventListener('click', async () => {
|
||||
const body = { type: TYPE, name: $('fName').value, targetUrl: $('fTarget').value.trim(), budget: Number($('fBudget').value), geo: $('fGeo').value };
|
||||
if (TYPE !== 'login' && $('fCap').value) body.dailyCap = Number($('fCap').value);
|
||||
|
||||
Reference in New Issue
Block a user