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:
martbost
2026-11-17 08:43:47 -06:00
parent 5613d10224
commit ae39e05fc5
9 changed files with 165 additions and 6 deletions
+2 -1
View File
@@ -60,6 +60,7 @@
<label class="lbl">Headline (60)<input class="field" id="fTitle" maxlength="60"></label>
<label class="lbl">One line (140)<input class="field" id="fBody" maxlength="140"></label>
</div>
<div id="aiRow" hidden style="margin-top:10px"><button class="btn sm" type="button" id="aiWrite">Write my ad from my link</button> <span class="muted" style="font-size:12px">Put your link in Where the click goes first. We read that page and suggest 3 text ads using only what it says. Nothing launches until you tap Launch.</span><div id="aiList" hidden style="margin-top:8px"></div></div>
<div id="prev" style="margin-top:12px"></div>
<div style="display:flex;gap:10px;flex-wrap:wrap;margin-top:14px;align-items:center"><button class="btn pri" type="button" id="fGo">Launch</button><button class="btn ghost" type="button" id="fCancel">Cancel</button><span class="led" id="fCost"></span></div>
</div>
@@ -76,7 +77,7 @@
</div>
</div>
<script src="/assets/cr-shell.js?v=20261115hub"></script>
<script src="/assets/ads-screen.js?v=20261114tu"></script>
<script src="/assets/ads-screen.js?v=20261117aiw"></script>
<script src="/assets/fuel.js?v=20261113sso"></script>
<script src="/assets/engine-room.js?v=20261113sso"></script>
</body>
+19 -2
View File
@@ -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);
+26
View File
@@ -88,6 +88,7 @@
// pasted provider forms: say at paste time which autoresponder the form posts to
+ (k === 'formEmbed' ? '<div class="muted" id="providerNote" style="font-size:12px" hidden></div>' : '')).join('');
if ($('imgUpload')) { $('imgUpload').addEventListener('click', () => $('imgFile').click()); $('imgFile').addEventListener('change', () => { uploadFile($('imgFile').files[0]); $('imgFile').value = ''; }); drawImages(); }
aiHeadline(p);
if ($('f-formEmbed')) { const fe = $('f-formEmbed'); const upd = () => providerNote(fe.value); fe.addEventListener('input', upd); fe.addEventListener('paste', () => setTimeout(upd, 0)); upd(); }
// the Look panel: niche preset, design, colours, layout. Each change saves at once and the gallery/preview refresh.
const d = p.design || {}; const setLook = async patch => { try { await api('/api/my/pages/' + p.id, patch); load(true); } catch (e) { toast(e.message, true); } };
@@ -101,6 +102,31 @@
$('layouts').querySelectorAll('button').forEach(b => b.addEventListener('click', () => setLook({ layout: b.dataset.l })));
if (!quiet && window.matchMedia('(max-width:900px)').matches) $('side').scrollIntoView({ behavior: 'smooth' });
}
// the AI ad writer on the headline (Marty 2026-11-17): the network hub reads the button link (or the scanned page) and suggests
// 3 headline + subhead pairs written only from it; picking one fills both fields to edit. Saved only with Save.
let AIW = null;
async function aiHeadline(p) {
const sub = $('f-sub'); if (!sub) return;
if (AIW === null) { try { const w = await CR.get('/api/my/adwriter'); AIW = !!(w && w.on); } catch (e) { AIW = false; } }
if (!AIW || !$('f-sub') || $('aiHead')) return;
const wrap = document.createElement('div'); wrap.id = 'aiHead'; wrap.style.margin = '0 0 10px';
wrap.innerHTML = '<button class="btn sm" type="button" id="aiHeadBtn">Write my headline from my link</button> <span class="muted" style="font-size:11px">Reads the Button link page and suggests 3 headlines with a subhead, using only what that page says.</span><div id="aiHeadList" hidden style="margin-top:8px"></div>';
$('f-sub').closest('label').after(wrap);
let opts = [];
$('aiHeadBtn').addEventListener('click', async () => {
const box = $('aiHeadList'); box.hidden = false;
const url = (($('f-ctaUrl') && $('f-ctaUrl').value) || (p.scan && p.scan.url) || '').trim();
if (!/^https?:\/\/\S+\.\S+/i.test(url)) { box.innerHTML = '<span class="muted">Put the offer link in the Button link field first (starting with https://), then tap the button again.</span>'; return; }
$('aiHeadBtn').disabled = true; box.innerHTML = '<span class="muted">Reading the page and writing 3 headlines. This takes a few seconds...</span>';
let r; try { r = await api('/api/my/adwriter', { url, kind: 'page' }); } catch (e) { r = { error: e.message || 'The ad writer did not answer. Try again in a minute.' }; }
$('aiHeadBtn').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:11px;margin-bottom:6px">Tap one to use it, then Save. Check every word is true for your offer.' + (typeof r.left === 'number' ? ' 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="muted">' + esc(o.line || '') + '</span></button>').join('');
box.querySelectorAll('button[data-ai]').forEach(b => b.addEventListener('click', () => { const o = opts[Number(b.dataset.ai)]; $('f-headline').value = o.headline; if ($('f-sub')) $('f-sub').value = o.line || ''; box.hidden = true; toast('Filled in. Edit it as you like, then tap Save.'); }));
});
}
function collect(p) { const g = k => { const el = $('f-' + k); return el ? el.value : undefined; }; const c = {}; for (const [k] of F[p.type]) { if (k === 'ctaText' || k === 'ctaUrl') continue; c[k] = g(k); } c.cta = { text: g('ctaText'), url: g('ctaUrl') }; for (const k of ['bullets', 'pros', 'cons']) if (c[k] != null) c[k] = c[k].split('\n'); return c; }
$('edSave').addEventListener('click', async () => { const p = PAGES.find(x => x.id === SEL); if (!p) return; try { await api('/api/my/pages/' + p.id, { content: collect(p), title: ($('f-headline').value || p.title).slice(0, 100) }); toast('Saved'); load(true); } catch (e) { toast(e.message, true); } });
$('edPublish').addEventListener('click', async () => { const p = PAGES.find(x => x.id === SEL); if (!p) return; try { await api('/api/my/pages/' + p.id, { content: collect(p) }); const r = await api('/api/my/pages/' + p.id, { status: p.status === 'published' ? 'draft' : 'published' }); toast(r.page.status === 'published' ? 'Live at ' + pageUrl(r.page) : 'Unpublished'); load(true); } catch (e) { toast(e.message, true); } });
+1
View File
@@ -226,5 +226,6 @@
<script src="/assets/home.js?v=20261113me"></script>
<script src="/assets/netline.js?v=20261117nw" data-site="linkspin"></script>
<script src="https://polhunter.com/embed.js" data-slots="3" data-selector="article.tile.card" async></script>
</body>
</html>
+1 -1
View File
@@ -74,6 +74,6 @@
</div>
</div>
<script src="/assets/cr-shell.js?v=20261115hub"></script>
<script src="/assets/pages-screen.js?v=20261021t"></script>
<script src="/assets/pages-screen.js?v=20261117aiw"></script>
</body>
</html>