Page designer on the Branded Voice design system: palette x design (dark/light/editorial/ignition) x layout (stacked/split hero) + six niche presets with house hero images, procedural split visual with price chip, Look panel in the editor; ad zones + banner campaigns gain 336x280, 250x250, 125x125, 120x600 with house banners

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
martbost
2026-10-07 16:40:21 -05:00
parent 75d95d84d6
commit a6bfa1ba42
12 changed files with 254 additions and 49 deletions
BIN
View File
Binary file not shown.
+76 -37
View File
@@ -1,55 +1,94 @@
// LinkSpin page renderer (2026-09-29): bridge, review and squeeze pages as standalone HTML. Everything the member
// typed is escaped; the only form on a page is either our own capture form or a provider form rebuilt by
// LinkSpin page renderer (2026-09-29, restyled 2026-10-07 on the Branded Voice design system: palette x design x
// layout + niche presets, see pagestyle.js). Bridge, review and squeeze pages as standalone HTML. Everything the
// member typed is escaped; the only form on a page is either our own capture form or a provider form rebuilt by
// formrestyle (parse-or-refuse). No inline script: tracking lives in /assets/pt.js so the page can carry a real CSP.
'use strict';
const formrestyle = require('./formrestyle');
const esc = s => String(s == null ? '' : s).replace(/[&<>"]/g, c => ({ '&': '&amp;', '<': '&lt;', '>': '&gt;', '"': '&quot;' }[c]));
const S = require('./pagestyle');
const esc = S.esc;
const href = u => { const s = String(u || '').trim(); return /^https?:\/\/[^\s"'<>]+$/i.test(s) && s.length <= 700 ? s : ''; };
const PALETTES = {
graphite: { bg: '#0F1422', panel: '#161D31', ink: '#EEF2F8', muted: '#A7B4CB', line: '#27314A', accent: '#3B9DFF', accentInk: '#061225', font: "'Segoe UI',system-ui,-apple-system,Roboto,sans-serif", display: "Georgia,'Times New Roman',serif" },
ink: { bg: '#F6F4EE', panel: '#FFFFFF', ink: '#17191C', muted: '#5F6670', line: '#D9D4C7', accent: '#B8410E', accentInk: '#FFFFFF', font: "'Segoe UI',system-ui,-apple-system,Roboto,sans-serif", display: "Georgia,'Times New Roman',serif" },
ember: { bg: '#1A1210', panel: '#241A16', ink: '#F7EFE9', muted: '#C9B8AE', line: '#3A2B25', accent: '#FF8A3D', accentInk: '#1A0E08', font: "'Segoe UI',system-ui,-apple-system,Roboto,sans-serif", display: "Georgia,'Times New Roman',serif" },
};
const PALETTE_NAMES = Object.keys(PALETTES);
function css(P) {
return '*{box-sizing:border-box}body{margin:0;background:' + P.bg + ';color:' + P.ink + ';font-family:' + P.font + ';font-size:17px;line-height:1.55}a{color:' + P.accent + '}'
+ '.wrap{max-width:720px;margin:0 auto;padding:28px 18px 60px}.panel{background:' + P.panel + ';border:1px solid ' + P.line + ';border-radius:12px;padding:22px}'
+ 'h1{font-family:' + P.display + ';font-size:clamp(30px,5.6vw,44px);line-height:1.08;margin:0 0 12px;text-wrap:balance}h2{font-family:' + P.display + ';font-size:24px;margin:26px 0 8px}h3{font-size:18px;margin:18px 0 6px}'
+ '.sub{font-size:19px;color:' + P.muted + ';margin:0 0 18px}.eyebrow{font-size:12px;letter-spacing:.14em;text-transform:uppercase;font-weight:700;color:' + P.accent + ';margin-bottom:10px}'
+ 'ul.checks{list-style:none;padding:0;margin:14px 0;display:grid;gap:8px}ul.checks li{padding-left:28px;position:relative}ul.checks li::before{content:"";position:absolute;left:0;top:8px;width:16px;height:16px;border-radius:50%;background:' + P.accent + '}ul.checks li::after{content:"";position:absolute;left:5px;top:11px;width:6px;height:9px;border:solid ' + P.accentInk + ';border-width:0 2px 2px 0;transform:rotate(45deg)}'
+ '.cta{display:inline-block;background:' + P.accent + ';color:' + P.accentInk + ';font-weight:800;font-size:18px;text-decoration:none;padding:15px 26px;border-radius:10px;border:0;cursor:pointer;font-family:inherit}.cta:hover{filter:brightness(1.08)}.ctawrap{margin:18px 0;text-align:center}'
+ '.lsform{display:grid;gap:10px}.lsin{width:100%;padding:14px 16px;font:16px/1.4 inherit;border:1.5px solid ' + P.line + ';border-radius:10px;background:' + P.bg + ';color:' + P.ink + '}.lsin:focus{border-color:' + P.accent + ';outline:none}'
+ '.privacy{font-size:12.5px;color:' + P.muted + ';margin:10px 0 0;text-align:center}.hero img{width:100%;height:auto;border-radius:12px;margin:0 0 18px}'
+ '.pc{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:14px}.pc div{background:' + P.bg + ';border:1px solid ' + P.line + ';border-radius:10px;padding:14px}.pc h3{margin:0 0 8px}.pc ul{margin:0;padding-left:18px}@media(max-width:560px){.pc{grid-template-columns:1fr}}'
+ '.rating{font-size:22px;letter-spacing:2px;color:' + P.accent + '}.verdict{border-left:4px solid ' + P.accent + ';padding:10px 14px;margin:16px 0;background:' + P.bg + ';border-radius:0 10px 10px 0}'
+ '.foot{margin-top:34px;font-size:12.5px;color:' + P.muted + ';text-align:center}.foot a{color:' + P.muted + '}p{margin:0 0 14px}';
const PALETTE_NAMES = Object.keys(S.PALETTES).concat(['ink', 'ember']);
// the three knobs a page carries, with safe fallbacks for anything stored by older code
function knobs(page) { const d = page.design || {}; return { pk: S.paletteKey(d.palette), design: S.designKey(d.design), layout: S.layoutKey(d.layout), niche: S.nicheKey(d.niche) }; }
function baseCss(k) {
const P = S.PALETTES[k.pk], C = P.c, dkGround = k.design === 'dark' || k.design === 'ignition';
const ground = k.design === 'editorial' ? C.cream : k.design === 'ignition' ? '#060606' : k.design === 'light' ? '#fff' : C.inkGreen;
const bodyInk = k.design === 'editorial' ? C.body : k.design === 'ignition' ? S.rgba(C.cream, 0.85) : k.design === 'light' ? C.body : S.rgba(C.cream, 0.82);
const font = k.design === 'editorial' ? '18px/1.7 ' + S.SERIF : '17px/1.6 ' + S.FONT;
const heroSkin = k.design === 'light' ? 'background:radial-gradient(ellipse 800px 480px at 85% 0%,' + S.rgba(C.gold, 0.1) + ',transparent 60%),radial-gradient(ellipse 700px 500px at 0% 100%,' + S.rgba(C.green, 0.08) + ',transparent 60%),#fff;color:' + C.ink
: k.design === 'editorial' ? 'background:' + C.cream + ';color:' + C.ink + ';border-bottom:2px solid ' + C.ink
: k.design === 'ignition' ? 'background:transparent;color:' + C.cream
: 'background:radial-gradient(ellipse 900px 500px at 70% -10%,' + S.rgba(C.gold, 0.16) + ',transparent 60%),radial-gradient(ellipse 700px 480px at 12% 8%,' + S.rgba(C.green, 0.35) + ',transparent 65%),' + C.inkGreen + ';color:' + C.cream;
const heroInk = dkGround ? C.cream : C.ink, heroBody = dkGround ? S.rgba(C.cream, 0.72) : C.body;
const h1font = k.design === 'ignition' ? 'font-family:' + S.IGNITION_DISPLAY + ';font-weight:400;text-transform:uppercase;letter-spacing:.5px;line-height:.98;font-size:clamp(40px,7vw,72px)' : k.design === 'editorial' ? 'font-family:' + S.SERIF + ';font-weight:700;font-size:clamp(34px,5.6vw,54px);line-height:1.08;letter-spacing:-.01em' : 'font-weight:800;font-size:clamp(32px,5.6vw,52px);line-height:1.08;letter-spacing:-.028em';
return '*{box-sizing:border-box}body{margin:0;background:' + ground + ';color:' + bodyInk + ';font:' + font + ';-webkit-font-smoothing:antialiased}a{color:' + (dkGround ? C.goldSoft : C.green) + '}p{margin:0 0 16px}'
+ '.hero,main,.foot,.wrap{position:relative;z-index:1}'
+ '.hero{' + heroSkin + ';padding:72px 24px 64px;text-align:center;overflow:hidden}.hero>*{position:relative;z-index:1}'
+ '.hero h1{' + h1font + ';margin:0 auto 18px;max-width:840px;color:' + heroInk + ';text-wrap:balance}.hero .lead{font-size:19px;line-height:1.6;color:' + heroBody + ';max-width:660px;margin:0 auto 8px}.hero .media{max-width:760px;margin:34px auto 0}.hero .ctawrap{margin:28px 0 0}'
+ '.hs-grid{display:grid;grid-template-columns:1.1fr .9fr;gap:56px;align-items:center;max-width:1080px;margin:0 auto;text-align:left}.hero.split{text-align:left;padding:72px 32px 64px}.hero.split h1{margin:0 0 18px;text-align:left;max-width:none}.hero.split .lead{margin:0 0 8px;max-width:none}.hero.split .media{margin:0}'
+ 'main{max-width:680px;margin:0 auto;padding:56px 24px 64px}main h2{font-size:' + (k.design === 'editorial' ? '28px;font-family:' + S.SERIF : '24px') + ';margin:28px 0 10px;color:' + (dkGround ? C.cream : C.ink) + '}main h3{font-size:18px;margin:18px 0 6px;color:' + (dkGround ? C.cream : C.ink) + '}'
+ (k.design === 'editorial' ? 'main p:first-of-type::first-letter{float:left;font-size:58px;line-height:.9;padding:6px 10px 0 0;color:' + C.gold + ';font-weight:700}' : '')
// squeeze card
+ '.wrap{min-height:100vh;display:flex;flex-direction:column;align-items:center;justify-content:center;padding:32px 20px 0}'
+ '.card{background:' + (k.design === 'ignition' ? 'rgba(8,8,8,.55)' : '#fff') + ';max-width:560px;width:100%;border-radius:12px;border-top:4px solid ' + C.gold + ';padding:44px 40px 40px;text-align:center;box-shadow:0 24px 80px rgba(0,0,0,' + (dkGround ? '.45' : '.12') + ');color:' + (k.design === 'ignition' ? S.rgba(C.cream, 0.85) : C.body) + (k.design === 'ignition' ? ';border:1px solid ' + S.rgba(S.hotRamp(k.pk).hot1, 0.3) + ';border-top:4px solid ' + S.hotRamp(k.pk).hot1 + ';backdrop-filter:blur(6px)' : '') + '}'
+ '.card h1{' + h1font.replace(/clamp\([^)]*\)/, 'clamp(28px,5.5vw,38px)') + ';margin:0 0 16px;color:' + (k.design === 'ignition' ? '#fff' : C.ink) + '}.card .sub{font-size:18px;line-height:1.6;margin:0 0 24px}.card ul.checks{margin:0 auto 24px;max-width:26em}.card .hero-img{width:100%;height:auto;border-radius:12px;margin:0 0 20px}'
+ '.sq-grid{display:grid;grid-template-columns:1fr .85fr;gap:56px;align-items:center;max-width:1060px;width:100%;margin:0 auto}.sq-grid .card{max-width:none;text-align:left}.sq-grid ul.checks{max-width:none;margin:0 0 24px}'
+ '@media(max-width:820px){.hs-grid,.sq-grid{grid-template-columns:1fr;gap:36px}.hero.split{text-align:center}.hero.split h1{text-align:center}.sq-grid .card{text-align:center}.sq-grid .pv,.hs-grid .media{order:-1}}@media(max-width:480px){.card{padding:32px 20px 28px}.hero{padding:52px 18px 44px}}'
+ S.kitCss(k.design, k.pk) + S.visualCss(k.pk)
+ (dkGround ? '.pc div{background:rgba(255,255,255,.04);border-color:' + S.rgba(C.cream, 0.1) + ';color:' + S.rgba(C.cream, 0.85) + '}.verdict{background:rgba(255,255,255,.04);color:' + S.rgba(C.cream, 0.85) + '}.bonus{background:rgba(255,255,255,.04);border-color:' + S.rgba(C.cream, 0.12) + ';box-shadow:none;color:' + S.rgba(C.cream, 0.85) + '}.bonus .tag{background:' + S.rgba(C.gold, 0.16) + ';color:' + C.goldSoft + '}' : '')
+ (k.design === 'editorial' ? '.foot{color:' + C.muted + '}' : dkGround ? '.foot{color:rgba(245,241,232,.5)}' : '.foot{color:' + C.muted + '}');
}
const paras = t => String(t || '').split(/\n\s*\n/).map(x => x.trim()).filter(Boolean).map(x => '<p>' + esc(x).replace(/\n/g, '<br>') + '</p>').join('');
const bullets = arr => (arr || []).filter(Boolean).length ? '<ul class="checks">' + arr.filter(Boolean).map(b => '<li>' + esc(b) + '</li>').join('') + '</ul>' : '';
const checks = arr => (arr || []).filter(Boolean).length ? '<ul class="checks">' + arr.filter(Boolean).map(b => '<li>' + esc(b) + '</li>').join('') + '</ul>' : '';
function stars(n) { const k = Math.max(0, Math.min(5, Math.round(Number(n) || 0))); return '<div class="rating" aria-label="' + k + ' out of 5">' + '★'.repeat(k) + '☆'.repeat(5 - k) + '</div>'; }
function ctaBtn(c, cls) { const u = href(c && c.url); const t = esc(c && c.text || 'Continue'); return u ? '<div class="ctawrap"><a class="cta ' + (cls || '') + '" href="' + esc(u) + '" data-cta>' + t + '</a></div>' : ''; }
const eyebrow = t => t ? '<div class="k-eyebrow"><span class="dot"></span>' + esc(t) + '</div>' : '';
function ctaBtn(c, extra) { const u = href(c && c.url); const t = esc((c && c.text) || 'Continue'); return u ? '<div class="ctawrap">' + '<a class="cta" href="' + esc(u) + '" data-cta>' + t + '</a>' + (extra || '') + '</div>' : ''; }
const headline = (k, t) => (k.design === 'ignition' ? S.blazeHeadline(t) : esc(t || ''));
// the visual on the right of a split: the member's image, else the niche hero, else the procedural card
function sideVisual(k, c) {
const img = href(c.image) || S.nicheHero(k.niche);
if (img) return '<div class="media"><div class="k-imgframe"><img src="' + esc(img) + '" alt="' + esc(c.imageAlt || '') + '" loading="eager"></div></div>';
return '<div class="media">' + S.visualHtml(c.headline, c.bullets && c.bullets.length ? c.bullets : c.pros, c.price) + '</div>';
}
function formArea(page, opts) {
const c = page.content || {};
if (c.formEmbed) { const parsed = formrestyle.parse(c.formEmbed); if (parsed) return '<div class="formarea">' + formrestyle.html(parsed, c.cta && c.cta.text || 'Send me the details') + '</div>'; }
// our own capture: the lead lands on the member's LinkSpin list, then the visitor continues to the CTA URL
return '<div class="formarea"><form class="lsform" method="post" action="' + esc(opts.leadUrl) + '"><input class="lsin" type="text" name="name" placeholder="Your first name"><input class="lsin" type="email" name="email" placeholder="Your best email address" required><input type="text" name="website" tabindex="-1" autocomplete="off" style="position:absolute;left:-9999px" aria-hidden="true"><input type="hidden" name="lsid" value=""><button type="submit" class="cta">' + esc(c.cta && c.cta.text || 'Send me the details') + '</button></form></div>';
if (c.formEmbed) { const parsed = formrestyle.parse(c.formEmbed); if (parsed) return '<div class="formarea">' + formrestyle.html(parsed, (c.cta && c.cta.text) || 'Send me the details') + '</div>'; }
return '<div class="formarea"><form class="ls-form" method="post" action="' + esc(opts.leadUrl) + '"><input class="ls-in" type="text" name="name" placeholder="Your first name"><input class="ls-in" type="email" name="email" placeholder="Your best email" required><input type="text" name="website" tabindex="-1" autocomplete="off" style="position:absolute;left:-9999px" aria-hidden="true"><input type="hidden" name="lsid" value="">'
+ '<button class="cta" type="submit">' + esc((c.cta && c.cta.text) || 'Send me the details') + '</button></form></div>';
}
function render(page, opts) {
opts = opts || {}; const P = PALETTES[page.design && page.design.palette] || PALETTES.graphite; const c = page.content || {};
opts = opts || {}; const k = knobs(page); const c = page.content || {}; const split = k.layout === 'split';
const img = href(c.image) || S.nicheHero(k.niche);
const head = '<!doctype html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1"><title>' + esc(c.headline || page.title || 'Page') + '</title>'
+ '<meta name="description" content="' + esc((c.sub || '').slice(0, 160)) + '">' + (page.status !== 'published' ? '<meta name="robots" content="noindex,nofollow">' : '') + (c.image ? '<meta property="og:image" content="' + esc(href(c.image)) + '">' : '') + '<meta property="og:title" content="' + esc(c.headline || '') + '"><style>' + css(P) + '</style></head><body>';
+ '<meta name="description" content="' + esc((c.sub || '').slice(0, 160)) + '">' + (page.status !== 'published' ? '<meta name="robots" content="noindex,nofollow">' : '')
+ (img ? '<meta property="og:image" content="' + esc(img) + '">' : '') + '<meta property="og:title" content="' + esc(c.headline || page.title || '') + '"><meta property="og:description" content="' + esc((c.sub || '').slice(0, 200)) + '">'
+ '<style>' + baseCss(k) + '</style></head><body>';
let body = '';
const hero = c.image && href(c.image) ? '<div class="hero"><img src="' + esc(href(c.image)) + '" alt="' + esc(c.imageAlt || '') + '"></div>' : '';
if (page.type === 'squeeze') {
body = '<div class="wrap"><div class="panel">' + (c.eyebrow ? '<div class="eyebrow">' + esc(c.eyebrow) + '</div>' : '') + '<h1>' + esc(c.headline || '') + '</h1>' + (c.sub ? '<p class="sub">' + esc(c.sub) + '</p>' : '') + hero + bullets(c.bullets) + formArea(page, opts) + '<p class="privacy">' + esc(c.privacy || 'No spam, ever. Unsubscribe with one click.') + '</p></div>';
} else if (page.type === 'review') {
body = '<div class="wrap">' + (c.eyebrow ? '<div class="eyebrow">' + esc(c.eyebrow) + '</div>' : '<div class="eyebrow">Review</div>') + '<h1>' + esc(c.headline || '') + '</h1>' + (c.rating ? stars(c.rating) : '') + (c.sub ? '<p class="sub">' + esc(c.sub) + '</p>' : '') + hero + paras(c.body)
+ ((c.pros && c.pros.length) || (c.cons && c.cons.length) ? '<div class="pc"><div><h3>What works</h3><ul>' + (c.pros || []).filter(Boolean).map(x => '<li>' + esc(x) + '</li>').join('') + '</ul></div><div><h3>What to know</h3><ul>' + (c.cons || []).filter(Boolean).map(x => '<li>' + esc(x) + '</li>').join('') + '</ul></div></div>' : '')
+ (c.verdict ? '<div class="verdict"><b>Verdict.</b> ' + esc(c.verdict) + '</div>' : '') + ctaBtn(c.cta) + '</div>';
} else { // bridge
body = '<div class="wrap">' + (c.eyebrow ? '<div class="eyebrow">' + esc(c.eyebrow) + '</div>' : '') + '<h1>' + esc(c.headline || '') + '</h1>' + (c.sub ? '<p class="sub">' + esc(c.sub) + '</p>' : '') + hero + paras(c.body) + bullets(c.bullets) + ctaBtn(c.cta) + (c.bonus ? '<div class="panel"><h2 style="margin-top:0">' + esc(c.bonusTitle || 'Bonus when you join through this page') + '</h2>' + paras(c.bonus) + '</div>' : '') + ctaBtn(c.cta) + '</div>';
const card = '<main class="card">' + eyebrow(c.eyebrow || 'Free · Instant access') + '<h1>' + headline(k, c.headline) + '</h1>' + (c.sub ? '<p class="sub">' + esc(c.sub) + '</p>' : '')
+ (!split && img ? '<img class="hero-img" src="' + esc(img) + '" alt="' + esc(c.imageAlt || '') + '">' : '') + checks(c.bullets) + formArea(page, opts)
+ (c.privacy ? '<p class="privacy">' + esc(c.privacy) + '</p>' : '<p class="privacy">No spam. Unsubscribe any time.</p>') + '</main>';
body = '<div class="wrap">' + (split ? '<div class="sq-grid reveal">' + card + sideVisual(k, c) + '</div>' : card.replace('<main class="card">', '<main class="card reveal">')) + '</div>';
} else {
const isReview = page.type === 'review';
const heroCopy = eyebrow(c.eyebrow || (isReview ? 'Review' : '')) + '<h1>' + headline(k, c.headline) + '</h1>' + (isReview && c.rating ? stars(c.rating) : '') + (c.sub ? '<p class="lead">' + esc(c.sub) + '</p>' : '') + ctaBtn(c.cta);
const media = img ? '<div class="media"><div class="k-imgframe"><img src="' + esc(img) + '" alt="' + esc(c.imageAlt || '') + '"></div></div>' : (split ? sideVisual(k, c) : '');
const hero = split ? '<header class="hero split reveal"><div class="hs-grid"><div>' + heroCopy + '</div>' + media + '</div></header>' : '<header class="hero reveal">' + heroCopy + media + '</header>';
let main = paras(c.body);
if (isReview) {
main += ((c.pros && c.pros.length) || (c.cons && c.cons.length) ? '<div class="pc"><div><h3>What works</h3><ul>' + (c.pros || []).filter(Boolean).map(x => '<li>' + esc(x) + '</li>').join('') + '</ul></div><div><h3>What to know</h3><ul>' + (c.cons || []).filter(Boolean).map(x => '<li>' + esc(x) + '</li>').join('') + '</ul></div></div>' : '')
+ (c.verdict ? '<div class="verdict"><b>Verdict.</b> ' + esc(c.verdict) + '</div>' : '');
} else {
main += checks(c.bullets) + (c.bonus ? '<div class="bonus"><div class="tag">' + esc(c.bonusTitle || 'Bonus when you join through this page') + '</div><div class="in">' + paras(c.bonus) + '</div></div>' : '');
}
main += ctaBtn(c.cta);
body = hero + '<main>' + main + '</main>';
}
const foot = '<div class="foot">' + esc(c.disclaimer || 'Results depend on effort. Nothing here is a promise of income.') + (opts.footerLink ? ' · <a href="' + esc(opts.footerLink) + '">' + esc(opts.footerText || 'Made with LinkSpin') + '</a>' : '') + '</div>';
return head + body + foot + '<script src="' + esc(opts.trackSrc || '/assets/pt.js') + '" data-page="' + esc(page.slug) + '" defer></script></body></html>';
}
module.exports = { render, PALETTE_NAMES };
module.exports = { render, PALETTE_NAMES, knobs, catalog: S.catalog };
+12 -2
View File
@@ -10,6 +10,7 @@ const http = require('http');
const dns = require('dns').promises;
const net = require('net');
const render = require('./pagerender');
const style = require('./pagestyle');
const formrestyle = require('./formrestyle');
let DATA_DIR = null, ownHosts = () => [], keyFn = () => '';
@@ -39,18 +40,27 @@ function sanitizeContent(c, type) {
out.cta = { text: String(c.cta && c.cta.text || '').slice(0, 60), url: cleanUrl(c.cta && c.cta.url) };
out.image = cleanUrl(c.image); out.imageAlt = String(c.imageAlt || '').slice(0, 120);
out.privacy = String(c.privacy || '').slice(0, 200); out.disclaimer = String(c.disclaimer || '').slice(0, 300);
out.price = String(c.price || '').slice(0, 24); // optional '$17' chip on the split visual
if (type === 'review') { out.rating = Math.max(0, Math.min(5, Number(c.rating) || 0)); out.pros = strs(c.pros, 6, 140); out.cons = strs(c.cons, 6, 140); out.verdict = String(c.verdict || '').slice(0, 400); }
if (type === 'bridge') { out.bonus = String(c.bonus || '').slice(0, 2000); out.bonusTitle = String(c.bonusTitle || '').slice(0, 100); }
if (type === 'squeeze') { out.formEmbed = String(c.formEmbed || '').slice(0, formrestyle.EMBED_MAX_CHARS); }
return out;
}
// the three knobs + niche; a niche preset sets design + palette unless the body overrides them (a preset is a start, not a lock)
function designFrom(body, cur) {
cur = cur || {}; const niche = body.niche != null ? style.nicheKey(body.niche) : (cur.niche || ''); const preset = niche ? style.NICHES[niche] : null;
const palette = body.palette != null ? style.paletteKey(body.palette) : (body.niche != null && preset ? preset.palette : style.paletteKey(cur.palette));
const design = body.design != null ? style.designKey(body.design) : (body.niche != null && preset ? preset.design : style.designKey(cur.design));
const layout = body.layout != null ? style.layoutKey(body.layout) : style.layoutKey(cur.layout || (body.niche != null && preset ? 'split' : 'stack'));
return { palette, design, layout, niche };
}
async function create(owner, body) {
if (J.db.pages.filter(p => p.owner === norm(owner)).length >= 200) return { error: 'That is a lot of pages. Remove some first.' };
const type = TYPES.includes(body.type) ? body.type : 'bridge';
const title = String(body.title || (body.content && body.content.headline) || 'Untitled page').trim().slice(0, 100);
const content = sanitizeContent(body.content, type);
if (type === 'squeeze' && content.formEmbed) { const why = formrestyle.problem(content.formEmbed); if (why) return { error: why }; }
const p = { id: crypto.randomBytes(5).toString('hex'), owner: norm(owner), slug: slugify(title), type, title, status: 'draft', design: { palette: render.PALETTE_NAMES.includes(body.palette) ? body.palette : 'graphite' }, content, scan: body.scan && typeof body.scan === 'object' ? { url: cleanUrl(body.scan.url), title: String(body.scan.title || '').slice(0, 200), description: String(body.scan.description || '').slice(0, 300), h1: String(body.scan.h1 || '').slice(0, 200), image: cleanUrl(body.scan.image), headings: strs(body.scan.headings, 8, 120), bullets: strs(body.scan.bullets, 8, 140) } : null, angle: String(body.angle || '').slice(0, 160), created: Date.now(), updated: Date.now() };
const p = { id: crypto.randomBytes(5).toString('hex'), owner: norm(owner), slug: slugify(title), type, title, status: 'draft', design: designFrom(body, null), content, scan: body.scan && typeof body.scan === 'object' ? { url: cleanUrl(body.scan.url), title: String(body.scan.title || '').slice(0, 200), description: String(body.scan.description || '').slice(0, 300), h1: String(body.scan.h1 || '').slice(0, 200), image: cleanUrl(body.scan.image), headings: strs(body.scan.headings, 8, 120), bullets: strs(body.scan.bullets, 8, 140) } : null, angle: String(body.angle || '').slice(0, 160), created: Date.now(), updated: Date.now() };
J.db.pages.push(p); J.save(); return { ok: true, page: pub(p) };
}
async function update(owner, id, body) {
@@ -58,7 +68,7 @@ async function update(owner, id, body) {
if (body.remove) { J.db.pages = J.db.pages.filter(x => x !== p); J.save(); return { ok: true, removed: true }; }
if (body.title != null) p.title = String(body.title).trim().slice(0, 100) || p.title;
if (body.type != null && TYPES.includes(body.type)) p.type = body.type;
if (body.palette != null && render.PALETTE_NAMES.includes(body.palette)) p.design.palette = body.palette;
if (body.palette != null || body.design != null || body.layout != null || body.niche != null) p.design = designFrom(body, p.design || {});
if (body.angle != null) p.angle = String(body.angle).slice(0, 160);
if (body.content != null) { const c = sanitizeContent(Object.assign({}, p.content, body.content), p.type); if (p.type === 'squeeze' && c.formEmbed) { const why = formrestyle.problem(c.formEmbed); if (why) return { error: why }; } p.content = c; }
if (body.status != null) { if (body.status === 'published') { if (!p.content.headline) return { error: 'Give the page a headline before publishing.' }; if (p.type !== 'squeeze' && !p.content.cta.url) return { error: 'Add the button link (where the page sends people) before publishing.' }; p.status = 'published'; } else p.status = 'draft'; }
+133
View File
@@ -0,0 +1,133 @@
// LinkSpin page styling (2026-10-07): the Branded Voice design system, ported. Three axes every page carries:
// palette — five curated colour sets with the SAME semantic keys (gold = the one bright CTA colour, inkGreen /
// inkGreenLight = the dark hero surface pair, green = the quiet accent, cream = text on dark)
// design — dark (glow hero, glass cards), light (white ground, SaaS-modern), editorial (serif magazine),
// ignition (black ground, ray burst, hot gradient headline: the launch look)
// layout — stack (centred) or split (copy left, a visual right: the member's image, the niche hero, or a
// procedural "product made tangible" card built from the copy itself)
// plus niche presets: one-click combos of design + palette + a house hero image (Branded Voice's own, served from
// mybrandedvoice.com). A preset is a starting point; every knob stays individually overridable.
// Pages stay self-contained: system font stacks, no webfonts, no inline script (the pages CSP forbids it), so the
// motion here is CSS-only and respects prefers-reduced-motion.
'use strict';
const FONT = '-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Helvetica,Arial,sans-serif';
const SERIF = 'Charter,Georgia,Cambria,"Times New Roman",serif';
const IGNITION_DISPLAY = 'Haettenschweiler,"Arial Narrow Bold",Impact,"Arial Black",sans-serif';
const NEUTRALS = { ink: '#1a1a1a', body: '#4a4a4a', muted: '#888', surfaceAlt: '#f8f9fa', frame: '#ececed', hairline: '#eceef0' };
const build = c => Object.assign({}, NEUTRALS, c);
const PALETTES = {
heritage: { label: 'Heritage', sub: 'green & gold', hue: 32, c: build({ gold: '#d9a23e', goldSoft: '#e3b45c', goldInk: '#231a08', inkGreen: '#141a16', inkGreenLight: '#2a3d31', green: '#33684b', greenTint: '#eaf1ec', cream: '#f5f1e8' }) },
midnight: { label: 'Midnight', sub: 'navy & amber', hue: 208, c: build({ gold: '#e0a53c', goldSoft: '#e8b65f', goldInk: '#241a06', inkGreen: '#111825', inkGreenLight: '#24344d', green: '#33567a', greenTint: '#e8eef5', cream: '#f1f4f8' }) },
ocean: { label: 'Ocean', sub: 'teal & sand', hue: 160, c: build({ gold: '#d5a850', goldSoft: '#dfb96e', goldInk: '#221a07', inkGreen: '#0e1f21', inkGreenLight: '#1e3f43', green: '#276b64', greenTint: '#e5f1ef', cream: '#eef4f2' }) },
plum: { label: 'Plum', sub: 'aubergine & honey', hue: 285, c: build({ gold: '#dca648', goldSoft: '#e4b768', goldInk: '#231a07', inkGreen: '#1d1220', inkGreenLight: '#38243e', green: '#68406b', greenTint: '#f1eaf2', cream: '#f4eff5' }) },
graphite: { label: 'Graphite', sub: 'charcoal & gold', hue: 12, c: build({ gold: '#d9a23e', goldSoft: '#e3b45c', goldInk: '#231a08', inkGreen: '#151719', inkGreenLight: '#2c2f33', green: '#4d5a63', greenTint: '#ebeef0', cream: '#f2f2f0' }) },
};
// older LinkSpin pages stored these names; they fold into the nearest curated palette
const LEGACY = { ink: 'heritage', ember: 'heritage' };
const DESIGNS = {
dark: { label: 'Dark', blurb: 'Glow hero, glass cards, cinematic' },
light: { label: 'Light', blurb: 'White ground, clean, SaaS-modern' },
editorial: { label: 'Editorial', blurb: 'Serif magazine article, pull quotes' },
ignition: { label: 'Ignition', blurb: 'Black ground, ray burst, hot headline' },
};
const LAYOUTS = { stack: { label: 'Stacked', blurb: 'Centred copy, image below the headline' }, split: { label: 'Split hero', blurb: 'Copy left, visual right' } };
const NICHE_HERO_ORIGIN = 'https://mybrandedvoice.com';
const NICHES = {
'health-wellness': { label: 'Health & Wellness', design: 'light', palette: 'ocean', hero: '/marketing/niches/health-wellness.jpg', blurb: 'Fresh and calm: teal & sand, clean light pages' },
'make-money-online': { label: 'Make Money Online', design: 'ignition', palette: 'heritage', hero: '/marketing/niches/make-money-online.jpg', blurb: 'Launch heat: black ground, inferno orange' },
'personal-finance': { label: 'Personal Finance', design: 'dark', palette: 'midnight', hero: '/marketing/niches/personal-finance.jpg', blurb: 'Trustworthy: navy & amber, dramatic dark' },
'coaching-consulting': { label: 'Coaching & Consulting', design: 'editorial', palette: 'plum', hero: '/marketing/niches/coaching-consulting.jpg', blurb: 'Premium: magazine layout, aubergine & honey' },
'self-improvement': { label: 'Self-Improvement', design: 'light', palette: 'heritage', hero: '/marketing/niches/self-improvement.jpg', blurb: 'Uplifting: green & gold on clean white' },
relationships: { label: 'Relationships', design: 'light', palette: 'plum', hero: '/marketing/niches/relationships.jpg', blurb: 'Warm: aubergine & honey, soft light pages' },
};
const paletteKey = n => { n = String(n || '').toLowerCase(); return PALETTES[n] ? n : LEGACY[n] || 'graphite'; };
const designKey = n => (DESIGNS[String(n || '').toLowerCase()] ? String(n).toLowerCase() : 'dark');
const layoutKey = n => (LAYOUTS[String(n || '').toLowerCase()] ? String(n).toLowerCase() : 'stack');
const nicheKey = n => (NICHES[String(n || '').toLowerCase()] ? String(n).toLowerCase() : '');
const nicheHero = n => (NICHES[n] ? NICHE_HERO_ORIGIN + NICHES[n].hero : '');
// what the editor shows: swatches, labels, blurbs
const catalog = () => ({
palettes: Object.entries(PALETTES).map(([k, p]) => ({ key: k, label: p.label, sub: p.sub, swatch: [p.c.inkGreen, p.c.gold, p.c.green] })),
designs: Object.entries(DESIGNS).map(([k, d]) => ({ key: k, label: d.label, blurb: d.blurb })),
layouts: Object.entries(LAYOUTS).map(([k, l]) => ({ key: k, label: l.label, blurb: l.blurb })),
niches: Object.entries(NICHES).map(([k, n]) => ({ key: k, label: n.label, blurb: n.blurb, design: n.design, palette: n.palette, hero: NICHE_HERO_ORIGIN + n.hero })),
});
// ---- colour helpers ----
const esc = s => String(s == null ? '' : s).replace(/[&<>"]/g, c => ({ '&': '&amp;', '<': '&lt;', '>': '&gt;', '"': '&quot;' }[c]));
function rgba(hex, a) { const h = hex.replace('#', ''); const n = parseInt(h.length === 3 ? h.split('').map(x => x + x).join('') : h, 16); return 'rgba(' + ((n >> 16) & 255) + ',' + ((n >> 8) & 255) + ',' + (n & 255) + ',' + a + ')'; }
function hslToHex(h, s, l) {
const f = n => { const k = (n + h * 12) % 12; const a = s * Math.min(l, 1 - l); const c = l - a * Math.max(-1, Math.min(k - 3, 9 - k, 1)); return Math.round(255 * c).toString(16).padStart(2, '0'); };
return '#' + f(0) + f(8) + f(4);
}
// Ignition carries each palette's identity hue at launch-page heat (not its gold, or every palette would be the same orange)
function hotRamp(pk) { const h = (PALETTES[pk] || PALETTES.graphite).hue / 360; return { hot1: hslToHex(h, 0.95, 0.55), hot2: hslToHex(h, 0.85, 0.74), hot3: hslToHex(h, 0.95, 0.32), ink: hslToHex(h, 0.7, 0.07) }; }
// the hottest phrase of a headline gets the gradient: money phrases win, else the last three words
function blazeHeadline(headline) {
const plain = String(headline || '').trim(); const money = plain.match(/\$[\d][\d,.]*(?:[ -]?(?:a|per)[ -]\w+)?/i);
if (money && money.index != null) return esc(plain.slice(0, money.index)) + '<span class="ig-blaze">' + esc(money[0]) + '</span>' + esc(plain.slice(money.index + money[0].length));
const w = plain.split(/\s+/); if (w.length < 4) return '<span class="ig-blaze">' + esc(plain) + '</span>';
return esc(w.slice(0, -3).join(' ')) + ' <span class="ig-blaze">' + esc(w.slice(-3).join(' ')) + '</span>';
}
// ---- the CSS kit: design-aware vocabulary shared by every page type ----
function kitCss(design, pk) {
const P = PALETTES[pk] || PALETTES.graphite, C = P.c, dk = C.inkGreen, cream = C.cream;
const shared = '.k-eyebrow{display:inline-flex;align-items:center;gap:8px;font-size:12px;font-weight:800;letter-spacing:.18em;text-transform:uppercase;border-radius:99px;padding:6px 14px;margin:0 0 18px}.k-eyebrow .dot{width:6px;height:6px;border-radius:99px}'
+ 'ul.checks{list-style:none;padding:0;margin:0 0 24px;text-align:left}ul.checks li{padding:7px 0 7px 34px;position:relative}ul.checks li:before{content:"\\2713";position:absolute;left:0;top:7px;width:22px;height:22px;border-radius:50%;background:' + C.greenTint + ';color:' + C.green + ';font-weight:800;font-size:13px;display:flex;align-items:center;justify-content:center}'
+ '.k-imgframe{position:relative;border-radius:18px;overflow:hidden;box-shadow:0 12px 40px rgba(0,0,0,.18);border:6px solid #fff}.k-imgframe img{display:block;width:100%;height:auto}.k-imgframe::after{content:"";position:absolute;inset:0;background:linear-gradient(135deg,' + rgba(C.inkGreen, 0.12) + ',' + rgba(C.gold, 0.1) + ');mix-blend-mode:multiply;pointer-events:none}'
+ '.k-mark{background:linear-gradient(180deg,transparent 52%,' + rgba(C.gold, 0.55) + ' 52%);padding:0 .12em;border-radius:2px;box-decoration-break:clone;-webkit-box-decoration-break:clone}'
+ '.cta{display:inline-block;background:' + C.gold + ';color:' + C.goldInk + ';font-weight:800;font-size:18px;line-height:1.3;text-decoration:none;padding:16px 32px;border-radius:10px;border:0;cursor:pointer;font-family:' + FONT + ';box-shadow:0 8px 24px ' + rgba(C.gold, 0.35) + ';transition:transform .15s ease,filter .15s ease}.cta:hover{transform:translateY(-1px);filter:brightness(1.05)}'
+ '.pc{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:14px;margin:18px 0}.pc div{border:1px solid ' + C.hairline + ';border-radius:12px;padding:16px 18px;background:#fff}.pc h3{margin:0 0 8px;font-size:16px}.pc ul{margin:0;padding-left:18px}@media(max-width:600px){.pc{grid-template-columns:1fr}}'
+ '.rating{font-size:22px;letter-spacing:2px;color:' + C.gold + ';margin:0 0 10px}.verdict{border-left:4px solid ' + C.gold + ';padding:12px 16px;margin:18px 0;background:' + C.surfaceAlt + ';border-radius:0 10px 10px 0}'
+ '.bonus{border:1px solid ' + C.hairline + ';border-radius:14px;overflow:hidden;margin:24px 0;box-shadow:0 6px 24px rgba(0,0,0,.06);background:#fff}.bonus .tag{background:' + C.ink + ';color:' + cream + ';font-size:12px;font-weight:700;letter-spacing:.14em;text-transform:uppercase;padding:10px 22px}.bonus .in{padding:20px 24px}'
+ '.ls-form{display:grid;gap:12px}.ls-in{width:100%;padding:14px 16px;font:16px/1.4 ' + FONT + ';color:' + C.ink + ';background:#fff;border:1.5px solid ' + C.hairline + ';border-radius:10px;outline:none}.ls-in:focus{border-color:' + C.gold + '}.ls-in::placeholder{color:' + C.muted + '}button.cta{width:100%;font-size:19px}'
+ '.privacy,.formnote{font-size:12.5px;color:' + C.muted + ';margin:12px 0 0;text-align:center}.foot{text-align:center;font-size:12.5px;padding:28px 18px 36px}.foot a{color:inherit}'
+ '@media (prefers-reduced-motion: no-preference){.reveal{animation:lsin .7s ease both}@keyframes lsin{from{opacity:0;transform:translateY(14px)}to{opacity:1;transform:none}}}';
if (design === 'ignition') {
const R = hotRamp(pk);
return shared
+ 'body::before{content:"";position:fixed;inset:-45%;z-index:0;pointer-events:none;background:repeating-conic-gradient(from 0deg at 50% 40%,transparent 0deg 5deg,' + rgba(R.hot1, 0.5) + ' 5deg 5.9deg,transparent 5.9deg 10deg);opacity:.35;mask-image:radial-gradient(ellipse at 50% 40%,#000 0%,transparent 70%);-webkit-mask-image:radial-gradient(ellipse at 50% 40%,#000 0%,transparent 70%)}'
+ 'body::after{content:"";position:fixed;inset:0;z-index:0;pointer-events:none;background:radial-gradient(58% 42% at 50% 108%,' + rgba(R.hot1, 0.28) + ' 0%,transparent 70%)}'
+ '@media (prefers-reduced-motion: no-preference){body::before{animation:igspin 150s linear infinite}@keyframes igspin{to{transform:rotate(360deg)}}}'
+ '.ig-blaze{background:linear-gradient(180deg,' + R.hot2 + ' 8%,' + R.hot1 + ' 55%,' + R.hot3 + ' 100%);-webkit-background-clip:text;background-clip:text;color:transparent;filter:drop-shadow(0 0 18px ' + rgba(R.hot1, 0.45) + ')}'
+ '.cta{background:linear-gradient(180deg,' + R.hot2 + ' 0%,' + R.hot1 + ' 60%,' + R.hot3 + ' 130%);color:' + R.ink + ';text-transform:uppercase;letter-spacing:.5px;box-shadow:0 10px 34px ' + rgba(R.hot1, 0.42) + '}'
+ '@media (prefers-reduced-motion: no-preference){.cta{animation:igpulse 2.6s ease-in-out infinite}@keyframes igpulse{0%,100%{box-shadow:0 10px 34px ' + rgba(R.hot1, 0.38) + '}50%{box-shadow:0 14px 48px ' + rgba(R.hot1, 0.62) + '}}}'
+ '.k-eyebrow{color:' + R.hot2 + ';background:rgba(0,0,0,.45);border:1px solid ' + rgba(R.hot1, 0.55) + '}.k-eyebrow .dot{background:' + R.hot1 + ';box-shadow:0 0 10px ' + rgba(R.hot1, 0.8) + '}'
+ 'ul.checks li{color:' + rgba(cream, 0.88) + '}ul.checks li:before{background:' + rgba(R.hot1, 0.25) + ';color:' + R.hot2 + '}'
+ '.pc div,.bonus,.verdict{background:rgba(255,255,255,.04);border:1px solid ' + rgba(cream, 0.1) + ';color:' + rgba(cream, 0.85) + '}.bonus .tag{background:' + rgba(R.hot1, 0.18) + ';color:' + R.hot2 + '}.verdict{border-left-color:' + R.hot1 + '}.rating{color:' + R.hot1 + '}'
+ '.ls-in{background:rgba(0,0,0,.62);border-color:' + rgba(R.hot1, 0.45) + ';color:#fff}.ls-in:focus{border-color:' + R.hot2 + '}.ls-in::placeholder{color:rgba(245,241,232,.45)}.privacy,.formnote{color:rgba(245,241,232,.5)}'
+ '.k-imgframe{border-color:#000;box-shadow:0 0 0 1px ' + rgba(R.hot1, 0.4) + ',0 24px 70px rgba(0,0,0,.6)}';
}
if (design === 'editorial') return shared + '.k-eyebrow{border-top:2px solid ' + C.gold + ';border-radius:0;padding:12px 0 0;color:' + C.green + ';background:none}.k-eyebrow .dot{display:none}'
+ '.k-pull{margin:36px 0;padding:8px 0 8px 26px;border-left:3px solid ' + C.gold + ';font-size:23px;line-height:1.45;font-style:italic;color:' + C.ink + '}.bonus{border-radius:6px}';
if (design === 'light') return shared + '.k-eyebrow{color:' + C.green + ';background:' + C.greenTint + ';border:1px solid ' + rgba(C.green, 0.2) + '}.k-eyebrow .dot{background:' + C.green + ';box-shadow:0 0 8px ' + rgba(C.green, 0.5) + '}';
// dark
return shared + '.k-eyebrow{color:' + C.goldSoft + ';background:' + rgba(C.gold, 0.1) + ';border:1px solid ' + rgba(C.gold, 0.28) + '}.k-eyebrow .dot{background:' + C.green + ';box-shadow:0 0 10px ' + rgba(C.green, 0.8) + '}'
+ '.hero ul.checks li{color:' + rgba(cream, 0.85) + '}';
}
// ---- procedural visual (split layout without an image): the offer made tangible, deterministic per headline ----
function hash(s) { let h = 5381; for (let i = 0; i < s.length; i++) h = ((h << 5) + h + s.charCodeAt(i)) >>> 0; return h; }
function visualCss(pk) {
const C = (PALETTES[pk] || PALETTES.graphite).c;
return '.pv{position:relative;width:100%;max-width:420px;margin:0 auto}.pv .pv-card{background:#fff;border:6px solid #fff;border-radius:12px;box-shadow:0 0 0 1px rgba(255,255,255,.16),0 12px 40px rgba(0,0,0,.18);overflow:hidden}.pv .pv-under{position:absolute;inset:18px -14px -14px 14px;background:' + C.greenTint + ';border-radius:12px;z-index:-1}'
+ '.pv-cover{background:' + C.green + ';padding:44px 28px;text-align:left}.pv-cover .pv-kicker{font-size:11px;font-weight:800;letter-spacing:.22em;text-transform:uppercase;color:' + C.goldSoft + ';margin:0 0 14px}.pv-cover .pv-title{color:' + C.cream + ';font-size:26px;line-height:1.25;font-weight:800;letter-spacing:-.01em;margin:0}.pv-cover .pv-rule{width:44px;height:4px;background:' + C.gold + ';border-radius:2px;margin:18px 0 0}'
+ '.pv-body{padding:20px 24px 24px}.pv-row{display:flex;align-items:flex-start;gap:12px;padding:9px 0;font-size:14.5px;line-height:1.45;color:' + C.body + '}.pv-row+.pv-row{border-top:1px solid ' + C.hairline + '}.pv-tick{flex:none;width:22px;height:22px;border-radius:50%;background:' + C.greenTint + ';color:' + C.green + ';font-weight:800;font-size:13px;display:flex;align-items:center;justify-content:center}'
+ '.pv-chip{position:absolute;top:-12px;right:-10px;background:' + C.gold + ';color:' + C.goldInk + ';font-weight:800;font-size:16px;padding:10px 16px;border-radius:999px;box-shadow:0 8px 24px ' + rgba(C.gold, 0.35) + ';z-index:2}'
+ '.pv-bar{display:flex;align-items:center;gap:8px;padding:14px 20px;border-bottom:1px solid ' + C.hairline + '}.pv-dot{width:9px;height:9px;border-radius:50%;background:' + C.hairline + '}.pv-dot:first-child{background:' + C.gold + '}'
+ '.pv-stat{display:flex;align-items:baseline;gap:10px;padding:18px 24px 6px}.pv-stat .pv-num{font-size:38px;font-weight:800;letter-spacing:-.02em;color:' + C.ink + '}.pv-stat .pv-lbl{font-size:12.5px;font-weight:700;text-transform:uppercase;letter-spacing:.08em;color:' + C.muted + '}.pv-meter{height:8px;border-radius:4px;background:' + C.greenTint + ';margin:10px 24px 14px;overflow:hidden}.pv-meter i{display:block;height:100%;width:72%;background:' + C.green + ';border-radius:4px}'
+ '@media(max-width:820px){.pv{max-width:360px}}';
}
function visualHtml(offer, bullets, price) {
offer = String(offer || '').trim() || 'Your Offer'; bullets = (bullets || []).map(b => String(b).trim()).filter(Boolean);
const motif = ['product', 'checklist', 'stat'][hash(offer.toLowerCase()) % 3]; const chip = price ? '<div class="pv-chip">' + esc(price) + '</div>' : '';
const ticks = arr => arr.slice(0, 3).map(b => '<div class="pv-row"><span class="pv-tick">✓</span><span>' + esc(b) + '</span></div>').join('');
if (motif === 'product') return '<div class="pv">' + chip + '<div class="pv-under"></div><div class="pv-card"><div class="pv-cover"><p class="pv-kicker">Instant access</p><h3 class="pv-title">' + esc(offer) + '</h3><div class="pv-rule"></div></div>' + (bullets.length ? '<div class="pv-body">' + ticks(bullets) + '</div>' : '') + '</div></div>';
if (motif === 'checklist') return '<div class="pv">' + chip + '<div class="pv-under"></div><div class="pv-card"><div class="pv-bar"><span class="pv-dot"></span><span class="pv-dot"></span><span class="pv-dot"></span></div><div class="pv-cover" style="padding:26px 24px"><h3 class="pv-title" style="font-size:21px">' + esc(offer) + '</h3></div><div class="pv-body">' + ticks(bullets.length ? bullets : ['Everything included', 'Ready to use today', 'Yours to keep']) + '</div></div></div>';
const many = offer.split(/\s+/).length > 2;
return '<div class="pv">' + chip + '<div class="pv-under"></div><div class="pv-card"><div class="pv-bar"><span class="pv-dot"></span><span class="pv-dot"></span><span class="pv-dot"></span></div><div class="pv-stat"><span class="pv-num">' + esc(many ? '100%' : offer) + '</span><span class="pv-lbl">' + esc(many ? offer : 'complete system') + '</span></div><div class="pv-meter"><i></i></div>' + (bullets.length ? '<div class="pv-body" style="padding-top:4px">' + ticks(bullets) + '</div>' : '') + '</div></div>';
}
module.exports = { FONT, SERIF, IGNITION_DISPLAY, PALETTES, DESIGNS, LAYOUTS, NICHES, paletteKey, designKey, layoutKey, nicheKey, nicheHero, catalog, rgba, hotRamp, blazeHeadline, kitCss, visualCss, visualHtml, esc };
+12 -5
View File
@@ -2,12 +2,12 @@
(function () {
const $ = id => document.getElementById(id); const esc = CR.esc, fmt = CR.fmt, api = CR.api, toast = CR.toast, dialog = CR.dialog;
let PAGES = [], SEL = null, SCAN = null, TYPE = 'bridge', HOSTS = [];
const PAL = { graphite: '#3B9DFF', ink: '#B8410E', ember: '#FF8A3D' };
let STYLES = { palettes: [], designs: [], layouts: [], niches: [] };
CR.mount({ active: 'pages', title: 'Pages', sub: 'loading', actions: '<button class="btn pri" type="button" id="newBtn">+ New page</button>' });
const pageUrl = p => 'https://' + (HOSTS[0] || location.host) + '/p/' + p.slug;
async function load(keepSel) {
let r; try { r = await CR.get('/api/my/pages'); } catch (e) { CR.sub('could not load'); return; }
PAGES = r.pages || []; HOSTS = r.hosts || [];
PAGES = r.pages || []; HOSTS = r.hosts || []; if (r.styles) STYLES = r.styles;
const pubd = PAGES.filter(p => p.status === 'published').length;
CR.sub(PAGES.length + ' page' + (PAGES.length === 1 ? '' : 's') + ' · ' + pubd + ' live');
const views = PAGES.reduce((n, p) => n + p.views, 0), leads = PAGES.reduce((n, p) => n + p.leads, 0), clicks = PAGES.reduce((n, p) => n + p.clicks, 0);
@@ -36,7 +36,7 @@
// editor
const F = { bridge: [['eyebrow', 'Eyebrow'], ['headline', 'Headline'], ['sub', 'Subhead'], ['body', 'Body, blank line between paragraphs', 'ta'], ['bullets', 'Bullets, one per line', 'ta'], ['bonusTitle', 'Bonus title'], ['bonus', 'Bonus text', 'ta'], ['ctaText', 'Button text'], ['ctaUrl', 'Button link'], ['image', 'Hero image URL'], ['disclaimer', 'Footer line']],
review: [['eyebrow', 'Eyebrow'], ['headline', 'Headline'], ['rating', 'Rating 1 to 5'], ['sub', 'Subhead'], ['body', 'Review body, blank line between paragraphs', 'ta'], ['pros', 'What works, one per line', 'ta'], ['cons', 'What to know, one per line', 'ta'], ['verdict', 'Verdict'], ['ctaText', 'Button text'], ['ctaUrl', 'Button link'], ['image', 'Hero image URL'], ['disclaimer', 'Footer line']],
squeeze: [['eyebrow', 'Eyebrow'], ['headline', 'Headline'], ['sub', 'Subhead'], ['bullets', 'What they get, one per line', 'ta'], ['ctaText', 'Button text'], ['ctaUrl', 'Where they go after the form'], ['image', 'Image URL'], ['privacy', 'Privacy line'], ['formEmbed', 'Your autoresponder form (optional, plain HTML form only, no JavaScript). Leave empty to capture leads on your LinkSpin list.', 'ta'], ['disclaimer', 'Footer line']] };
squeeze: [['eyebrow', 'Eyebrow'], ['headline', 'Headline'], ['sub', 'Subhead'], ['bullets', 'What they get, one per line', 'ta'], ['ctaText', 'Button text'], ['ctaUrl', 'Where they go after the form'], ['image', 'Image URL'], ['price', 'Price chip on the split visual, like $17 (optional)'], ['privacy', 'Privacy line'], ['formEmbed', 'Your autoresponder form (optional, plain HTML form only, no JavaScript). Leave empty to capture leads on your LinkSpin list.', 'ta'], ['disclaimer', 'Footer line']] };
function openEditor(id, quiet) {
const p = PAGES.find(x => x.id === id); if (!p) return; SEL = id;
$('gal').querySelectorAll('.card').forEach(c => c.classList.toggle('on', c.dataset.id === id));
@@ -46,8 +46,15 @@
$('edUrl').hidden = p.status !== 'published'; $('edUrl').textContent = pageUrl(p);
const c = p.content || {}; const v = k => k === 'ctaText' ? (c.cta && c.cta.text) || '' : k === 'ctaUrl' ? (c.cta && c.cta.url) || '' : Array.isArray(c[k]) ? c[k].join('\n') : (c[k] == null ? '' : c[k]);
$('edFields').innerHTML = F[p.type].map(([k, label, ta]) => '<label class="lbl">' + esc(label) + (ta ? '<textarea class="field" id="f-' + k + '">' + esc(v(k)) + '</textarea>' : '<input class="field' + (/Url|image/i.test(k) ? ' mono' : '') + '" id="f-' + k + '" value="' + esc(v(k)) + '">') + '</label>').join('');
$('pal').innerHTML = Object.entries(PAL).map(([k, col]) => '<button type="button" title="' + k + '" data-p="' + k + '" class="' + ((p.design && p.design.palette) === k ? 'on' : '') + '" style="background:' + col + '"></button>').join('');
$('pal').querySelectorAll('button').forEach(b => b.addEventListener('click', async () => { try { await api('/api/my/pages/' + p.id, { palette: b.dataset.p }); load(true); } catch (e) { toast(e.message, true); } }));
// 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); } };
const ns = $('niche'); ns.innerHTML = '<option value="">None (set it yourself)</option>' + STYLES.niches.map(n => '<option value="' + n.key + '"' + (d.niche === n.key ? ' selected' : '') + '>' + esc(n.label) + ' \u00b7 ' + esc(n.blurb) + '</option>').join(''); ns.onchange = () => setLook({ niche: ns.value });
$('designs').innerHTML = STYLES.designs.map(x => '<button type="button" data-d="' + x.key + '" class="' + (d.design === x.key ? 'on' : '') + '" title="' + esc(x.blurb) + '">' + esc(x.label) + '</button>').join('');
$('designs').querySelectorAll('button').forEach(b => b.addEventListener('click', () => setLook({ design: b.dataset.d })));
$('pal').innerHTML = STYLES.palettes.map(x => '<button type="button" data-p="' + x.key + '" class="' + (d.palette === x.key ? 'on' : '') + '" title="' + esc(x.label + ', ' + x.sub) + '">' + x.swatch.map(col => '<i style="background:' + col + '"></i>').join('') + '</button>').join('');
$('pal').querySelectorAll('button').forEach(b => b.addEventListener('click', () => setLook({ palette: b.dataset.p })));
$('layouts').innerHTML = STYLES.layouts.map(x => '<button type="button" data-l="' + x.key + '" class="' + ((d.layout || 'stack') === x.key ? 'on' : '') + '" title="' + esc(x.blurb) + '">' + esc(x.label) + '</button>').join('');
$('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' });
}
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; }
+1
View File
@@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" width="120" height="600" viewBox="0 0 120 600" role="img" aria-label="LinkSpin, one link, every page you promote"><rect width="120" height="600" rx="6" fill="#0B1220"/><rect x="0.5" y="0.5" width="119" height="599" rx="6" fill="none" stroke="#2A3A56"/><text x="12" y="46" font-family="Segoe UI,Arial,sans-serif" font-weight="800" font-size="22" fill="#E6EDF7">Link<tspan fill="#3B9DFF">Spin</tspan></text><text x="12" y="84" font-family="Segoe UI,Arial,sans-serif" font-size="12" fill="#AFC0D8">One link.</text><text x="12" y="102" font-family="Segoe UI,Arial,sans-serif" font-size="12" fill="#AFC0D8">Every page</text><text x="12" y="120" font-family="Segoe UI,Arial,sans-serif" font-size="12" fill="#AFC0D8">you promote,</text><text x="12" y="138" font-family="Segoe UI,Arial,sans-serif" font-size="12" fill="#AFC0D8">in turn.</text><text x="12" y="176" font-family="Segoe UI,Arial,sans-serif" font-size="11" fill="#6E82A3">Bots filtered</text><text x="12" y="194" font-family="Segoe UI,Arial,sans-serif" font-size="11" fill="#6E82A3">on the server.</text><text x="12" y="222" font-family="Segoe UI,Arial,sans-serif" font-size="11" fill="#6E82A3">Click ids</text><text x="12" y="240" font-family="Segoe UI,Arial,sans-serif" font-size="11" fill="#6E82A3">pass through.</text><text x="12" y="268" font-family="Segoe UI,Arial,sans-serif" font-size="11" fill="#6E82A3">Your own</text><text x="12" y="286" font-family="Segoe UI,Arial,sans-serif" font-size="11" fill="#6E82A3">short domain.</text><circle cx="60" cy="420" r="22" fill="none" stroke="#3B9DFF" stroke-width="3" stroke-dasharray="30 12"/><rect x="12" y="540" width="96" height="32" rx="6" fill="#3B9DFF"/><text x="60" y="561" font-family="Segoe UI,Arial,sans-serif" font-weight="800" font-size="12" fill="#061225" text-anchor="middle">Start free</text></svg>

After

Width:  |  Height:  |  Size: 1.8 KiB

+1
View File
@@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" width="125" height="125" viewBox="0 0 125 125" role="img" aria-label="LinkSpin, one link, every page you promote"><rect width="125" height="125" rx="6" fill="#0B1220"/><rect x="0.5" y="0.5" width="124" height="124" rx="6" fill="none" stroke="#2A3A56"/><text x="12" y="40" font-family="Segoe UI,Arial,sans-serif" font-weight="800" font-size="20" fill="#E6EDF7">Link<tspan fill="#3B9DFF">Spin</tspan></text><text x="12" y="64" font-family="Segoe UI,Arial,sans-serif" font-size="11" fill="#AFC0D8">One link,</text><text x="12" y="79" font-family="Segoe UI,Arial,sans-serif" font-size="11" fill="#AFC0D8">every page.</text><rect x="12" y="92" width="84" height="24" rx="6" fill="#3B9DFF"/><text x="54" y="108" font-family="Segoe UI,Arial,sans-serif" font-weight="800" font-size="11" fill="#061225" text-anchor="middle">Start free</text></svg>

After

Width:  |  Height:  |  Size: 878 B

+1
View File
@@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" width="250" height="250" viewBox="0 0 250 250" role="img" aria-label="LinkSpin, one link, every page you promote"><rect width="250" height="250" rx="6" fill="#0B1220"/><rect x="0.5" y="0.5" width="249" height="249" rx="6" fill="none" stroke="#2A3A56"/><circle cx="232" cy="232" r="7" fill="none" stroke="#3B9DFF" stroke-width="3" stroke-dasharray="30 12"/><text x="20" y="62" font-family="Segoe UI,Arial,sans-serif" font-weight="800" font-size="28" fill="#E6EDF7">Link<tspan fill="#3B9DFF">Spin</tspan></text><text x="20" y="100" font-family="Segoe UI,Arial,sans-serif" font-size="15" fill="#AFC0D8">One link. Every page</text><text x="20" y="121" font-family="Segoe UI,Arial,sans-serif" font-size="15" fill="#AFC0D8">you promote, in turn.</text><text x="20" y="150" font-family="Segoe UI,Arial,sans-serif" font-size="12.5" fill="#6E82A3">Bots filtered. Real numbers.</text><rect x="20" y="182" width="130" height="36" rx="6" fill="#3B9DFF"/><text x="85" y="206" font-family="Segoe UI,Arial,sans-serif" font-weight="800" font-size="14" fill="#061225" text-anchor="middle">Start free</text></svg>

After

Width:  |  Height:  |  Size: 1.1 KiB

+1
View File
@@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" width="336" height="280" viewBox="0 0 336 280" role="img" aria-label="LinkSpin, one link, every page you promote"><rect width="336" height="280" rx="6" fill="#0B1220"/><rect x="0.5" y="0.5" width="335" height="279" rx="6" fill="none" stroke="#2A3A56"/><circle cx="318" cy="262" r="8" fill="none" stroke="#3B9DFF" stroke-width="3" stroke-dasharray="30 12"/><text x="26" y="74" font-family="Segoe UI,Arial,sans-serif" font-weight="800" font-size="32" fill="#E6EDF7">Link<tspan fill="#3B9DFF">Spin</tspan></text><text x="26" y="116" font-family="Segoe UI,Arial,sans-serif" font-size="17" fill="#AFC0D8">One link. Every page you promote, in turn.</text><text x="26" y="142" font-family="Segoe UI,Arial,sans-serif" font-size="14" fill="#6E82A3">Weights, hours, health checks, real numbers.</text><rect x="26" y="186" width="150" height="40" rx="6" fill="#3B9DFF"/><text x="101" y="213" font-family="Segoe UI,Arial,sans-serif" font-weight="800" font-size="15" fill="#061225" text-anchor="middle">Start free</text></svg>

After

Width:  |  Height:  |  Size: 1.0 KiB

+14 -2
View File
@@ -8,6 +8,10 @@
<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Rajdhani:wght@600;700&family=Manrope:wght@400;500;700&family=JetBrains+Mono:wght@500;700&display=swap">
<link rel="stylesheet" href="/assets/cr.css?v=20261007b">
<style>
.look{display:grid;gap:10px;margin:6px 0 10px}.lk-row{display:flex;gap:10px;align-items:flex-start}.lk-k{flex:none;width:64px;font:700 11px var(--mono);letter-spacing:.1em;text-transform:uppercase;color:var(--muted);padding-top:9px}
.lk-opts{display:flex;gap:6px;flex-wrap:wrap}.lk-opts button{font:600 12px var(--body);padding:7px 10px;border-radius:7px;border:1px solid var(--line);background:transparent;color:var(--fg);cursor:pointer}.lk-opts button.on{border-color:var(--accent);background:rgba(59,157,255,.12)}
.pal{display:flex;gap:8px;flex-wrap:wrap}.pal button{width:34px;height:26px;border-radius:7px;border:2px solid transparent;cursor:pointer;padding:0;overflow:hidden;display:grid;grid-template-columns:1fr 1fr 1fr}.pal button i{display:block}.pal button.on{border-color:var(--fg)}
.ws{display:grid;grid-template-columns:minmax(0,1fr) 440px;min-height:calc(100vh - 94px)}
.body{padding:16px 24px;display:grid;gap:14px;align-content:start}
.gal{display:grid;grid-template-columns:repeat(auto-fill,minmax(220px,1fr));gap:10px}
@@ -50,12 +54,20 @@
<div style="display:flex;gap:8px;flex-wrap:wrap;align-items:center"><span id="edStatus"></span><a class="btn sm" id="edPreview" href="#" target="_blank" rel="noopener">Preview</a><button class="btn sm pri" type="button" id="edPublish">Publish</button><button class="btn sm" type="button" id="edSpin">Put it in a spin</button><button class="btn sm danger" type="button" id="edDelete">Delete</button></div>
<div class="code" id="edUrl" hidden></div>
<div class="ed" id="edFields"></div>
<div style="display:flex;gap:8px;align-items:center"><span class="sec">Look</span><div class="pal" id="pal"></div><span class="grow"></span><button class="btn sm" type="button" id="edRewrite">Write again</button><button class="btn pri" type="button" id="edSave">Save</button></div>
<div class="look" id="look">
<div class="sec">Look</div>
<label class="lbl">Niche preset<select class="field" id="niche"><option value="">None (set it yourself)</option></select></label>
<div class="lk-row"><span class="lk-k">Design</span><div class="lk-opts" id="designs"></div></div>
<div class="lk-row"><span class="lk-k">Colours</span><div class="pal" id="pal"></div></div>
<div class="lk-row"><span class="lk-k">Layout</span><div class="lk-opts" id="layouts"></div></div>
<div class="muted" id="lookNote">Pick a niche for a ready-made combo, then change any knob. The split hero shows your image, the niche image, or a card built from your copy.</div>
</div>
<div style="display:flex;gap:8px;align-items:center"><span class="grow"></span><button class="btn sm" type="button" id="edRewrite">Write again</button><button class="btn pri" type="button" id="edSave">Save</button></div>
</div>
</div>
</div>
</div>
<script src="/assets/cr-shell.js?v=20260929d"></script>
<script src="/assets/pages-screen.js?v=20260929a"></script>
<script src="/assets/pages-screen.js?v=20261007a"></script>
</body>
</html>
+1 -1
View File
@@ -1937,7 +1937,7 @@ const server = http.createServer(async (req, res) => {
if (p === '/api/my/pages' && req.method === 'GET') {
const s = await auth.fromRequest(req); if (!s || !s.email) return json(res, 401, { error: 'Sign in first.' });
const hosts = String(siteConfig().linkDomains || '').split(',').map(x => x.trim()).filter(x => x && !x.startsWith('www.'));
return json(res, 200, { pages: await pages.list(s.email), hosts: hosts.length ? hosts : [SITE_HOST], types: pages.TYPES }, { 'Cache-Control': 'no-store' });
return json(res, 200, { pages: await pages.list(s.email), hosts: hosts.length ? hosts : [SITE_HOST], types: pages.TYPES, styles: require('./pagestyle').catalog() }, { 'Cache-Control': 'no-store' });
}
if (p === '/api/my/pages' && req.method === 'POST') {
const s = await auth.fromRequest(req); if (!s || !s.email) return json(res, 401, { error: 'Sign in first.' });
+2 -2
View File
@@ -8,8 +8,8 @@ const fs = require('fs');
const path = require('path');
const crypto = require('crypto');
let DATA_DIR = null, ads = null, siteHost = 'linkspin.app';
const SIZES = { '728x90': [728, 90], '468x60': [468, 60], '300x250': [300, 250], '160x600': [160, 600], '320x50': [320, 50] };
const HOUSE = { '728x90': '/banners/linkspin-728x90.svg', '468x60': '/banners/linkspin-468x60.svg', '300x250': '/banners/linkspin-300x250.svg', '160x600': '/banners/linkspin-160x600.svg', '320x50': '/banners/linkspin-320x50.svg' };
const SIZES = { '728x90': [728, 90], '468x60': [468, 60], '300x250': [300, 250], '336x280': [336, 280], '250x250': [250, 250], '125x125': [125, 125], '160x600': [160, 600], '120x600': [120, 600], '320x50': [320, 50] }; // + 336x280 / 250x250 / 125x125 / 120x600 (Marty 2026-10-07)
const HOUSE = { '728x90': '/banners/linkspin-728x90.svg', '468x60': '/banners/linkspin-468x60.svg', '300x250': '/banners/linkspin-300x250.svg', '336x280': '/banners/linkspin-336x280.svg', '250x250': '/banners/linkspin-250x250.svg', '125x125': '/banners/linkspin-125x125.svg', '160x600': '/banners/linkspin-160x600.svg', '120x600': '/banners/linkspin-120x600.svg', '320x50': '/banners/linkspin-320x50.svg' };
const NAS_SIZES = new Set(['728x90', '468x60']); // the sizes Network Ad Space serves through its showadss.php tag
const NAS_TAG = (w, h) => '<script src="https://www.networkadspace.com/showadss.php?w=' + w + '&h=' + h + '&n=1&bw=' + w + '&bh=' + h + '&c=999"></script>';
const BOT = /bot|crawl|spider|slurp|facebookexternalhit|preview|telegrambot|whatsapp|curl|wget|python-requests|headless/i;