YourProgramBuilder, the Seed Bed (Marty 2026-11-17: "keep fleshing it out"): STAGING build
Plant a program free (referral link with {id}, link check green / yellow / red, daily recheck, reports), members save their
referral IDs in its packet, a sponsor-first link (member page / ?r= / the hub sponsor line, then the planter), the sprout meter
to REVIEW_SAVES (DEFAULT 25) -> Marty's review queue -> approved packets exported for the CTB builder / DownlineHydra wild heads
with every saved ID. Dormant old programs confirmed by their owner, old-link redirects (oldrefs), Spotlight on YPBShop (NOT
deployed; DEFAULT $10 / 1,000 views, 20/5/5/5/5, company 60), verified views with Spotlight delivery, trust pack (ledger,
contract, toasts, Telegram card, terms / disclaimer / privacy, TrustClickz only), network footer row, chatbot, promo kit,
Guides, PolHunter slot, LinkSpin tracked-link and zone hooks, AI writer through the hub. Seed-catalog look from the approved
mockup. Tests: qa/unit.test.cjs 33/33, qa/e2e.mjs 121/121 on a local anvil chain.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,40 @@
|
||||
// Admin (Marty): status, the review queue (approve = transplant, reject), held packets (link check yellow / red, reports), the export
|
||||
// for the CTB builder / DownlineHydra, a link recheck, and the staging-only test-member switch. The token stays in this tab only.
|
||||
(function () {
|
||||
const $ = YPB.$, esc = YPB.esc;
|
||||
let tok = ''; try { tok = sessionStorage.getItem('ypb.admin') || ''; } catch (e) {}
|
||||
$('tok').value = tok;
|
||||
const api = (url, body) => fetch(url, body ? { method: 'POST', headers: { 'Content-Type': 'application/json', 'x-admin-token': tok }, body: JSON.stringify(body) } : { headers: { 'x-admin-token': tok } }).then(r => r.json());
|
||||
function row(x, acts) {
|
||||
const chk = x.check ? x.check.state + (x.check.why && x.check.why.length ? ': ' + x.check.why.join('; ') : '') : 'not checked';
|
||||
return '<div class="panel" style="border-width:1.5px"><div class="row" style="justify-content:space-between"><b>No. ' + esc(x.no) + ' ' + esc(x.name) + '</b><span class="mono" style="font-size:12px">' + esc(x.status) + ' / ' + esc(x.stage) + ' / ' + x.saves + ' of ' + x.need + ' saves</span></div>'
|
||||
+ '<p class="muted" style="font-size:14px;margin:6px 0">' + esc(x.desc) + '</p><p style="font-size:13px;margin:0 0 6px"><span class="mono">' + esc(x.url) + '</span> (planter ID ' + esc(x.ownerId || '') + ', @' + esc(x.planter || '?') + ')</p>'
|
||||
+ '<p style="font-size:13px;margin:0 0 6px">Link check: ' + esc(chk) + (x.flags && x.flags.length ? ' | flags: ' + esc(x.flags.join(', ')) : '') + (x.heldWhy ? ' | held: ' + esc(x.heldWhy) : '') + '</p>'
|
||||
+ (x.reports && x.reports.length ? '<p style="font-size:13px;margin:0 0 6px">Reports: ' + x.reports.map(r => esc(r.reason + (r.note ? ' (' + r.note + ')' : '') + ' by ' + r.by)).join('; ') + '</p>' : '')
|
||||
+ '<div class="row"><input type="text" placeholder="note (optional)" data-note="' + x.id + '" style="max-width:260px">' + acts.map(a => '<button class="btn sm" type="button" data-act="' + a + '" data-id="' + x.id + '">' + a + '</button>').join('') + '</div></div>';
|
||||
}
|
||||
async function load() {
|
||||
try { sessionStorage.setItem('ypb.admin', tok); } catch (e) {}
|
||||
const s = await api('/api/admin/status');
|
||||
if (s.error) { YPB.status('Wrong token.', 'err'); return; }
|
||||
YPB.status('', '');
|
||||
$('aStats').innerHTML = [['Shown', s.packets.shown], ['Held', s.packets.held], ['In review', s.packets.review], ['Transplanted', s.packets.approved], ['Dormant', s.packets.dormant], ['Saved IDs', s.saves], ['Members', s.members], ['Old links', s.oldrefs]].map(v => '<div class="stat"><b>' + YPB.n(v[1]) + '</b><span>' + v[0] + '</span></div>').join('');
|
||||
$('aRaw').textContent = JSON.stringify({ config: s.config, shop: s.shop, hub: s.hub, hubLookup: s.hubLookup, sso: s.sso, linkspin: s.linkspin, docstore: s.docstore, adWriter: s.adWriter }, null, 1);
|
||||
$('testBox').hidden = !s.testSwitch;
|
||||
const q = await api('/api/admin/queue');
|
||||
$('qReview').innerHTML = q.review.length ? q.review.map(x => row(x, ['approve', 'reject', 'hold', 'remove'])).join('') : '<p class="muted">Nothing in review.</p>';
|
||||
$('qHeld').innerHTML = q.held.length ? q.held.map(x => row(x, ['show', 'recheck', 'remove'])).join('') : '<p class="muted">Nothing held.</p>';
|
||||
$('qApproved').innerHTML = q.approved.length ? q.approved.map(x => row(x, ['reopen'])).join('') : '<p class="muted">Nothing transplanted yet.</p>';
|
||||
document.querySelectorAll('[data-act]').forEach(b => { b.onclick = async () => {
|
||||
b.disabled = true; const note = (document.querySelector('[data-note="' + b.dataset.id + '"]') || {}).value || '';
|
||||
const r = await api('/api/admin/packet', { id: Number(b.dataset.id), action: b.dataset.act, note }); YPB.status(r.error || 'Done: ' + b.dataset.act, r.error ? 'err' : 'ok'); load(); }; });
|
||||
}
|
||||
$('go').onclick = () => { tok = $('tok').value.trim(); load(); };
|
||||
$('recheck').onclick = async () => { const r = await api('/api/admin/recheck', { max: 50 }); YPB.status(r.error || 'Rechecked ' + r.checked + ' packets.', r.error ? 'err' : 'ok'); load(); };
|
||||
$('exportBtn').onclick = async e => {
|
||||
e.preventDefault(); const r = await api('/api/admin/export?all=1');
|
||||
const blob = new Blob([JSON.stringify(r, null, 1)], { type: 'application/json' }); const a = document.createElement('a'); a.href = URL.createObjectURL(blob); a.download = 'ypb-transplants-' + new Date().toISOString().slice(0, 10) + '.json'; a.click();
|
||||
};
|
||||
$('tGo').onclick = async () => { const r = await api('/api/admin/test-member', { address: $('tAddr').value.trim(), username: $('tName').value.trim() || undefined }); YPB.status(r.error || 'Marked ' + r.member.address + ' as a test network member.', r.error ? 'err' : 'ok'); };
|
||||
if (tok) load();
|
||||
})();
|
||||
@@ -0,0 +1,37 @@
|
||||
// One-time Spotlights through YPBShop. The server builds the signed buy() call for the signed-in member (POST /api/my/order: the hub
|
||||
// sponsor line + the packet); the member's own wallet sends it. After it confirms the page waits for the watcher to record it.
|
||||
window.YPBBuy = (function () {
|
||||
const fmtPol = (wei, d) => { const k = d || 4; const s = (BigInt(wei) * 10n ** BigInt(k) / 10n ** 18n).toString().padStart(k + 1, '0'); return s.slice(0, -k) + '.' + s.slice(-k); };
|
||||
async function quote(qty) { return YPB.getJSON('/api/quote?qty=' + (qty || 1)); }
|
||||
async function run(o) {
|
||||
const say = o.say || YPB.status;
|
||||
const c = await YPB.getConfig();
|
||||
if (!c.shop || !c.shop.live) throw new Error('Spotlights are not on sale yet.');
|
||||
const me = await YPB.getJSON('/api/me');
|
||||
if (!me.signedIn) throw new Error('Sign in on My packets first.');
|
||||
say('Connecting your wallet...');
|
||||
const addr = String(await YPBWallet.activeAddress(await YPBWallet.connect()) || '').toLowerCase();
|
||||
if (!addr) throw new Error('No wallet connected. Tap Buy again and pick SafePal or any other crypto wallet.');
|
||||
if (addr !== me.address) throw new Error('Your wallet is connected as ' + YPB.short(addr) + ', but your YourProgramBuilder account is ' + YPB.short(me.address) + '. Switch your wallet app to ' + YPB.short(me.address) + ', or sign out and sign in with ' + YPB.short(addr) + '.');
|
||||
const od = await YPB.post('/api/my/order', { qty: o.qty || 1, packetId: o.packetId });
|
||||
if (od.error) throw new Error(od.error);
|
||||
const value = BigInt(od.value);
|
||||
try { const bal = await YPBWallet.balance(addr); if (bal < value) throw new Error('This wallet holds ' + fmtPol(bal) + ' POL. The Spotlight needs about ' + fmtPol(value) + ' POL plus a little gas. Add POL on Polygon and try again.'); }
|
||||
catch (e) { if (/holds/.test(e.message)) throw e; }
|
||||
say('Confirm the payment in your wallet: about ' + fmtPol(value) + ' POL ($' + od.usd + '). Anything above the exact price comes straight back in the same transaction.');
|
||||
const hash = await YPBWallet.sendTx(od.to, od.data, od.value);
|
||||
const link = c.explorer ? c.explorer + '/tx/' + hash : '';
|
||||
say('Payment sent. Waiting for the Polygon network to confirm it...');
|
||||
const r = await YPBWallet.waitTx(hash);
|
||||
if (r.status !== '0x1') throw new Error('The transaction did not go through, so nothing was charged except gas. ' + (link ? 'Details: ' + link : ''));
|
||||
YPB.post('/api/my/paid', {}).catch(() => {});
|
||||
say('Confirmed on Polygon. Your Spotlight shows on My packets within about a minute.', 'ok');
|
||||
for (let i = 0; i < 72; i++) {
|
||||
await new Promise(res => setTimeout(res, 5000));
|
||||
if (i % 4 === 3) YPB.post('/api/my/paid', {}).catch(() => {});
|
||||
try { if (await o.done()) return { hash, link, recorded: true }; } catch (e) {}
|
||||
}
|
||||
return { hash, link, recorded: false };
|
||||
}
|
||||
return { run, quote, fmtPol };
|
||||
})();
|
||||
@@ -0,0 +1,46 @@
|
||||
/* Site assistant widget in the YourProgramBuilder seed catalog look (ypb.css): forest ink header, rounded paper panel, tangerine send, leaf chips.
|
||||
The overrides at the end of this file set the look; the shared widget rules above stay as on every network site. */
|
||||
#scChat{--sc-bg:var(--card,#fff);--sc-ink:var(--ink,#0A1F6B);--sc-sub:var(--sub,#3E4C7A);--sc-head:var(--royal,#0A1F6B);--sc-head-ink:#fff;
|
||||
--sc-accent:var(--red,#E3141E);--sc-accent-ink:#fff;--sc-me:var(--royal2,#12308F);--sc-me-ink:#fff;--sc-bot:var(--tint,#E1EBFF);--sc-line:var(--line,#C9D6F5);
|
||||
--sc-chip:var(--gtint,#FFF3CC);--sc-chip-ink:var(--gold-ink,#7A5B00);--sc-gold:var(--gold,#FFC21A);
|
||||
--sc-font:var(--body,Inter,system-ui,sans-serif);--sc-headfont:var(--head,'Chakra Petch',system-ui,sans-serif);--sc-cut:polygon(0 0,calc(100% - 14px) 0,100% 14px,100% 100%,14px 100%,0 calc(100% - 14px));
|
||||
position:fixed;right:18px;bottom:18px;z-index:80;font-family:var(--sc-font)}
|
||||
#scBtn{width:58px;height:58px;border:0;cursor:pointer;background:var(--sc-accent);color:var(--sc-accent-ink);display:flex;align-items:center;justify-content:center;
|
||||
clip-path:polygon(0 0,calc(100% - 12px) 0,100% 12px,100% 100%,12px 100%,0 calc(100% - 12px));box-shadow:0 6px 18px rgba(6,26,102,.35)}
|
||||
#scBtn:hover{background:#C70F18}
|
||||
#scBtn:focus-visible{outline:3px solid var(--sc-gold);outline-offset:3px}
|
||||
#scChat.open #scBtn{background:var(--sc-head)}
|
||||
/* the panel sets display:flex, which would beat the hidden attribute: closing must win */
|
||||
#scPanel[hidden]{display:none}
|
||||
#scPanel{position:absolute;right:0;bottom:72px;width:370px;max-width:calc(100vw - 32px);height:540px;max-height:calc(100vh - 110px);display:flex;flex-direction:column;
|
||||
background:var(--sc-bg);color:var(--sc-ink);clip-path:var(--sc-cut);border:1px solid var(--sc-line);box-shadow:0 18px 48px rgba(6,26,102,.3)}
|
||||
.sc-head{display:flex;align-items:flex-start;gap:10px;padding:14px 16px;background:var(--sc-head);color:var(--sc-head-ink);border-bottom:3px solid var(--sc-gold)}
|
||||
.sc-head>div{flex:1;min-width:0}
|
||||
.sc-title{display:block;font-family:var(--sc-headfont);font-size:18px;letter-spacing:.02em}
|
||||
.sc-sub{display:block;font-size:12.5px;opacity:.8}
|
||||
#scClose{background:transparent;border:0;color:inherit;font-size:26px;line-height:1;cursor:pointer;padding:0 2px}
|
||||
.sc-msgs{flex:1;overflow-y:auto;padding:14px;display:flex;flex-direction:column;gap:9px}
|
||||
.sc-m{max-width:88%;padding:9px 12px;font-size:14.5px;line-height:1.45;word-wrap:break-word;overflow-wrap:anywhere}
|
||||
.sc-m.bot{align-self:flex-start;background:var(--sc-bot);color:var(--sc-ink);clip-path:polygon(0 0,100% 0,100% 100%,8px 100%,0 calc(100% - 8px))}
|
||||
.sc-m.me{align-self:flex-end;background:var(--sc-me);color:var(--sc-me-ink);clip-path:polygon(0 0,calc(100% - 8px) 0,100% 8px,100% 100%,0 100%)}
|
||||
.sc-m a{color:inherit;text-decoration:underline}
|
||||
.sc-m.wait{opacity:.6}
|
||||
.sc-cta{display:inline-block;background:var(--sc-accent);color:var(--sc-accent-ink)!important;text-decoration:none!important;font-weight:700;padding:8px 14px;
|
||||
clip-path:polygon(0 0,calc(100% - 8px) 0,100% 8px,100% 100%,8px 100%,0 calc(100% - 8px))}
|
||||
.sc-handoff{background:transparent!important;padding:0!important}
|
||||
.sc-topics{display:flex;flex-wrap:wrap;gap:6px;padding:0 14px 8px}
|
||||
.sc-topics button{background:var(--sc-chip);color:var(--sc-chip-ink);border:1px solid var(--sc-gold);font:600 12.5px var(--sc-font);padding:5px 10px;cursor:pointer}
|
||||
.sc-input{display:flex;gap:8px;padding:10px 12px;border-top:1px solid var(--sc-line)}
|
||||
.sc-input input{flex:1;min-width:0;border:1px solid var(--sc-line);padding:10px 12px;font:15px var(--sc-font);color:var(--sc-ink);background:#fff}
|
||||
.sc-input input:focus{outline:2px solid var(--blue,#1F66FF);outline-offset:-1px}
|
||||
.sc-input button{background:var(--sc-accent);color:var(--sc-accent-ink);border:0;font:700 14px var(--sc-font);padding:0 16px;cursor:pointer;
|
||||
clip-path:polygon(0 0,calc(100% - 8px) 0,100% 8px,100% 100%,8px 100%,0 calc(100% - 8px))}
|
||||
.sc-human{display:block;text-align:center;font-size:12.5px;color:var(--sc-sub);padding:0 0 10px}
|
||||
@media (max-width:600px){#scChat{right:12px;bottom:12px}#scBtn{width:52px;height:52px}#scPanel{bottom:64px;height:calc(100vh - 100px)}}
|
||||
/* YourProgramBuilder seed catalog look */
|
||||
#scChat{--sc-ink:#12291F;--sc-sub:#4A6457;--sc-head:#12291F;--sc-accent:#F2620F;--sc-accent-ink:#FFFFFF;--sc-me:#1B4A33;--sc-bot:#F6FAF1;--sc-line:#D3E3CB;--sc-chip:#E9F2E2;--sc-chip-ink:#1B6E3C;--sc-gold:#22844A;
|
||||
--sc-font:'Atkinson Hyperlegible',system-ui,sans-serif;--sc-headfont:'Young Serif',Georgia,serif;--sc-cut:none}
|
||||
#scChat #scBtn{clip-path:none;border-radius:50%;box-shadow:0 6px 18px rgba(18,41,31,.35)}
|
||||
#scChat #scBtn:hover{background:#D9540A}
|
||||
#scChat #scPanel{clip-path:none;border-radius:18px;overflow:hidden;border:2px solid #12291F}
|
||||
#scChat .sc-m.bot,#scChat .sc-m.me{clip-path:none;border-radius:14px}#scChat [class*="sc-"]{clip-path:none}#scChat .sc-chip,#scChat button{border-radius:10px}
|
||||
@@ -0,0 +1,72 @@
|
||||
// Site assistant widget (2026-11-15): a round button bottom right, a panel that asks /api/chat. The look is this site's own,
|
||||
// in /assets/chat.css (colors and fonts from the site's stylesheet). When an answer cannot help, or the visitor asks for a
|
||||
// person, it offers "Open network support": InstantAdPay's support desk, which already knows the question and the site.
|
||||
// The SAME file ships in ViralAdBlitz, DownlineHydra, 5xYourTeam, Viral Banner Blitz, Downline Banners and Stack POL.
|
||||
(function () {
|
||||
if (window.__siteChat || /^\/admin/.test(location.pathname)) return;
|
||||
window.__siteChat = 1;
|
||||
var css = document.createElement('link'); css.rel = 'stylesheet'; css.href = '/assets/chat.css?v=20261115d'; document.head.appendChild(css);
|
||||
var NAME = 'this site', TOPICS = [];
|
||||
var root = document.createElement('div'); root.id = 'scChat';
|
||||
root.innerHTML = '<button id="scBtn" type="button" aria-label="Ask a question" aria-expanded="false">'
|
||||
+ '<svg viewBox="0 0 24 24" width="26" height="26" aria-hidden="true"><path fill="currentColor" d="M4 4h16a2 2 0 0 1 2 2v10a2 2 0 0 1-2 2H9l-5 4v-4a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2zm3 6.5a1.5 1.5 0 1 0 0 .01zm5 0a1.5 1.5 0 1 0 0 .01zm5 0a1.5 1.5 0 1 0 0 .01z"/></svg></button>'
|
||||
+ '<div id="scPanel" role="dialog" aria-label="Questions" hidden>'
|
||||
+ '<div class="sc-head"><div><b class="sc-title" id="scTitle">Ask a question</b><span class="sc-sub">Straight answers about this site and the network</span></div>'
|
||||
+ '<button id="scClose" type="button" aria-label="Close">×</button></div>'
|
||||
+ '<div class="sc-msgs" id="scMsgs" aria-live="polite"></div>'
|
||||
+ '<div class="sc-topics" id="scTopics"></div>'
|
||||
+ '<form class="sc-input" id="scForm"><input id="scIn" autocomplete="off" maxlength="600" placeholder="Type your question" aria-label="Your question">'
|
||||
+ '<button type="submit" id="scSend">Send</button></form>'
|
||||
+ '<a class="sc-human" id="scHuman" href="https://instantadpay.com/support" target="_blank" rel="noopener">Need a person? Open network support</a>'
|
||||
+ '</div>';
|
||||
document.body.appendChild(root);
|
||||
var $ = function (id) { return document.getElementById(id); };
|
||||
var msgs = $('scMsgs'), input = $('scIn'), panel = $('scPanel'), btn = $('scBtn');
|
||||
var history = [], greeted = false, support = 'https://instantadpay.com/support';
|
||||
fetch('/api/chat/config').then(function (r) { return r.json(); }).then(function (c) {
|
||||
if (c.name) { NAME = c.name; $('scTitle').textContent = 'Ask ' + c.name; }
|
||||
if (c.support) { support = c.support; $('scHuman').href = c.support; }
|
||||
TOPICS = c.topics || [];
|
||||
}).catch(function () {});
|
||||
|
||||
function esc(s) { return String(s).replace(/[&<>"]/g, function (c) { return { '&': '&', '<': '<', '>': '>', '"': '"' }[c]; }); }
|
||||
function add(text, who) {
|
||||
var d = document.createElement('div'); d.className = 'sc-m ' + who;
|
||||
d.innerHTML = esc(text).replace(/(https?:\/\/[^\s<]+[^\s<.,;:!?)])/g, '<a href="$1" target="_blank" rel="noopener">$1</a>');
|
||||
msgs.appendChild(d); msgs.scrollTop = msgs.scrollHeight; return d;
|
||||
}
|
||||
function offer(link) {
|
||||
var old = msgs.querySelector('.sc-handoff'); if (old) old.remove();
|
||||
var d = document.createElement('div'); d.className = 'sc-m bot sc-handoff';
|
||||
var a = document.createElement('a'); a.className = 'sc-cta'; a.href = link || support; a.target = '_blank'; a.rel = 'noopener'; a.textContent = 'Open network support';
|
||||
d.appendChild(a); msgs.appendChild(d); msgs.scrollTop = msgs.scrollHeight;
|
||||
}
|
||||
function open() {
|
||||
panel.hidden = false; btn.setAttribute('aria-expanded', 'true'); root.className = 'open';
|
||||
if (!greeted) {
|
||||
greeted = true;
|
||||
add('Hi. Ask me how ' + NAME + ' works, what it costs, how payouts work, or about any other site in the network. Straight answers, no income hype.', 'bot');
|
||||
var t = $('scTopics'); TOPICS.slice(0, 4).forEach(function (q) {
|
||||
var b = document.createElement('button'); b.type = 'button'; b.textContent = q; b.addEventListener('click', function () { input.value = q; send(); }); t.appendChild(b);
|
||||
});
|
||||
}
|
||||
setTimeout(function () { input.focus(); }, 50);
|
||||
}
|
||||
function close() { panel.hidden = true; btn.setAttribute('aria-expanded', 'false'); root.className = ''; }
|
||||
btn.addEventListener('click', function () { panel.hidden ? open() : close(); });
|
||||
$('scClose').addEventListener('click', close);
|
||||
document.addEventListener('keydown', function (e) { if (e.key === 'Escape' && !panel.hidden) close(); });
|
||||
async function send() {
|
||||
var q = input.value.trim(); if (!q) return;
|
||||
input.value = ''; $('scTopics').innerHTML = '';
|
||||
add(q, 'me'); var wait = add('...', 'bot wait');
|
||||
try {
|
||||
var r = await (await fetch('/api/chat', { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ message: q, history: history.slice(-6) }) })).json();
|
||||
wait.remove();
|
||||
add(r.reply || r.error || 'Something went wrong. Try again in a moment.', 'bot');
|
||||
history.push(q, r.reply || '');
|
||||
if (r.handoff) offer(r.support);
|
||||
} catch (e) { wait.remove(); add('I could not reach the assistant just now. Try again in a moment, or open network support.', 'bot'); offer(); }
|
||||
}
|
||||
$('scForm').addEventListener('submit', function (e) { e.preventDefault(); send(); });
|
||||
})();
|
||||
@@ -0,0 +1,143 @@
|
||||
// Shared page helpers (YPB namespace, the network common.js pattern): header, footer (legal, company line, the network line from the
|
||||
// hub), verified visits, seed-packet cards, toasts of real events, the network ad zones, small formatters. The look lives in ypb.css.
|
||||
window.YPB = (function () {
|
||||
let cfgP = null, vt = null;
|
||||
const I = window.YPBI || {};
|
||||
const $ = id => document.getElementById(id);
|
||||
const esc = s => String(s == null ? '' : s).replace(/[&<>"']/g, c => ({ '&': '&', '<': '<', '>': '>', '"': '"', "'": ''' }[c]));
|
||||
const getConfig = () => cfgP || (cfgP = fetch('/api/config').then(r => r.json()));
|
||||
const short = a => a ? a.slice(0, 6) + '...' + a.slice(-4) : '';
|
||||
const framed = (() => { try { return window.top !== window.self; } catch (e) { return true; } })();
|
||||
const n = x => Number(x || 0).toLocaleString('en-US');
|
||||
const pct = bps => (Number(bps || 0) / 100).toFixed(Number(bps) % 100 ? 1 : 0) + '%';
|
||||
const usd = c => '$' + (Number(c || 0) / 100).toFixed(2);
|
||||
const month = t => t ? new Date(t).toLocaleDateString('en-US', { timeZone: 'America/Chicago', month: 'short', day: 'numeric' }).toUpperCase() : '';
|
||||
function status(msg, cls, id) { const el = $(id || 'status'); if (!el) return; el.hidden = !msg; el.className = 'note ' + (cls || ''); el.textContent = msg || ''; if (msg) el.scrollIntoView({ block: 'nearest', behavior: 'smooth' }); }
|
||||
async function getJSON(url, opts) { const r = await fetch(url, opts); let j = {}; try { j = await r.json(); } catch (e) {} if (!r.ok && !j.error) j.error = 'Request failed (' + r.status + ')'; j._status = r.status; return j; }
|
||||
const post = (url, body) => getJSON(url, { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify(body || {}) });
|
||||
const MARK = '<svg width="34" height="34" viewBox="0 0 34 34" aria-hidden="true"><rect x="1" y="1" width="32" height="32" rx="8" fill="var(--leaf)"/><path d="M17 27V15" stroke="var(--paper)" stroke-width="3" stroke-linecap="round"/><path d="M17 17c0-5 4-8 9-8 0 5-4 8-9 8z" fill="var(--butter)"/><path d="M17 20c0-4-3-6-8-6 0 4 3 6 8 6z" fill="var(--paper)"/></svg>';
|
||||
function renderNav(active) {
|
||||
const h = document.createElement('header'); h.className = 'top wrap';
|
||||
const links = [['/', 'Seed Bed'], ['/my?tab=plant', 'Plant a program'], ['/transplanted', 'Transplanted'], ['/spotlight', 'Spotlight'], ['/guides', 'Guides'], ['/my', 'My packets']];
|
||||
h.innerHTML = '<a class="skip" href="#main">Skip to content</a><a class="brand" href="/" aria-label="YourProgramBuilder, the Seed Bed">' + MARK + '<span>YourProgramBuilder</span></a>'
|
||||
+ '<nav class="links" aria-label="Main">' + links.map(l => '<a href="' + l[0] + '"' + (l[0] === active ? ' aria-current="page"' : '') + '>' + l[1] + '</a>').join('') + '</nav>'
|
||||
+ '<a class="signin" id="navSign" href="/my">Sign in with the network</a>';
|
||||
document.body.prepend(h);
|
||||
getConfig().then(c => { if (c.staging) { const b = document.createElement('div'); b.className = 'stage-bar wrap'; b.textContent = 'Staging copy for testing. No payouts, no mail, no contract: nothing here is real money.'; h.after(b); } }).catch(() => {});
|
||||
getJSON('/api/me').then(m => { if (m.signedIn) { const a = $('navSign'); if (a) a.textContent = m.username ? '@' + m.username : short(m.address); } }).catch(() => {});
|
||||
if (framed) document.querySelectorAll('a[href^="/my"]').forEach(a => { a.target = '_blank'; a.rel = 'noopener'; });
|
||||
}
|
||||
// the click relay: placement + the visitor's verified token once their visit has verified (+ the member whose page this is)
|
||||
const goHref = (id, p, r) => '/go/' + id + '?p=' + encodeURIComponent(p || 'site') + (r ? '&r=' + encodeURIComponent(r) : '') + (vt ? '&v=' + vt : '');
|
||||
function decorate() { document.querySelectorAll('a[data-go]').forEach(a => { a.href = goHref(a.dataset.go, a.dataset.p, a.dataset.r); }); }
|
||||
const stageTag = x => x.stage === 'approved' ? '<span class="tag ok">Transplanted</span>' : x.stage === 'review' ? '<span class="tag ok">Ready for review</span>' : '';
|
||||
// a seed packet. o = { place, r (member), spot, extra (html) }
|
||||
function packetCard(x, o) {
|
||||
o = o || {}; const spot = o.spot || !!x.spotlight;
|
||||
const pctv = Math.min(100, Math.round(100 * (x.saves || 0) / (x.need || 25)));
|
||||
const tags = [];
|
||||
if (x.spotlight) tags.push('<span class="tag sp">Spotlight ' + n(x.spotlight.delivered) + ' / ' + n(x.spotlight.views) + ' views</span>');
|
||||
tags.push(stageTag(x));
|
||||
if (x.check === 'green') tags.push('<span class="tag ok">Link checked</span>');
|
||||
tags.push('<span class="tag">' + (x.cost === 'free' ? 'Free to join' : esc(x.costText || 'Paid')) + '</span>');
|
||||
if (x.contract) tags.push('<span class="tag">Contract listed</span>');
|
||||
const by = x.mine ? 'your ID is saved' : x.own ? 'you planted this' : x.stage === 'review' ? 'in Marty\'s review queue' : x.planter ? 'planted by @' + esc(x.planter) : 'sponsor link first';
|
||||
return '<article class="pk' + (spot ? ' spotlit' : '') + '"><div class="fold"></div><div class="body">'
|
||||
+ '<div class="no"><span>PACKET No. ' + esc(x.no) + ' · SOWN ' + esc(month(x.sownAt)) + '</span>' + (I.iconOrganic || '') + '</div>'
|
||||
+ '<div class="meta">' + tags.filter(Boolean).join('') + '</div>'
|
||||
+ '<h3><a href="/p/' + x.id + (o.r ? '?r=' + encodeURIComponent(o.r) : '') + '">' + esc(x.name) + '</a></h3><p>' + esc(x.desc) + '</p>'
|
||||
+ '<div class="meter"><div class="lbl"><span>Saved IDs</span><span>' + n(x.saves) + ' / ' + n(x.need) + '</span></div><div class="bar" role="img" aria-label="' + n(x.saves) + ' of ' + n(x.need) + ' saved IDs"><span style="width:' + pctv + '%"></span></div></div>'
|
||||
+ '<div class="row"><a class="save' + (x.mine ? ' done' : '') + '" href="/p/' + x.id + (o.r ? '?r=' + encodeURIComponent(o.r) : '') + '#save">' + (I.iconSprout || '') + (x.mine ? 'ID saved' : 'Save my ID') + '</a>'
|
||||
+ '<a class="by" data-go="' + x.id + '" data-p="' + esc(o.place || 'card') + '"' + (o.r ? ' data-r="' + esc(o.r) + '"' : '') + ' target="_blank" rel="noopener sponsored nofollow" href="' + goHref(x.id, o.place, o.r) + '">Visit ' + esc(x.host) + '</a></div>'
|
||||
+ (o.extra || '') + '</div></article>';
|
||||
}
|
||||
// the page's data and its verified visit: packets come with a ticket; after visitSeconds of the page being visible the visit is sent once
|
||||
async function wire(page, q) {
|
||||
const src = document.referrer || '';
|
||||
let hunt = /[?&#]ph=/.test(location.search + location.hash); try { hunt = hunt || !!sessionStorage.getItem('ph.token'); } catch (e) {}
|
||||
const d = await getJSON('/api/wire?page=' + encodeURIComponent(page) + (q || '') + (src ? '&src=' + encodeURIComponent(src) : '') + (hunt ? '&hunt=1' : ''));
|
||||
if (d.ticket) {
|
||||
const need = (d.seconds || 6) * 1000; let seen = 0, last = Date.now(), sent = false;
|
||||
const iv = setInterval(async () => {
|
||||
const now = Date.now(); if (document.visibilityState === 'visible') seen += now - last; last = now;
|
||||
if (!sent && seen >= need) { sent = true; clearInterval(iv); const r = await post('/api/visit/seen', { ticket: d.ticket, visibleMs: seen }).catch(() => ({})); if (r.vt) { vt = r.vt; decorate(); } document.dispatchEvent(new CustomEvent('ypb:verified', { detail: r })); }
|
||||
}, 500);
|
||||
document.addEventListener('visibilitychange', () => { last = Date.now(); });
|
||||
}
|
||||
return d;
|
||||
}
|
||||
function spotRow(el, d, r) { if (!el) return; const f = d.spotlights || []; el.hidden = !f.length; if (f.length) el.querySelector('.bed').innerHTML = f.map(x => packetCard(x, { place: 'spot', spot: true, r })).join(''); }
|
||||
const NET = [['iap', 'InstantAdPay', 'https://instantadpay.com'], ['linkspin', 'LinkSpin', 'https://linkspin.app'], ['dlb', 'Downline Banners', 'https://downlinebanners.com'],
|
||||
['vbb', 'Viral Banner Blitz', 'https://viralbannerblitz.com'], ['viraladblitz', 'ViralAdBlitz', 'https://viraladblitz.com'], ['viraladsource', 'ViralAdSource', 'https://viraladsource.com'], ['downlinehydra', 'DownlineHydra', 'https://downlinehydra.com'],
|
||||
['fivex', '5xYourTeam', 'https://5xyourteam.com'], ['stackpol', 'Stack POL', 'https://stackpol.com'], ['earnerscorner', 'Earners Corner', 'https://earnerscorner.com']].map(a => ({ id: a[0], name: a[1], url: a[2] }));
|
||||
const HERE = { id: 'yourprogrambuilder', name: 'YourProgramBuilder', url: 'https://yourprogrambuilder.com' };
|
||||
function netLine(el) {
|
||||
if (!el) return;
|
||||
const paint = list => { el.innerHTML = '<b>Part of the network</b> One account across the network: ' + list.map(s => s.id === 'yourprogrambuilder'
|
||||
? '<span class="here" aria-current="page">' + esc(s.name) + '</span>' : '<a href="' + esc(s.go || s.url) + '" target="_blank" rel="noopener nofollow">' + esc(s.name) + '</a>').join(''); };
|
||||
paint(NET.concat([HERE]));
|
||||
fetch('/api/network-sites').then(r => r.json()).then(l => { if (Array.isArray(l) && l.length) paint(l.some(s => s.id === 'yourprogrambuilder') ? l : l.concat([HERE])); }).catch(() => {});
|
||||
}
|
||||
function renderFooter() {
|
||||
const f = document.createElement('footer'); f.className = 'foot wrap';
|
||||
f.innerHTML = '<p><b>YourProgramBuilder</b> The Seed Bed: bring your program, the network grows it. A directory of programs, not an income opportunity. Nothing is promised.</p>'
|
||||
+ '<p><a href="/">Seed Bed</a><a href="/my?tab=plant">Plant a program</a><a href="/transplanted">Transplanted</a><a href="/spotlight">Spotlight</a><a href="/promote">Promote</a><a href="/guides">Guides</a><a href="/guides/faq">FAQ</a></p>'
|
||||
+ '<p class="netline"></p>'
|
||||
+ '<p>© 2026 TrustClickz <a href="/terms">Terms</a><a href="/disclaimer">Earnings disclaimer</a><a href="/privacy">Privacy</a><a href="/contract">Contract</a><a href="/ledger">Ledger</a><a href="https://instantadpay.com/support?from=yourprogrambuilder" target="_blank" rel="noopener">Support</a></p>';
|
||||
document.body.appendChild(f);
|
||||
netLine(f.querySelector('.netline'));
|
||||
toasts();
|
||||
}
|
||||
let toastsOn = false;
|
||||
function toasts() {
|
||||
if (toastsOn || /^\/admin/.test(location.pathname)) return; toastsOn = true;
|
||||
const seen = new Set(); let first = true;
|
||||
const box = document.createElement('div'); box.className = 'toasts'; box.setAttribute('aria-live', 'polite'); document.body.appendChild(box);
|
||||
const who = c => c.name ? '@' + esc(c.name) : 'A member';
|
||||
const show = c => {
|
||||
const el = document.createElement('a'); el.className = 'toast';
|
||||
if (c.kind === 'spotlight') { el.href = '/ledger'; el.innerHTML = '<b>' + who(c) + ' spotlighted ' + esc(c.packet || 'a packet') + '</b><br><span>split on chain by the contract</span>'; }
|
||||
else if (c.kind === 'save') { el.href = '/p/' + c.id; el.innerHTML = '<b>' + who(c) + ' saved an ID</b><br><span>in ' + esc(c.packet) + '</span>'; }
|
||||
else if (c.kind === 'review') { el.href = '/p/' + c.id; el.innerHTML = '<b>' + esc(c.packet) + ' is ready for review</b><br><span>enough members saved an ID</span>'; }
|
||||
else { el.href = '/p/' + c.id; el.innerHTML = '<b>' + who(c) + ' planted a program</b><br><span>' + esc(c.packet) + '</span>'; }
|
||||
box.appendChild(el); requestAnimationFrame(() => el.classList.add('in'));
|
||||
setTimeout(() => { el.classList.remove('in'); setTimeout(() => el.remove(), 400); }, 7000);
|
||||
};
|
||||
const tick = async () => {
|
||||
const d = await getJSON('/api/recent').catch(() => null); const all = (d && d.items) || [];
|
||||
const fresh = all.filter(c => !seen.has(c.key)); all.forEach(c => seen.add(c.key));
|
||||
const list = first ? fresh.slice(0, 1) : fresh.reverse(); first = false;
|
||||
list.slice(0, 3).forEach((c, i) => setTimeout(() => show(c), 1500 + i * 8000));
|
||||
};
|
||||
tick(); setInterval(tick, 25000);
|
||||
}
|
||||
const polOf = (w, d) => { try { const k = BigInt(w || 0); const v = Number(k / 10n ** 12n) / 1e6; return v.toFixed(d != null ? d : (v >= 100 ? 2 : 4)); } catch (e) { return '0'; } };
|
||||
const when = t => t ? new Date(t).toLocaleString('en-US', { timeZone: 'America/Chicago', month: 'short', day: 'numeric', hour: 'numeric', minute: '2-digit' }) + ' CT' : '';
|
||||
async function copy(text, btn) { try { await navigator.clipboard.writeText(text); if (btn) { const o = btn.textContent; btn.textContent = 'Copied'; setTimeout(() => { btn.textContent = o; }, 1600); } } catch (e) { if (btn) { btn.textContent = 'Select the text to copy it'; } } }
|
||||
return { I, MARK, $, esc, getConfig, short, framed, status, getJSON, post, n, pct, usd, month, renderNav, renderFooter, packetCard, wire, spotRow, decorate, goHref, polOf, when, copy };
|
||||
})();
|
||||
// every page: header, footer and the numbers from /api/config
|
||||
(function () {
|
||||
const boot = () => {
|
||||
YPB.renderNav(document.body.dataset.nav || ''); YPB.renderFooter();
|
||||
document.querySelectorAll('[data-icon]').forEach(el => { const svg = YPB.I[el.dataset.icon]; if (svg) el.outerHTML = svg; });
|
||||
YPB.getConfig().then(c => {
|
||||
const lv = (c.split || {}).levelBps || []; const sp = c.spotlight || {};
|
||||
const V = { need: String(c.reviewSaves), spotUsd: '$' + sp.usd, spotViews: YPB.n(sp.views), sponsor: YPB.pct(lv[0]), levels: lv.slice(1).map(YPB.pct).join(' / '), lvlEach: YPB.pct(lv[1]),
|
||||
company: YPB.pct(10000 - lv.reduce((t, x) => t + x, 0)), recheck: String(c.recheckHours), deliverDays: String(sp.deliverDays), quota: String(c.plantQuota) };
|
||||
document.querySelectorAll('[data-cfg]').forEach(el => { const k = el.dataset.cfg; if (V[k] != null) el.textContent = V[k]; });
|
||||
// network ad zones (the ViralAdSource pattern): LinkSpin zones on Marty's LinkSpin account, ids from LS_ZONES (none until made)
|
||||
const Z = c.zones || {}; if (!Z.footWide || /^\/admin/.test(location.pathname) || document.body.dataset.noZones) return;
|
||||
const zone = (el, id) => { el.className = 'net-zone'; el.style.cssText = 'margin:18px auto;text-align:center;max-width:100%'; el.innerHTML = '<div style="font-size:11px;letter-spacing:1px;opacity:.7;margin-bottom:4px">Network</div>'; const s = document.createElement('script'); s.async = true; s.src = 'https://linkspin.app/z.js'; s.setAttribute('data-zone', id); el.appendChild(s); };
|
||||
const za = document.createElement('div'); document.querySelector('footer.foot').before(za); zone(za, window.innerWidth >= 760 ? Z.footWide : (Z.footPhone || Z.footWide));
|
||||
if (location.pathname === '/ledger' && Z.ledger) { const d = document.createElement('div'); const t = document.getElementById('ledgerBox'); if (t) { t.after(d); zone(d, Z.ledger); } }
|
||||
}).catch(() => {});
|
||||
};
|
||||
if (document.readyState === 'loading') document.addEventListener('DOMContentLoaded', boot); else boot();
|
||||
})();
|
||||
// Network Weekend ribbon: netweekend.js paints it only while a network event is live (dates from the hub through /api/network-deals)
|
||||
(function () {
|
||||
if (/^\/admin/.test(location.pathname)) return;
|
||||
try { if (window.top !== window) return; } catch (e) { return; }
|
||||
var s = document.createElement('script'); s.src = '/assets/netweekend.js?v=20261117'; s.defer = true; s.setAttribute('data-site', 'yourprogrambuilder'); document.head.appendChild(s);
|
||||
})();
|
||||
@@ -0,0 +1,20 @@
|
||||
// The Seed Bed (front page): the Spotlight row, the bed of packets with its filters, the verified visit, the PolHunter slot.
|
||||
(async function () {
|
||||
const $ = YPB.$;
|
||||
let d = { bed: [] };
|
||||
try { d = await YPB.wire('front'); } catch (e) {}
|
||||
YPB.spotRow($('spots'), d);
|
||||
const bed = d.bed || [];
|
||||
let f = 'all';
|
||||
const keep = x => f === 'all' || (f === 'sprouting' && x.stage === 'sprouting') || (f === 'review' && x.stage === 'review') || (f === 'free' && x.cost === 'free') || (f === 'crypto' && !!x.contract);
|
||||
const paint = () => {
|
||||
const l = bed.filter(keep);
|
||||
$('bedList').innerHTML = l.length ? l.map(x => YPB.packetCard(x, { place: 'bed' })).join('')
|
||||
: '<p class="empty">' + (bed.length ? 'No packet matches that filter yet.' : 'The Seed Bed is ready for its first program. <a href="/my?tab=plant">Plant yours, free</a>.') + '</p>';
|
||||
YPB.decorate();
|
||||
};
|
||||
document.querySelectorAll('.filters .chip').forEach(b => { b.onclick = () => { f = b.dataset.f; document.querySelectorAll('.filters .chip').forEach(x => x.setAttribute('aria-pressed', String(x === b))); paint(); }; });
|
||||
paint();
|
||||
// PolHunter embed (the network pattern): the find code hides in one of the three steps. The mission is added in polhunter.com/admin at go-live.
|
||||
const ph = document.createElement('script'); ph.async = true; ph.src = 'https://polhunter.com/embed.js'; ph.setAttribute('data-slots', '3'); ph.setAttribute('data-selector', '#how .step'); document.body.appendChild(ph);
|
||||
})();
|
||||
File diff suppressed because one or more lines are too long
@@ -0,0 +1,14 @@
|
||||
// A member's page (/<username>): the packets they planted or saved an ID in, each opening with their link (the ref tag is set by the server).
|
||||
(async function () {
|
||||
const $ = YPB.$, esc = YPB.esc;
|
||||
const name = decodeURIComponent(location.pathname.slice(1).replace(/\/$/, ''));
|
||||
const d = await YPB.wire('member', '&u=' + encodeURIComponent(name)).catch(() => ({ error: 'x' }));
|
||||
if (d.error || !d.member) { $('mList').innerHTML = '<p class="empty">' + esc(d.error || 'No network member by that name.') + '</p>'; return; }
|
||||
const m = d.member;
|
||||
$('mTitle').textContent = '@' + m.username + '\'s programs';
|
||||
document.title = '@' + m.username + '\'s programs | YourProgramBuilder';
|
||||
if (d.joinUrl) $('mJoin').href = d.joinUrl;
|
||||
$('mList').innerHTML = m.packets.length ? m.packets.map(x => YPB.packetCard(x, { place: 'member', r: m.username })).join('') : '<p class="empty">@' + esc(m.username) + ' has not saved an ID in the Seed Bed yet. <a href="/">Browse the Seed Bed</a>.</p>';
|
||||
YPB.spotRow($('spots'), d, m.username);
|
||||
YPB.decorate();
|
||||
})();
|
||||
@@ -0,0 +1,98 @@
|
||||
// My packets (the member dashboard): sign in (network account through the hub, or wallet), my packet (status, link check, sprout
|
||||
// meter, edit / remove), dormant old programs to confirm, the planting form with the AI writer, my saved IDs, Spotlights and earnings.
|
||||
(async function () {
|
||||
const $ = YPB.$, esc = YPB.esc;
|
||||
YPB.wire('other').catch(() => {});
|
||||
const c = await YPB.getConfig().catch(() => ({}));
|
||||
const me = await YPB.getJSON('/api/me');
|
||||
const qs = new URLSearchParams(location.search);
|
||||
if (!me.signedIn) {
|
||||
try { const ss = await YPB.getJSON('/api/sso/status'); if (ss && ss.check) { location.replace('/sso/start?mode=check&to=' + encodeURIComponent(location.pathname + location.search)); return; } } catch (e) {}
|
||||
$('signin').hidden = false; if (c.joinUrl) $('joinLink').href = c.joinUrl;
|
||||
$('walletBtn').onclick = async () => {
|
||||
try { YPB.status('Check your wallet for the sign-in message.', '', 'status'); await YPBWallet.signIn(); location.reload(); }
|
||||
catch (e) { YPB.status(String(e && e.message || e).slice(0, 300), 'err'); }
|
||||
};
|
||||
return;
|
||||
}
|
||||
$('dash').hidden = false;
|
||||
$('logout').onclick = async () => { await YPB.post('/api/auth/logout'); location.reload(); };
|
||||
$('logoutAll').onclick = async () => { $('logoutAll').disabled = true; await YPB.post('/api/auth/logout-everywhere'); location.reload(); };
|
||||
const tabs = document.querySelectorAll('[data-tab]');
|
||||
const show = t => { tabs.forEach(b => b.setAttribute('aria-pressed', String(b.dataset.tab === t))); document.querySelectorAll('[data-pane]').forEach(p => { p.hidden = p.dataset.pane !== t; }); };
|
||||
tabs.forEach(b => { b.onclick = () => show(b.dataset.tab); });
|
||||
show(['plant', 'saved', 'spot'].includes(qs.get('tab')) ? qs.get('tab') : 'packets');
|
||||
(c.cats || []).forEach(k => { const o = document.createElement('option'); o.value = k.id; o.textContent = k.name; $('cat').appendChild(o); });
|
||||
$('cat').value = '0';
|
||||
const costPicked = () => document.querySelector('input[name=cost]:checked').value;
|
||||
document.querySelectorAll('input[name=cost]').forEach(r => { r.onchange = () => { $('costRow').hidden = costPicked() !== 'paid'; }; });
|
||||
|
||||
let d = null;
|
||||
const CHECK = { green: '<span class="tag ok">Link check green</span>', yellow: '<span class="tag warn">Link check yellow: waiting for a person</span>', red: '<span class="tag bad">Link check red: not shown</span>' };
|
||||
const stageTag = x => x.stage === 'review' ? '<span class="tag ok">In review</span>' : x.stage === 'approved' ? '<span class="tag ok">Transplanted</span>' : x.stage === 'rejected' ? '<span class="tag">Not added this time</span>' : '';
|
||||
function packetBox(x) {
|
||||
const pctv = Math.min(100, Math.round(100 * x.saves / x.need));
|
||||
const notes = x.check && x.check.why && x.check.why.length ? '<p class="muted" style="font-size:14px">Check notes: ' + esc(x.check.why.join('; ')) + '</p>' : '';
|
||||
return '<div class="panel" style="border-width:1.5px;margin-top:10px">'
|
||||
+ '<div class="row" style="justify-content:space-between"><h3 style="font-size:22px">' + (x.status === 'live' ? '<a href="/p/' + x.id + '">' + esc(x.name) + '</a>' : esc(x.name)) + '</h3><span class="mono" style="font-size:12px">PACKET No. ' + esc(x.no) + '</span></div>'
|
||||
+ '<p class="meta" style="margin:8px 0">' + (CHECK[x.check && x.check.state] || '') + (x.status === 'held' ? '<span class="tag warn">Held' + (x.heldWhy ? ': ' + esc(x.heldWhy) : '') + '</span>' : '') + stageTag(x) + '</p>'
|
||||
+ notes + (x.decidedNote ? '<p class="muted" style="font-size:14px">Note: ' + esc(x.decidedNote) + '</p>' : '')
|
||||
+ '<div class="meter"><div class="lbl"><span>Saved IDs</span><span>' + YPB.n(x.saves) + ' / ' + YPB.n(x.need) + '</span></div><div class="bar"><span style="width:' + pctv + '%"></span></div></div>'
|
||||
+ '<p class="muted" style="font-size:14px;margin-top:8px">' + YPB.n(x.views) + ' verified views, ' + YPB.n(x.clicks) + ' verified clicks' + (x.spotlight ? ', Spotlight ' + YPB.n(x.spotlight.delivered) + ' / ' + YPB.n(x.spotlight.views) + ' views' : '') + '</p>'
|
||||
+ '<div class="row"><button class="btn sm" type="button" data-edit="' + x.id + '">Edit</button>' + (x.stage !== 'approved' ? '<button class="btn sm" type="button" data-remove="' + x.id + '">Remove</button>' : '') + (x.status === 'live' ? '<a class="btn sm" href="/spotlight?p=' + x.id + '">Spotlight it</a>' : '') + '</div></div>';
|
||||
}
|
||||
async function load() {
|
||||
d = await YPB.getJSON('/api/my');
|
||||
if (d.error) return YPB.status(d.error, 'err');
|
||||
$('who').innerHTML = 'Signed in as ' + (d.username ? '<b>@' + esc(d.username) + '</b>' : esc(YPB.short(d.address))) + (d.netVerified ? ', network member' : ', <a href="' + esc(d.joinUrl) + '">join the network free</a> to plant and save IDs') + (d.test ? ' (staging test member)' : '');
|
||||
$('myStats').innerHTML = [['Packets planted', d.packets.length], ['IDs saved', d.saved.length], ['Clicks to my links', d.saved.reduce((t, s) => t + (s.clicks || 0), 0)], ['Spotlights bought', d.spotlights.length]].map(s => '<div class="stat"><b>' + YPB.n(s[1]) + '</b><span>' + s[0] + '</span></div>').join('');
|
||||
if (d.page) { $('pageBox').hidden = false; $('pageUrl').textContent = d.page; $('copyPage').onclick = e => YPB.copy(d.page, e.target); }
|
||||
$('myPackets').innerHTML = d.packets.length ? d.packets.map(packetBox).join('') : '<p class="muted">Nothing planted yet. <a href="/my?tab=plant" data-go-tab="plant">Plant a program</a>.</p>';
|
||||
document.querySelectorAll('[data-go-tab]').forEach(a => { a.onclick = e => { e.preventDefault(); show(a.dataset.goTab); }; });
|
||||
document.querySelectorAll('[data-edit]').forEach(b => { b.onclick = () => edit(d.packets.find(x => x.id === Number(b.dataset.edit))); });
|
||||
document.querySelectorAll('[data-remove]').forEach(b => { b.onclick = async () => { b.disabled = true; const r = await YPB.post('/api/my/packet/remove', { id: Number(b.dataset.remove) }); if (r.error) { b.disabled = false; return YPB.status(r.error, 'err'); } load(); }; });
|
||||
if (d.dormant && d.dormant.length) {
|
||||
$('dormant').hidden = false;
|
||||
$('dormant').innerHTML = '<b>Your programs from the old YourProgramBuilder</b><br>' + d.dormant.map(x => esc(x.name) + ' <span class="muted">(' + esc(x.url) + ')</span> <button class="btn sm" type="button" data-dorm="' + x.id + '">Confirm it</button>').join('<br>')
|
||||
+ '<p class="muted" style="font-size:14px;margin:8px 0 0">Confirming opens the planting form with your old link: put {id} where your ID goes, then plant it. It counts as your packet.</p>';
|
||||
document.querySelectorAll('[data-dorm]').forEach(b => { b.onclick = () => { const x = d.dormant.find(y => y.id === Number(b.dataset.dorm)); reset(); $('dormantId').value = x.id; $('url').value = x.url; $('name').value = x.name; $('plantTitle').textContent = 'Confirm your old program'; show('plant'); }; });
|
||||
} else $('dormant').hidden = true;
|
||||
$('savedRows').innerHTML = d.saved.length ? d.saved.map(s => '<tr><td>' + (s.shown ? '<a href="/p/' + s.packetId + '">' + esc(s.name) + '</a>' : esc(s.name) + ' <span class="muted">(not shown now)</span>') + '</td><td class="mono">' + esc(s.refId) + '</td><td class="n">' + YPB.n(s.saves) + '</td><td class="n">' + YPB.n(s.clicks) + '</td><td>' + esc(s.stage) + '</td></tr>').join('')
|
||||
: '<tr><td colspan="5" class="muted">Open any packet in the <a href="/#bed">Seed Bed</a> and tap Save my ID.</td></tr>';
|
||||
$('spotRows').innerHTML = d.spotlights.length ? d.spotlights.map(b => '<tr><td>' + esc(YPB.when(b.at)) + '</td><td>Packet ' + esc(b.packetId || '?') + '</td><td class="n">' + YPB.n(b.delivered) + ' / ' + YPB.n(b.views) + '</td><td>' + esc(b.status) + '</td></tr>').join('') : '<tr><td colspan="4" class="muted">No Spotlights bought yet.</td></tr>';
|
||||
$('earnStats').innerHTML = '<div class="stat"><b>' + YPB.polOf(d.earned.wei) + '</b><span>POL paid to you by Spotlights</span></div>';
|
||||
$('earnRows').innerHTML = d.earned.items.length ? d.earned.items.map(i => '<tr><td>' + esc(YPB.when(i.at)) + '</td><td>Level ' + i.kind + '</td><td class="n">' + YPB.polOf(i.wei) + ' POL' + (i.failed ? ' (waiting to claim)' : '') + '</td><td>' + (i.buyerName ? '@' + esc(i.buyerName) : '') + '</td></tr>').join('') : '<tr><td colspan="4" class="muted">Nothing yet. Nothing is promised.</td></tr>';
|
||||
}
|
||||
function reset() { $('plantForm').reset(); $('editId').value = ''; $('dormantId').value = ''; $('cancelEdit').hidden = true; $('costRow').hidden = true; $('plantTitle').textContent = 'Plant a program'; $('plantBtn').textContent = 'Plant it'; $('cat').value = '0'; }
|
||||
function edit(x) {
|
||||
reset(); $('editId').value = x.id; $('url').value = x.url; $('myId').value = x.ownerId || ''; $('name').value = x.name; $('desc').value = x.desc;
|
||||
document.querySelector('input[name=cost][value=' + (x.cost === 'paid' ? 'paid' : 'free') + ']').checked = true; $('costRow').hidden = x.cost !== 'paid'; $('costText').value = x.costText || '';
|
||||
$('contract').value = x.contract || ''; $('cat').value = x.cat || '0'; $('plantTitle').textContent = 'Edit packet No. ' + x.no; $('plantBtn').textContent = 'Save the changes'; $('cancelEdit').hidden = false; show('plant');
|
||||
}
|
||||
$('cancelEdit').onclick = () => { reset(); show('packets'); };
|
||||
$('plantForm').onsubmit = async e => {
|
||||
e.preventDefault(); $('plantBtn').disabled = true; YPB.status('Checking your link...', '');
|
||||
const body = { id: $('editId').value || undefined, dormant: $('dormantId').value || undefined, url: $('url').value.trim(), myId: $('myId').value.trim(), name: $('name').value, desc: $('desc').value,
|
||||
cost: costPicked(), costText: $('costText').value, contract: $('contract').value.trim(), cat: $('cat').value };
|
||||
const r = await YPB.post('/api/my/plant', body); $('plantBtn').disabled = false;
|
||||
if (r.error) { YPB.status(r.error, 'err'); const f = r.field && $(r.field); if (f && f.focus) f.focus(); return; }
|
||||
const pk = r.packet; const no = String(pk.id).padStart(3, '0');
|
||||
YPB.status(pk.check === 'green' ? 'Planted. Packet No. ' + no + ' is in the Seed Bed now.' : 'Planted. Packet No. ' + no + ' waits for a person to look at it first (' + pk.why.join('; ') + ').', pk.check === 'green' ? 'ok' : 'warn');
|
||||
reset(); await load();
|
||||
};
|
||||
// the AI writer (through the hub): a name and a one-sentence description from the program's own page; picking one fills the form
|
||||
if (c.aiWriter) {
|
||||
$('aiBox').hidden = false;
|
||||
$('aiWrite').onclick = async () => {
|
||||
const box = $('aiList'), url = $('url').value.trim();
|
||||
if (!/^https?:\/\//i.test(url)) { box.innerHTML = '<p class="note err">Put your referral link in the first box first.</p>'; return; }
|
||||
$('aiWrite').disabled = true; box.innerHTML = '<p class="muted" style="margin:8px 0 0">Reading the program page...</p>';
|
||||
const r = await YPB.post('/api/my/adwriter', { url }); $('aiWrite').disabled = false;
|
||||
if (r.error) { box.innerHTML = '<p class="note err">' + esc(r.error) + '</p>'; return; }
|
||||
box.innerHTML = r.options.map((o, i) => '<button type="button" class="btn sm" style="margin:8px 8px 0 0;text-align:left" data-ai="' + i + '"><b>' + esc(o.headline) + '</b>' + (o.line ? ': ' + esc(o.line) : '') + '</button>').join('')
|
||||
+ '<p class="muted" style="font-size:13px;margin:8px 0 0">' + (r.left != null ? r.left + ' writes left today. ' : '') + 'Pick one, then change any words you like.</p>';
|
||||
box.querySelectorAll('[data-ai]').forEach(b => { b.onclick = () => { const o = r.options[Number(b.dataset.ai)]; $('name').value = String(o.headline || '').slice(0, 40); if (o.line) $('desc').value = String(o.line).slice(0, 200); }; });
|
||||
};
|
||||
}
|
||||
await load();
|
||||
})();
|
||||
@@ -0,0 +1,67 @@
|
||||
// "Network Weekend" ribbon (Marty 2026-11-17): a thin bar at the top of every network site page while a network event is live.
|
||||
// Data: /api/network-deals (netdeals.js, from the hub). Switches on and off by this page's own clock at the event's exact
|
||||
// startsAt / endsAt (US Central midnights), so a cached feed never shows it early or late, and it takes itself down at endsAt on
|
||||
// a page left open. Shows this site's own deal for today (byDay, Central date) and links to the full deals page.
|
||||
// The same file lives in every network site. Never RM Circle, never the games. No inline styles (CSP): styles go through CSSOM.
|
||||
// Test clock: window.__NW_NOW (ms) before this script runs; nothing else.
|
||||
(function () {
|
||||
if (window.__nwRibbon) return; window.__nwRibbon = 1;
|
||||
var tag = document.currentScript;
|
||||
var meAttr = (tag && tag.getAttribute('data-site')) || '';
|
||||
function now() { return typeof window.__NW_NOW === 'number' ? window.__NW_NOW : Date.now(); }
|
||||
// late November is CST (UTC-6) for every date this ribbon covers
|
||||
function ctDay(ms) { return new Date(ms - 6 * 3600 * 1000).toISOString().slice(0, 10); }
|
||||
function closedKey(id, day) { return 'nw.closed.' + id + '.' + day; }
|
||||
function isClosed(id, day) { try { return window.localStorage.getItem(closedKey(id, day)) === '1'; } catch (e) { return false; } }
|
||||
function setClosed(id, day) { try { window.localStorage.setItem(closedKey(id, day), '1'); } catch (e) {} }
|
||||
var bar = null;
|
||||
function remove() { if (bar && bar.parentNode) bar.parentNode.removeChild(bar); bar = null; }
|
||||
function paint(body) {
|
||||
var me = meAttr || (body && body.self) || '';
|
||||
var t = now();
|
||||
var ev = ((body && body.events) || []).filter(function (e) { return t >= Date.parse(e.startsAt) && t < Date.parse(e.endsAt); })[0];
|
||||
if (!ev) { remove(); return false; }
|
||||
var day = ctDay(t);
|
||||
if (isClosed(ev.id, day)) { remove(); return true; }
|
||||
var mine = (ev.deals || []).filter(function (d) { return d.site === me && t < Date.parse(d.endsAt || ev.endsAt); })[0];
|
||||
var line = mine ? ((mine.byDay && mine.byDay[day]) || mine.text) : '';
|
||||
var label = (ev.days && ev.days[day]) || '';
|
||||
var onDealsPage = !!ev.url && (function () { try { var u = new URL(ev.url); return location.pathname === u.pathname && (location.hostname === u.hostname || me === 'iap'); } catch (e) { return false; } })();
|
||||
remove();
|
||||
bar = document.createElement('div');
|
||||
bar.className = 'nw-ribbon'; bar.setAttribute('role', 'region'); bar.setAttribute('aria-label', ev.name);
|
||||
bar.style.cssText = 'position:relative;z-index:50;display:flex;flex-wrap:wrap;gap:4px 12px;align-items:center;justify-content:center;padding:8px 40px 8px 16px;'
|
||||
+ 'background:#14161b;color:#f4f1e8;font:600 13.5px/1.4 system-ui,-apple-system,"Segoe UI",Roboto,sans-serif;text-align:center;border-bottom:2px solid #f2c94c';
|
||||
// built node by node with CSSOM styles: no style attributes, so a strict CSP (style-src 'self') has nothing to block
|
||||
function el(tagName, css, text) { var n = document.createElement(tagName); if (css) n.style.cssText = css; if (text) n.textContent = text; return n; }
|
||||
var head = el('span'); head.appendChild(el('b', 'color:#f2c94c', ev.name)); if (label) head.appendChild(document.createTextNode(' · ' + label));
|
||||
bar.appendChild(head);
|
||||
var body2 = el('span', 'font-weight:500', line || ev.tagline);
|
||||
if (line && mine && mine.note) { body2.appendChild(document.createTextNode(' ')); body2.appendChild(el('span', 'opacity:.75', mine.note)); }
|
||||
bar.appendChild(body2);
|
||||
if (ev.url && !onDealsPage) { var a = el('a', 'color:#f2c94c;text-decoration:underline', 'See every deal'); a.href = ev.url; a.target = '_blank'; a.rel = 'noopener'; bar.appendChild(a); }
|
||||
var x = el('button', 'position:absolute;right:8px;top:50%;transform:translateY(-50%);background:none;border:0;color:#f4f1e8;font-size:18px;line-height:1;cursor:pointer;padding:4px 8px', '×');
|
||||
x.type = 'button'; x.setAttribute('aria-label', 'Hide for today'); bar.appendChild(x);
|
||||
bar.querySelector('button').addEventListener('click', function () { setClosed(ev.id, day); remove(); });
|
||||
document.body.insertBefore(bar, document.body.firstChild);
|
||||
return true;
|
||||
}
|
||||
var feed = null, timer = null;
|
||||
function schedule() {
|
||||
clearTimeout(timer); if (!feed) return;
|
||||
// wake at the next switch moment (start, end, a deal ending, the next Central midnight), at least once a minute
|
||||
var t = now(), next = t + 60 * 1000;
|
||||
(feed.events || []).forEach(function (e) {
|
||||
[e.startsAt, e.endsAt].concat((e.deals || []).map(function (d) { return d.endsAt; })).forEach(function (s) { var x = Date.parse(s); if (x > t && x < next) next = x; });
|
||||
});
|
||||
timer = setTimeout(function () { if (typeof window.__NW_NOW === 'number') window.__NW_NOW += next - t; paint(feed); schedule(); }, Math.max(250, next - t));
|
||||
}
|
||||
function run() {
|
||||
fetch('/api/network-deals', { credentials: 'omit' }).then(function (r) { return r.ok ? r.json() : null; }).then(function (b) {
|
||||
if (!b || !Array.isArray(b.events) || !b.events.length) return;
|
||||
feed = b; paint(b); schedule();
|
||||
}).catch(function () {});
|
||||
}
|
||||
if (document.readyState === 'loading') document.addEventListener('DOMContentLoaded', run); else run();
|
||||
window.__nwPaint = function (b) { feed = b; return paint(b); }; // tests
|
||||
})();
|
||||
@@ -0,0 +1,40 @@
|
||||
// A packet: the card, Save my ID (network members), whose link a visitor gets, the report button, recent savers, the Spotlight strip.
|
||||
(async function () {
|
||||
const $ = YPB.$, esc = YPB.esc;
|
||||
const id = Number((location.pathname.match(/^\/p\/(\d+)/) || [])[1]);
|
||||
const c = await YPB.getConfig().catch(() => ({}));
|
||||
const d = await YPB.wire('packet', '&id=' + id).catch(() => ({ error: 'x' }));
|
||||
if (d.error || !d.packet) { $('pk').innerHTML = '<p class="note err">' + esc(d.error || 'That packet is not in the Seed Bed right now.') + '</p>'; return; }
|
||||
const x = d.packet;
|
||||
document.title = x.name + ' | YourProgramBuilder';
|
||||
$('pk').innerHTML = YPB.packetCard(x, { place: 'packet', extra: '<p style="font-size:13px">Link checked ' + esc(YPB.when(x.checkedAt)) + '. Planted ' + esc(YPB.when(x.sownAt)) + (x.planter ? ' by @' + esc(x.planter) : '') + '. ' + YPB.n(x.clicks) + ' verified clicks.' + (x.contract ? ' Contract: <span class="mono">' + esc(x.contract) + '</span>' + (c.explorer ? ' (<a href="' + esc(c.explorer) + '/address/' + esc(x.contract) + '" target="_blank" rel="noopener">look it up</a>)' : '') : '') + '</p>' });
|
||||
const who = x.linkFallback === null ? '@' + esc(x.linkBy) + '\'s link (the nearest person in your line who saved an ID).' : x.linkFallback === 'planter' ? 'The planter\'s link' + (x.linkBy ? ' (@' + esc(x.linkBy) + ')' : '') + ': nobody in your line has saved an ID yet.' : 'The program\'s home page: no ID saved yet.';
|
||||
$('linkWho').innerHTML = 'You get ' + who;
|
||||
$('visitBtn').dataset.go = x.id; $('visitBtn').dataset.p = 'packet'; $('visitBtn').href = YPB.goHref(x.id, 'packet');
|
||||
YPB.decorate();
|
||||
if (x.recent && x.recent.length) { $('savers').hidden = false; $('saverList').textContent = x.recent.map(n => '@' + n).join(', '); }
|
||||
YPB.spotRow($('spots'), d);
|
||||
const me = await YPB.getJSON('/api/me');
|
||||
if (!me.signedIn) { $('saveSignin').hidden = false; if (c.joinUrl) $('joinLink').href = c.joinUrl; $('saveSignin').querySelector('a').href = '/sso/start?mode=go&to=' + encodeURIComponent(location.pathname); }
|
||||
else if (x.own) { $('save').querySelector('p').textContent = 'You planted this packet: your ID is the planter\'s ID. Change it on My packets.'; }
|
||||
else {
|
||||
$('saveForm').hidden = false;
|
||||
$('idHint').textContent = 'letters, numbers and . _ - @ + only';
|
||||
if (d.mySave) { $('refId').value = d.mySave.refId; $('track').checked = d.mySave.track; $('removeBtn').hidden = false; $('saveBtn').textContent = 'Update my ID'; }
|
||||
const send = async refId => {
|
||||
YPB.status('Saving...', '');
|
||||
const r = await YPB.post('/api/my/save', { packetId: x.id, refId, track: $('track').checked });
|
||||
if (r.error) return YPB.status(r.error + (r.join ? ' ' : ''), 'err');
|
||||
if (r.removed) { YPB.status('Your ID was removed from this packet.', 'ok'); $('removeBtn').hidden = true; $('refId').value = ''; return; }
|
||||
YPB.status('Saved. Your link: ' + r.link + '. This packet has ' + r.saves + ' of ' + r.need + ' saved IDs' + (r.review ? ' and is now in the review queue.' : '.'), 'ok');
|
||||
$('removeBtn').hidden = false; $('saveBtn').textContent = 'Update my ID';
|
||||
};
|
||||
$('saveForm').onsubmit = e => { e.preventDefault(); send($('refId').value.trim()); };
|
||||
$('removeBtn').onclick = () => send('');
|
||||
}
|
||||
$('reportForm').onsubmit = async e => {
|
||||
e.preventDefault();
|
||||
const r = await YPB.post('/api/report', { packetId: x.id, reason: $('reason').value, note: $('reportNote').value });
|
||||
YPB.status(r.error || (r.already ? 'You already reported this packet. Thank you.' : 'Thank you. A person will look at it.'), r.error ? 'err' : 'ok', 'reportStatus');
|
||||
};
|
||||
})();
|
||||
@@ -0,0 +1,50 @@
|
||||
// The small pages: transplanted, ledger, contract, promote (one file; each part runs only on its own page).
|
||||
(async function () {
|
||||
const $ = YPB.$, esc = YPB.esc, path = location.pathname.replace(/\/$/, '');
|
||||
const c = await YPB.getConfig().catch(() => ({}));
|
||||
if (path === '/transplanted') {
|
||||
const d = await YPB.getJSON('/api/transplanted');
|
||||
$('inReview').textContent = d.inReview ? d.inReview + ' more ' + (d.inReview === 1 ? 'packet is' : 'packets are') + ' in review now.' : '';
|
||||
$('tList').innerHTML = (d.items || []).length ? d.items.map(x => YPB.packetCard(x, { place: 'transplanted' })).join('') : '<p class="empty">Nothing transplanted yet. The first packet to reach ' + YPB.n(c.reviewSaves) + ' saved IDs goes to review.</p>';
|
||||
YPB.decorate(); return;
|
||||
}
|
||||
if (path === '/ledger') {
|
||||
const d = await YPB.getJSON('/api/ledger?n=100');
|
||||
const t = d.totals || {};
|
||||
$('ledgerStats').innerHTML = [['Spotlights', YPB.n(t.spotlights)], ['Paid in, USD', YPB.usd(t.usdCents)], ['Paid in, POL', YPB.polOf(t.weiPaid)], ['Paid to sponsor lines, POL', YPB.polOf(t.levelsWei)]].map(s => '<div class="stat"><b>' + s[1] + '</b><span>' + s[0] + '</span></div>').join('');
|
||||
const who = (n, a) => n ? '@' + esc(n) : esc(YPB.short(a));
|
||||
$('rows').innerHTML = (d.items || []).length ? d.items.map(x => '<tr><td>' + esc(YPB.when(x.at)) + (d.explorer ? '<br><a href="' + esc(d.explorer) + '/tx/' + esc(x.tx) + '" target="_blank" rel="noopener">tx</a>' : '') + '</td><td>' + who(x.buyerName, x.buyer) + '</td><td>' + (x.packet ? '<a href="/p/' + x.packet.id + '">' + esc(x.packet.name) + '</a>' : '') + '</td><td class="n">' + YPB.usd(x.usdCents) + '<br>' + YPB.polOf(x.weiPaid) + ' POL</td><td>'
|
||||
+ x.pays.map(p => esc(p.label) + ': ' + YPB.polOf(p.wei) + ' POL' + (p.kind ? ' to ' + who(p.name, p.to) : '') + (p.failed ? ' (waiting to claim)' : '')).join('<br>') + '</td><td>' + YPB.n(x.delivery.delivered) + ' / ' + YPB.n(x.delivery.views) + '<br><span class="muted">' + esc(x.delivery.status) + '</span></td></tr>').join('')
|
||||
: '<tr><td colspan="6" class="muted">' + (d.contract ? 'No Spotlights yet.' : 'No Spotlights yet: the YPBShop contract is not deployed. Every payment will show here with its transaction.') + '</td></tr>';
|
||||
return;
|
||||
}
|
||||
if (path === '/contract') {
|
||||
const d = await YPB.getJSON('/api/contract');
|
||||
const lv = (d.split || {}).levelBps || [];
|
||||
const company = YPB.pct(10000 - lv.reduce((t, x) => t + x, 0));
|
||||
const rows = [
|
||||
['Status', d.deployed ? 'Deployed on Polygon' : 'Not deployed yet. These are the planned values; nothing can be bought until it is.'],
|
||||
['Address', d.address ? '<span class="mono">' + esc(d.address) + '</span>' + (d.explorer ? ' (<a href="' + esc(d.explorer) + '/address/' + esc(d.address) + '#code" target="_blank" rel="noopener">Polygonscan</a>)' : '') : 'not deployed'],
|
||||
['Verified source', d.verified && (d.verified.sourcify || d.verified.polygonscan) ? [d.verified.polygonscan ? 'Polygonscan' : '', d.verified.sourcify ? 'Sourcify' : ''].filter(Boolean).join(' and ') : 'after deploy'],
|
||||
['Split', lv.map((b, i) => 'level ' + (i + 1) + ' ' + YPB.pct(b)).join(', ') + ', company ' + company + ' (immutable)'],
|
||||
['Spotlight', d.sku ? YPB.usd(d.sku.usdCents) + ' for ' + YPB.n(d.sku.views) + ' views' + (d.sku.active ? '' : ' (switched off)') : '$' + (d.spotlight || {}).usd + ' for ' + YPB.n((d.spotlight || {}).views) + ' views (planned)'],
|
||||
['Price changes', 'wait ' + d.skuDelayHours + ' hours on chain' + (d.pendingSku ? '. Pending: ' + YPB.usd(d.pendingSku.usdCents) + ' for ' + YPB.n(d.pendingSku.views) + ' views, from ' + YPB.when(d.pendingSku.eta * 1000) : '')],
|
||||
['Company wallet', '<span class="mono">' + esc(d.company || '') + '</span>'],
|
||||
['Owner', d.owner ? '<span class="mono">' + esc(d.owner) + '</span> (' + esc(d.ownerNote) + ')' : esc(d.ownerNote) + ' (after deploy)'],
|
||||
['Paused', d.deployed ? (d.paused ? 'yes (new Spotlights stopped; claims stay open)' : 'no') : 'n/a']];
|
||||
if (d.error) rows.push(['Note', esc(d.error)]);
|
||||
$('cBox').innerHTML = '<div class="tbl" style="margin:0"><table><tbody>' + rows.map(r => '<tr><th style="width:34%">' + r[0] + '</th><td>' + r[1] + '</td></tr>').join('') + '</tbody></table></div>';
|
||||
return;
|
||||
}
|
||||
if (path === '/promote') {
|
||||
const me = await YPB.getJSON('/api/me');
|
||||
const k = await YPB.getJSON('/api/promo-kit' + (me.signedIn && me.username ? '?u=' + encodeURIComponent(me.username) : ''));
|
||||
const link = (k.links || [])[0]; $('myLink').textContent = link ? link.tracked || link.url : ''; $('copyLink').onclick = e => YPB.copy($('myLink').textContent, e.target);
|
||||
const box = t => '<div class="sharebox" style="margin-top:8px"><span>' + esc(t) + '</span><button class="btn sm" type="button" data-copy>Copy</button></div>';
|
||||
$('lines').innerHTML = (k.lines || []).concat(k.posts || []).map(box).join('');
|
||||
$('email').innerHTML = '<p><b>' + esc(k.email.subject) + '</b></p>' + box(k.email.body);
|
||||
$('creatives').innerHTML = (k.creatives || []).length ? k.creatives.map(x => '<div><p class="muted" style="margin:0 0 4px">' + esc(x.angleLabel + ', ' + x.label + ' ' + x.w + 'x' + x.h) + '</p><img src="' + esc(x.url) + '" width="' + x.w + '" height="' + x.h + '" alt="YourProgramBuilder" loading="lazy" style="height:auto">' + box(x.html) + '</div>').join('') : '<p class="muted">Banners are on their way.</p>';
|
||||
$('kitNote').textContent = k.note || '';
|
||||
document.querySelectorAll('[data-copy]').forEach(b => { b.onclick = () => YPB.copy(b.previousElementSibling.textContent, b); });
|
||||
}
|
||||
})();
|
||||
@@ -0,0 +1,21 @@
|
||||
// The Spotlight page: pick a packet and a quantity; closed with a clear note until YPBShop is deployed.
|
||||
(async function () {
|
||||
const $ = YPB.$, esc = YPB.esc;
|
||||
const c = await YPB.getConfig().catch(() => ({}));
|
||||
const d = await YPB.getJSON('/api/packets').catch(() => ({ items: [] }));
|
||||
const want = Number(new URLSearchParams(location.search).get('p'));
|
||||
$('pkPick').innerHTML = (d.items || []).map(x => '<option value="' + x.id + '"' + (x.id === want ? ' selected' : '') + '>No. ' + esc(x.no) + ' ' + esc(x.name) + '</option>').join('') || '<option value="">No packets in the Seed Bed yet</option>';
|
||||
if (!c.shop || !c.shop.live) { $('notYet').hidden = false; return; }
|
||||
$('buyBtn').disabled = false;
|
||||
const q = async () => { const r = await YPBBuy.quote(Number($('qty').value) || 1); $('quote').textContent = r.error || ('About ' + YPBBuy.fmtPol(r.wei) + ' POL for $' + r.usd + ' (' + YPB.n(r.views) + ' views).'); };
|
||||
$('qty').oninput = q; q();
|
||||
$('buyForm').onsubmit = async e => {
|
||||
e.preventDefault(); $('buyBtn').disabled = true;
|
||||
try {
|
||||
const packetId = Number($('pkPick').value); const before = (await YPB.getJSON('/api/my')).spotlights.length;
|
||||
const r = await YPBBuy.run({ qty: Number($('qty').value) || 1, packetId, done: async () => (await YPB.getJSON('/api/my')).spotlights.length > before });
|
||||
YPB.status(r.recorded ? 'Your Spotlight is live. Track its views on My packets.' : 'Paid and confirmed. It shows on My packets as soon as the watcher records it.' + (r.link ? ' ' + r.link : ''), 'ok');
|
||||
} catch (err) { YPB.status(String(err && err.message || err).slice(0, 400), 'err'); }
|
||||
$('buyBtn').disabled = false;
|
||||
};
|
||||
})();
|
||||
@@ -0,0 +1,233 @@
|
||||
// YourProgramBuilder wallet sign-in: the VBB / Downline Banners / ViralAdBlitz wallet.js (same AppKit build, chain guard, dead-session recovery)
|
||||
// with its buy flow (2026-11-14): sendTx() hard-guards the chain, sets Polygon's fee floor from /api/gas and recovers a dead
|
||||
// WalletConnect session once; waitTx() polls /api/tx; balance() is the pre-flight check. The page builds the call on the server.
|
||||
window.YPBWallet = (function () {
|
||||
const pad = v => BigInt(v).toString(16).padStart(64, '0');
|
||||
const padAddr = a => { if (!a) return pad(0); if (!/^0x[0-9a-fA-F]{40}$/.test(a)) throw new Error('Bad address: ' + a); return a.slice(2).toLowerCase().padStart(64, '0'); };
|
||||
// Normalize a chainId to a decimal number. eth_chainId is meant to return a
|
||||
// hex string, but some wallets return a number or a decimal string — compare
|
||||
// numerically so a wallet's shape never crashes the flow.
|
||||
const chainNum = v => {
|
||||
if (v == null) return NaN;
|
||||
if (typeof v === 'number') return v;
|
||||
const s = String(v).trim();
|
||||
return /^0x/i.test(s) ? parseInt(s, 16) : parseInt(s, 10);
|
||||
};
|
||||
const APPKIT_URL = 'https://cdn.jsdelivr.net/npm/@reown/appkit-cdn@1.8.23/dist/appkit.js';
|
||||
|
||||
let modal = null, akPromise = null, provider = null;
|
||||
|
||||
async function initAppKit(c) {
|
||||
if (modal) return modal;
|
||||
if (akPromise) return akPromise;
|
||||
akPromise = (async () => {
|
||||
const mod = await import(APPKIT_URL);
|
||||
const { createAppKit, WagmiAdapter, networks } = mod;
|
||||
const netMap = { 80002: networks.polygonAmoy, 137: networks.polygon, 31337: networks.hardhat || networks.localhost };
|
||||
const base = netMap[Number(c.chainId)] || networks.polygonAmoy;
|
||||
// Override the chain's RPC with our clean public endpoint. AppKit's built-in
|
||||
// networks advertise the WalletConnect RPC proxy
|
||||
// (rpc.walletconnect.org/v1/?chainId=…&projectId=…) as the chain RPC, and
|
||||
// wallets reject that query-string URL as "Invalid URL" when adding/switching
|
||||
// the network: the cause of Trust's "Invalid URL", MetaMask's switch loop,
|
||||
// and the failed mobile buy (the chain switch never completed).
|
||||
const rpc = String(c.rpc || '').trim();
|
||||
const net = rpc ? Object.assign({}, base, { rpcUrls: { default: { http: [rpc] }, public: { http: [rpc] } } }) : base;
|
||||
// Accept the wallet's usual networks too, so AppKit doesn't trap the user in
|
||||
// its own "Switch Network" modal — that modal loops on a testnet the wallet
|
||||
// can't auto-add. We switch to `net` ourselves (wallet_addEthereumChain adds
|
||||
// + switches in one step) and sendTx hard-guards the chain before signing.
|
||||
const allNets = [net];
|
||||
for (const k of ['polygon', 'mainnet']) {
|
||||
try { const n = networks[k]; if (n && n.id !== net.id) allNets.push(n); } catch (e) {}
|
||||
}
|
||||
const projectId = String(c.walletConnectProjectId || '').trim();
|
||||
const wagmiAdapter = new WagmiAdapter({ networks: allNets, projectId });
|
||||
modal = createAppKit({
|
||||
adapters: [wagmiAdapter], networks: allNets, projectId, defaultNetwork: net,
|
||||
metadata: { name: 'YourProgramBuilder', description: 'The Seed Bed: bring your program, the network grows it.',
|
||||
url: location.origin, icons: [location.origin + '/art/icon-192.png'] },
|
||||
features: { analytics: false, email: false, socials: [] },
|
||||
// Picker order: wallets without Trust's balance-proportion block go first.
|
||||
// Trust Wallet is NOT excluded; it just drops out of the featured row into
|
||||
// "All wallets" (Marty, 2026-09-09: move Trust to the bottom, not off).
|
||||
featuredWalletIds: [
|
||||
'0b415a746fb9ee99cce155c2ceca0c6f6061b1dbca2d722b3ba16381d0562150', // SafePal (recommended, listed first)
|
||||
'c57ca95b47569778a828d19178114f4db188b89b763c899ba0be274e97267d96', // MetaMask
|
||||
'a797aa35c0fadbfc1a53e7f675162ed5226968b44a19ee3d24385c64d1d3c393', // Phantom
|
||||
'fd20dc426fb37566d803205b19bbc1d4096b248ac04548e3cfb6b3a38bd033aa' // Coinbase Wallet
|
||||
]
|
||||
});
|
||||
return modal;
|
||||
})();
|
||||
return akPromise;
|
||||
}
|
||||
|
||||
function currentAddress() { try { return (modal && modal.getAddress && modal.getAddress()) || null; } catch (e) { return null; } }
|
||||
|
||||
function waitForConnection(timeoutMs) {
|
||||
if (currentAddress()) return Promise.resolve(currentAddress());
|
||||
return new Promise((resolve, reject) => {
|
||||
let done = false, unsub = null;
|
||||
const finish = (addr, err) => { if (done) return; done = true; try { unsub && unsub(); } catch (e) {} err ? reject(err) : resolve(addr); };
|
||||
try { unsub = modal.subscribeAccount(acc => { if (acc && acc.isConnected && acc.address) finish(acc.address); }); } catch (e) {}
|
||||
const t0 = Date.now();
|
||||
(function poll() {
|
||||
if (done) return;
|
||||
const a = currentAddress();
|
||||
if (a) return finish(a);
|
||||
if (Date.now() - t0 > (timeoutMs || 180000)) return finish(null, new Error('Wallet connection timed out. Tap Connect and try again.'));
|
||||
setTimeout(poll, 400);
|
||||
})();
|
||||
});
|
||||
}
|
||||
|
||||
async function resolveProvider() {
|
||||
for (let i = 0; i < 20; i++) {
|
||||
try { const p = modal.getWalletProvider ? await Promise.resolve(modal.getWalletProvider()) : null; if (p && p.request) return p; } catch (e) {}
|
||||
await new Promise(r => setTimeout(r, 300));
|
||||
}
|
||||
throw new Error('Could not reach your wallet. Try connecting again.');
|
||||
}
|
||||
|
||||
function eth() { if (!provider) throw new Error('Connect your wallet first.'); return provider; }
|
||||
const isInjected = () => !!(provider && window.ethereum && (provider === window.ethereum || provider.isMetaMask));
|
||||
// the account the wallet will actually sign with: for an injected wallet (MetaMask
|
||||
// extension) that is its active account, which can differ from AppKit's cached one
|
||||
async function activeAddress(fallback) {
|
||||
if (isInjected()) { try { const a = await provider.request({ method: 'eth_accounts' }); if (a && a[0]) return a[0]; } catch (e) {} }
|
||||
return fallback || currentAddress();
|
||||
}
|
||||
// Force the wallet's own account picker. Injected wallets stay connected to the
|
||||
// site, so a plain disconnect/reconnect never shows one: asking for permissions
|
||||
// again makes MetaMask open its account-selection prompt, and whatever the user
|
||||
// ticks becomes the active account. WalletConnect wallets fall back to a fresh
|
||||
// session (the picker + the wallet app's own account choice).
|
||||
async function pickAccount() {
|
||||
const c = await YPB.getConfig();
|
||||
await initAppKit(c);
|
||||
const inj = window.ethereum;
|
||||
if (inj && inj.request) {
|
||||
try {
|
||||
await inj.request({ method: 'wallet_requestPermissions', params: [{ eth_accounts: {} }] });
|
||||
const accs = await inj.request({ method: 'eth_accounts' });
|
||||
if (accs && accs[0]) { provider = inj; await ensureChain(c).catch(() => {}); return accs[0]; }
|
||||
} catch (e) {
|
||||
if (e && (e.code === 4001 || /reject|denied/i.test(String(e.message || '')))) throw new Error('You closed the account picker. Pick the account you want and try again.');
|
||||
}
|
||||
}
|
||||
return freshConnect(c);
|
||||
}
|
||||
|
||||
// A WalletConnect session can die underneath AppKit's cached "connected"
|
||||
// state: the wallet app rejects or kills it (Trust does this after its own
|
||||
// security stop), the phone sleeps, the relay drops. AppKit still reports an
|
||||
// address, so the next request fails with a "disconnected" style error.
|
||||
// Detect that, wipe the stale session, and re-open the picker for a fresh one.
|
||||
const DEAD_RE = /disconnect|not connected|no matching key|session (topic|expired|deleted|not found)|call connect|please call connect|missing or invalid|relay/i;
|
||||
const isDead = e => DEAD_RE.test(String((e && e.message) || e || ''));
|
||||
async function freshConnect(c) {
|
||||
try { YPB.status('Your wallet session dropped. Reconnect in the picker…'); } catch (e) {}
|
||||
await disconnect();
|
||||
try { await modal.open(); } catch (e) {}
|
||||
const addr = await waitForConnection(180000);
|
||||
try { if (modal && modal.close) await modal.close(); } catch (e) {}
|
||||
provider = await resolveProvider();
|
||||
await ensureChain(c).catch(() => {});
|
||||
return addr;
|
||||
}
|
||||
|
||||
async function connect() {
|
||||
const c = await YPB.getConfig();
|
||||
await initAppKit(c);
|
||||
let addr = currentAddress();
|
||||
if (!addr) {
|
||||
// give AppKit a moment to rehydrate an existing session before popping the
|
||||
// picker — otherwise an already-connected wallet still gets the modal
|
||||
for (let i = 0; i < 8 && !addr; i++) { await new Promise(r => setTimeout(r, 150)); addr = currentAddress(); }
|
||||
}
|
||||
if (!addr) { try { await modal.open(); } catch (e) {} addr = await waitForConnection(180000); }
|
||||
try { if (modal && modal.close) await modal.close(); } catch (e) {} // dismiss the picker once we're connected
|
||||
provider = await resolveProvider();
|
||||
// probe the session: a dead WalletConnect session answers with a disconnect error
|
||||
try { await provider.request({ method: 'eth_chainId' }); }
|
||||
catch (e) { if (isDead(e)) return freshConnect(c); }
|
||||
await ensureChain(c).catch(() => {}); // AppKit already connects on the right network; switch is best-effort
|
||||
return addr;
|
||||
}
|
||||
|
||||
async function ensureChain(c) {
|
||||
const want = '0x' + Number(c.chainId).toString(16);
|
||||
let cur; try { cur = await eth().request({ method: 'eth_chainId' }); } catch (e) { return; }
|
||||
if (chainNum(cur) === Number(c.chainId)) return;
|
||||
try {
|
||||
await eth().request({ method: 'wallet_switchEthereumChain', params: [{ chainId: want }] });
|
||||
} catch (e) {
|
||||
// any failure (not just 4902): try to add the chain — wallet_addEthereumChain
|
||||
// adds AND switches in one step, which is what unblocks wallets that can't
|
||||
// otherwise reach a chain they don't already have (e.g. a testnet).
|
||||
const addParams = { chainId: want, chainName: c.chainName, nativeCurrency: { name: 'POL', symbol: 'POL', decimals: 18 }, rpcUrls: [c.rpc] };
|
||||
if (c.explorer && /^https?:\/\//i.test(c.explorer)) addParams.blockExplorerUrls = [c.explorer];
|
||||
try { await eth().request({ method: 'wallet_addEthereumChain', params: [addParams] }); } catch (e2) {}
|
||||
}
|
||||
}
|
||||
|
||||
// SIWE: challenge -> personal_sign -> verify (server sets the session cookie)
|
||||
async function signIn(opts) {
|
||||
const addr = (opts && opts.pick) ? await pickAccount() : await activeAddress(await connect());
|
||||
const ch = await (await fetch('/api/auth/challenge', { method: 'POST',
|
||||
headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ address: addr }) })).json();
|
||||
if (ch.error) throw new Error(ch.error);
|
||||
// hex-encode the message (Trust and others require hex for personal_sign)
|
||||
const hexMsg = '0x' + Array.from(new TextEncoder().encode(ch.message)).map(b => b.toString(16).padStart(2, '0')).join('');
|
||||
const sig = await eth().request({ method: 'personal_sign', params: [hexMsg, addr] });
|
||||
const r = await (await fetch('/api/auth/verify', { method: 'POST',
|
||||
headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ address: addr, signature: sig, asPosition: !!(opts && opts.asPosition) }) })).json();
|
||||
if (r.error) throw new Error(r.error);
|
||||
return r;
|
||||
}
|
||||
|
||||
async function sendTx(to, data, valueHex) {
|
||||
const c = await YPB.getConfig();
|
||||
const addr = await connect();
|
||||
const wantNum = Number(c.chainId);
|
||||
let cur; try { cur = await eth().request({ method: 'eth_chainId' }); } catch (e) {}
|
||||
if (!isNaN(chainNum(cur)) && chainNum(cur) !== wantNum) {
|
||||
await ensureChain(c);
|
||||
try { cur = await eth().request({ method: 'eth_chainId' }); } catch (e) {}
|
||||
if (!isNaN(chainNum(cur)) && chainNum(cur) !== wantNum)
|
||||
throw new Error('Your wallet is on the wrong network. Switch it to ' + (c.chainName || 'Polygon') + ', then try again.');
|
||||
}
|
||||
const tx = { from: await activeAddress(addr), to, data };
|
||||
if (valueHex) tx.value = valueHex;
|
||||
try { const g = await (await fetch('/api/gas')).json(); if (g && g.maxPriorityFeePerGas && g.maxFeePerGas) { tx.maxPriorityFeePerGas = g.maxPriorityFeePerGas; tx.maxFeePerGas = g.maxFeePerGas; } } catch (e) {}
|
||||
try { return await eth().request({ method: 'eth_sendTransaction', params: [tx] }); }
|
||||
catch (e) {
|
||||
if (!isDead(e)) throw e;
|
||||
tx.from = await freshConnect(c);
|
||||
return eth().request({ method: 'eth_sendTransaction', params: [tx] });
|
||||
}
|
||||
}
|
||||
async function waitTx(hash) {
|
||||
for (let i = 0; i < 120; i++) {
|
||||
try { const r = await (await fetch('/api/tx/' + hash)).json(); if (r.found) return r; } catch (e) { /* app switch on a phone: keep polling */ }
|
||||
await new Promise(res => setTimeout(res, 2500));
|
||||
}
|
||||
throw new Error('Still waiting for the transaction. Check it on the explorer; your Boost shows once it confirms.');
|
||||
}
|
||||
async function balance(addr) {
|
||||
await connect();
|
||||
return BigInt(await eth().request({ method: 'eth_getBalance', params: [addr || currentAddress(), 'latest'] }));
|
||||
}
|
||||
|
||||
async function disconnect() {
|
||||
// AppKit's disconnect can hang on the WalletConnect relay (esp. mobile) —
|
||||
// never block on it, so the UI can't get stuck "disconnecting".
|
||||
try { if (modal && modal.disconnect) await Promise.race([modal.disconnect(), new Promise(r => setTimeout(r, 1200))]); } catch (e) {}
|
||||
provider = null;
|
||||
try { Object.keys(localStorage).forEach(k => { if (/wc@2|walletconnect|w3m|wcm|reown|wagmi|appkit/i.test(k)) localStorage.removeItem(k); }); } catch (e) {}
|
||||
}
|
||||
|
||||
function walletName() { try { const w = modal && modal.getWalletInfo && modal.getWalletInfo(); return (w && w.name) || ''; } catch (e) { return ''; } }
|
||||
return { connect, signIn, sendTx, waitTx, balance, disconnect, address: currentAddress, activeAddress, pickAccount, walletName };
|
||||
})();
|
||||
@@ -0,0 +1,182 @@
|
||||
/* YourProgramBuilder: a seed catalog (the approved mockup, 2026-11-17). Green-white paper with a light grain, forest ink, leaf green,
|
||||
tangerine for the one call to action per screen, butter for the Spotlight. Young Serif display, Atkinson Hyperlegible body,
|
||||
Martian Mono for counts. No other network site uses these colors or fonts. */
|
||||
:root{
|
||||
--paper:#F6FAF1;--bed:#E9F2E2;--ink:#12291F;--sub:#4A6457;--leaf:#22844A;--leafInk:#1B6E3C;--tang:#F2620F;--tangInk:#C24A08;--sky:#8CCBF5;--butter:#FFE6A0;--packet:#FFFFFF;--line:#D3E3CB;--onTang:#FFFFFF;
|
||||
--bad:#B3261E;--grain:url("/art/paper-grain.jpg");--sprig:#22844A;
|
||||
--display:"Young Serif",Georgia,"Times New Roman",serif;--body:"Atkinson Hyperlegible",system-ui,-apple-system,"Segoe UI",sans-serif;--mono:"Martian Mono",ui-monospace,Menlo,Consolas,monospace;
|
||||
color-scheme:light;
|
||||
}
|
||||
@media (prefers-color-scheme:dark){:root:not([data-theme="light"]){--paper:#0E1C15;--bed:#13261C;--ink:#E9F3E6;--sub:#A3BDAE;--leaf:#5CC583;--leafInk:#7FD8A0;--tang:#FF8440;--tangInk:#FF9A5E;--sky:#3F7FAE;--butter:#3B3420;--packet:#18301F;--line:#284634;--onTang:#1A0D04;--bad:#FF8A80;--grain:none;--sprig:#5CC583;color-scheme:dark}}
|
||||
:root[data-theme="dark"]{--paper:#0E1C15;--bed:#13261C;--ink:#E9F3E6;--sub:#A3BDAE;--leaf:#5CC583;--leafInk:#7FD8A0;--tang:#FF8440;--tangInk:#FF9A5E;--sky:#3F7FAE;--butter:#3B3420;--packet:#18301F;--line:#284634;--onTang:#1A0D04;--bad:#FF8A80;--grain:none;--sprig:#5CC583;color-scheme:dark}
|
||||
*{box-sizing:border-box}
|
||||
html{scroll-padding-top:16px}
|
||||
body{margin:0;background:var(--paper);color:var(--ink);font:16px/1.55 var(--body);padding-left:max(16px,env(safe-area-inset-left,0px));padding-right:max(16px,env(safe-area-inset-right,0px))}
|
||||
body::before{content:"";position:fixed;inset:0;z-index:-1;pointer-events:none;background-image:var(--grain);background-size:620px;opacity:.28;mix-blend-mode:multiply}
|
||||
img{max-width:100%}
|
||||
a{color:var(--leafInk)}
|
||||
[hidden]{display:none!important}
|
||||
.wrap{max-width:1180px;margin:0 auto}
|
||||
.skip{position:absolute;left:-999px;top:0}.skip:focus{left:16px;z-index:50;background:var(--packet);padding:8px 12px;border:2px solid var(--ink);border-radius:8px}
|
||||
h1,h2,h3{font-family:var(--display);font-weight:400;line-height:1.1;margin:0;text-wrap:balance}
|
||||
h1{font-size:clamp(34px,5vw,56px)}
|
||||
h1 em{font-style:normal;color:var(--tangInk)}
|
||||
h2{font-size:clamp(24px,3.2vw,30px)}
|
||||
p{margin:0 0 10px}
|
||||
.muted{color:var(--sub)}
|
||||
.kicker{font:600 12px/1 var(--mono);letter-spacing:.1em;text-transform:uppercase;color:var(--leafInk)}
|
||||
.mono{font-family:var(--mono);font-variant-numeric:tabular-nums}
|
||||
.ic{width:1em;height:1em;flex:none;display:block}
|
||||
|
||||
/* header */
|
||||
header.top{display:flex;flex-wrap:wrap;align-items:center;justify-content:space-between;gap:12px 14px;padding-block:14px;border-bottom:2px solid var(--ink)}
|
||||
.brand{display:flex;align-items:center;gap:10px;font:24px/1 var(--display);color:var(--ink);text-decoration:none;min-width:0}
|
||||
.brand svg{flex:none}
|
||||
nav.links{display:flex;flex-wrap:wrap;gap:6px 18px;font-weight:700;font-size:15px}
|
||||
nav.links a{color:var(--ink);text-decoration:none;padding-block:4px;border-bottom:2px solid transparent}
|
||||
nav.links a[aria-current]{border-color:var(--tang)}
|
||||
.signin{font-weight:700;font-size:14px;color:var(--ink);background:transparent;border:2px solid var(--ink);border-radius:999px;padding:8px 14px;cursor:pointer;text-decoration:none;white-space:nowrap}
|
||||
.stage-bar{background:var(--butter);color:var(--ink);border:2px solid var(--ink);border-radius:10px;padding:8px 12px;margin-top:10px;font-weight:700;font-size:14px;text-align:center}
|
||||
|
||||
/* buttons */
|
||||
.btn{font:700 16px/1 var(--body);border-radius:999px;padding:14px 20px;border:2px solid var(--ink);cursor:pointer;text-decoration:none;display:inline-flex;align-items:center;gap:8px;background:var(--packet);color:var(--ink)}
|
||||
.btn.primary{background:var(--tang);color:var(--onTang);border-color:var(--tang)}
|
||||
.btn.ink{background:var(--ink);color:var(--paper);border-color:var(--ink)}
|
||||
.btn.sm{font-size:14px;padding:9px 14px}
|
||||
.btn .ic{width:20px;height:20px}
|
||||
.btn[disabled]{opacity:.55;cursor:not-allowed}
|
||||
.btn:focus-visible,.signin:focus-visible,.save:focus-visible,.chip:focus-visible,input:focus-visible,select:focus-visible,textarea:focus-visible,a:focus-visible,button:focus-visible{outline:3px solid var(--sky);outline-offset:2px}
|
||||
.row{display:flex;gap:10px;align-items:center;flex-wrap:wrap}
|
||||
|
||||
/* hero plate: the art is a printed plate, it keeps its light paper in both themes */
|
||||
.plate{position:relative;margin-top:22px;border:2px solid var(--ink);border-radius:18px;overflow:hidden;min-height:440px;display:flex;align-items:center;background:#F6FAF1}
|
||||
.plate>img{position:absolute;inset:0;width:100%;height:100%;object-fit:cover;object-position:right center}
|
||||
.plate::before{content:"";position:absolute;inset:0;background:linear-gradient(90deg,rgba(246,250,241,.94) 0%,rgba(246,250,241,0) 48%);z-index:1}
|
||||
.plate .copy{position:relative;z-index:2;max-width:560px;padding:34px clamp(18px,4vw,44px);min-width:0;color:#12291F}
|
||||
.plate .kicker{color:#1B6E3C}
|
||||
.plate h1{margin:12px 0 14px}
|
||||
.plate h1 em{color:#C24A08}
|
||||
.lede{max-width:52ch;color:#35503F;margin:0 0 20px;font-size:17px}
|
||||
.plate .btn.primary{background:#F2620F;color:#fff;border-color:#F2620F}
|
||||
.plate .btn.ghost{background:#fff;color:#12291F;border-color:#12291F}
|
||||
.ctas{display:flex;flex-wrap:wrap;gap:12px}
|
||||
|
||||
.under{display:grid;grid-template-columns:1.25fr 1fr;gap:28px;padding-block:22px;align-items:start}
|
||||
.under>*{min-width:0}
|
||||
.steps{display:grid;grid-template-columns:repeat(3,1fr);border:2px solid var(--ink);border-radius:14px;overflow:hidden;background:var(--packet)}
|
||||
.step{padding:16px 14px;border-right:2px dashed var(--line);display:flex;flex-direction:column;gap:4px;min-width:0}
|
||||
.step:last-child{border-right:0}
|
||||
.step .ic{width:44px;height:44px;color:var(--leaf);margin-bottom:6px}
|
||||
.step b{display:block;font:20px/1.1 var(--display);font-weight:400}
|
||||
.step span{font-size:14px;color:var(--sub)}
|
||||
.step i{font:600 11px/1 var(--mono);font-style:normal;color:var(--leafInk);letter-spacing:.08em}
|
||||
.spot{position:relative;overflow:hidden;background:var(--butter);border:2px solid var(--ink);border-radius:16px;padding:20px;box-shadow:6px 6px 0 var(--ink)}
|
||||
.spot>*{position:relative;z-index:1}
|
||||
.spot .sprig{position:absolute;z-index:0;right:-8px;bottom:-10px;width:120px;height:auto;color:var(--ink);opacity:.22}
|
||||
.spot .kicker{display:flex;align-items:center;gap:8px}
|
||||
.spot .kicker .ic{width:22px;height:22px;color:var(--tangInk)}
|
||||
.spot h2{font-size:26px;margin:6px 0 8px}
|
||||
.price{font:600 34px/1 var(--mono)}
|
||||
.price small{font:400 14px var(--body);color:var(--sub)}
|
||||
.spot ul{margin:12px 0 14px;padding-left:18px;font-size:15px;max-width:44ch}
|
||||
.spot li{margin:4px 0}
|
||||
.split{font:400 12px/1.5 var(--mono);color:var(--sub);border-top:1px dashed var(--ink);padding-top:10px}
|
||||
.sprig path{vector-effect:non-scaling-stroke;stroke-width:1.4}
|
||||
|
||||
/* the bed of packets */
|
||||
.bedhead{display:flex;flex-wrap:wrap;align-items:flex-end;justify-content:space-between;gap:10px;margin-top:8px}
|
||||
.bedhead .t{display:flex;align-items:flex-end;gap:6px}
|
||||
.bedhead .sprig{width:46px;height:72px;color:var(--sprig);margin-bottom:-4px}
|
||||
.filters{display:flex;flex-wrap:wrap;gap:8px}
|
||||
.chip{font:700 13px/1 var(--body);border:2px solid var(--line);border-radius:999px;padding:7px 12px;background:var(--packet);color:var(--ink);cursor:pointer}
|
||||
.chip[aria-pressed="true"],.chip.on{border-color:var(--leaf);color:var(--leafInk)}
|
||||
.bed{background:var(--bed);border-radius:18px;padding:18px;margin-block:14px 26px;display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:16px}
|
||||
.bed.spotrow{background:transparent;padding:0;margin-block:10px 8px}
|
||||
.bed .empty{grid-column:1/-1;text-align:center;color:var(--sub);padding:28px 10px}
|
||||
.pk{background:var(--packet);border:2px solid var(--ink);border-radius:6px 6px 14px 14px;display:flex;flex-direction:column;min-width:0}
|
||||
.pk .fold{height:14px;border-bottom:2px solid var(--ink);background:repeating-linear-gradient(90deg,var(--leaf) 0 10px,transparent 10px 16px)}
|
||||
.pk.spotlit .fold{background:repeating-linear-gradient(90deg,var(--tang) 0 10px,transparent 10px 16px)}
|
||||
.pk .body{padding:14px;display:flex;flex-direction:column;gap:8px;flex:1}
|
||||
.pk .no{display:flex;align-items:center;justify-content:space-between;gap:8px;font:600 11px/1 var(--mono);letter-spacing:.06em;color:var(--sub);padding-bottom:8px;border-bottom:1.5px dashed var(--line)}
|
||||
.pk .no .ic{width:26px;height:26px;color:var(--leaf)}
|
||||
.pk.spotlit .no .ic{color:var(--tangInk)}
|
||||
.pk h3{font-size:21px;line-height:1.15}
|
||||
.pk h3 a{color:var(--ink);text-decoration:none}
|
||||
.pk h3 a:hover{text-decoration:underline}
|
||||
.meta{display:flex;flex-wrap:wrap;gap:6px}
|
||||
.tag{font:600 11px/1 var(--mono);letter-spacing:.04em;padding:5px 7px;border-radius:5px;border:1.5px solid var(--line);color:var(--sub);text-transform:uppercase}
|
||||
.tag.ok{border-color:var(--leaf);color:var(--leafInk)}
|
||||
.tag.sp{border-color:var(--tang);color:var(--tangInk)}
|
||||
.tag.warn{border-color:var(--tang);color:var(--tangInk)}
|
||||
.tag.bad{border-color:var(--bad);color:var(--bad)}
|
||||
.pk p{margin:0;font-size:14px;color:var(--sub);overflow-wrap:anywhere}
|
||||
.meter{margin-top:auto}
|
||||
.meter .lbl{display:flex;justify-content:space-between;font:600 12px/1 var(--mono);font-variant-numeric:tabular-nums;margin-bottom:6px}
|
||||
.bar{height:10px;border-radius:99px;background:var(--bed);border:1.5px solid var(--ink);overflow:hidden}
|
||||
.bar>span{display:block;height:100%;background:var(--leaf)}
|
||||
.bar.sp>span{background:var(--tang)}
|
||||
.pk .row{justify-content:space-between}
|
||||
.save{font:700 14px/1 var(--body);background:var(--ink);color:var(--paper);border:0;border-radius:999px;padding:9px 14px 9px 10px;cursor:pointer;display:inline-flex;align-items:center;gap:6px;text-decoration:none}
|
||||
.save .ic{width:20px;height:20px}
|
||||
.save.done{background:var(--leaf);color:#fff}
|
||||
.by{font-size:13px;color:var(--sub)}
|
||||
|
||||
/* panels, forms, tables */
|
||||
.panel{background:var(--packet);border:2px solid var(--ink);border-radius:14px;padding:20px;min-width:0}
|
||||
.panel+.panel{margin-top:18px}
|
||||
.grid2{display:grid;grid-template-columns:minmax(0,1.3fr) minmax(0,1fr);gap:22px;align-items:start}
|
||||
.stack{display:grid;gap:12px}
|
||||
label.f{display:grid;gap:5px;font-weight:700;font-size:15px}
|
||||
label.f small{font-weight:400;color:var(--sub);font-size:13px}
|
||||
input[type=text],input[type=url],input[type=number],select,textarea{width:100%;font:16px/1.4 var(--body);color:var(--ink);background:var(--paper);border:2px solid var(--line);border-radius:10px;padding:10px 12px;min-width:0}
|
||||
textarea{min-height:84px;resize:vertical}
|
||||
input:focus,select:focus,textarea:focus{border-color:var(--leaf)}
|
||||
.radios{display:flex;flex-wrap:wrap;gap:8px 16px;font-weight:400}
|
||||
.radios label{display:flex;gap:6px;align-items:center}
|
||||
.note{border-radius:10px;padding:10px 12px;border:2px solid var(--line);background:var(--paper);font-size:15px;margin:12px 0 0}
|
||||
.note.ok{border-color:var(--leaf)}
|
||||
.note.err{border-color:var(--bad);color:var(--bad)}
|
||||
.note.warn{border-color:var(--tang)}
|
||||
.tbl{overflow-x:auto;border:2px solid var(--line);border-radius:10px;margin-top:10px}
|
||||
table{border-collapse:collapse;width:100%;font-size:14px}
|
||||
th,td{text-align:left;padding:8px 10px;border-bottom:1px solid var(--line);vertical-align:top}
|
||||
th{background:var(--bed);font-weight:700}
|
||||
td.n{text-align:right;font-family:var(--mono);font-variant-numeric:tabular-nums;white-space:nowrap}
|
||||
.stats{display:grid;grid-template-columns:repeat(auto-fit,minmax(130px,1fr));gap:10px;margin-top:12px}
|
||||
.stat{background:var(--bed);border-radius:10px;padding:10px 12px}
|
||||
.stat b{display:block;font:600 22px/1.2 var(--mono)}
|
||||
.stat span{font-size:13px;color:var(--sub)}
|
||||
.sharebox{display:flex;gap:8px;align-items:center;background:var(--bed);border-radius:10px;padding:8px 8px 8px 12px;min-width:0}
|
||||
.sharebox span{font:500 13px var(--mono);overflow-wrap:anywhere;min-width:0;flex:1}
|
||||
.tabs{display:flex;flex-wrap:wrap;gap:8px;margin:18px 0 6px}
|
||||
.prose{max-width:72ch}
|
||||
.prose h2{margin:26px 0 10px}
|
||||
.prose li{margin:5px 0}
|
||||
.page{padding-block:30px 56px}
|
||||
.page h1{font-size:clamp(32px,5vw,48px);margin-bottom:12px}
|
||||
.ph-slot{margin:22px 0}
|
||||
|
||||
/* footer */
|
||||
footer.foot{border-top:2px solid var(--ink);margin-top:30px;padding-block:16px 26px;font-size:14px;color:var(--sub)}
|
||||
footer.foot p{display:flex;flex-wrap:wrap;align-items:baseline;gap:6px 14px;margin:0 0 8px}
|
||||
footer.foot a{color:var(--ink);font-weight:700;text-decoration:none;white-space:nowrap}
|
||||
footer.foot a:hover{text-decoration:underline}
|
||||
footer.foot b{color:var(--ink)}
|
||||
footer.foot .here{font-weight:700;color:var(--leafInk)}
|
||||
|
||||
/* toasts of real events */
|
||||
.toasts{position:fixed;left:16px;bottom:16px;z-index:40;display:grid;gap:8px;max-width:min(340px,calc(100vw - 100px))}
|
||||
.toast{display:block;background:var(--packet);color:var(--ink);border:2px solid var(--ink);border-radius:12px;padding:10px 12px;font-size:14px;text-decoration:none;box-shadow:4px 4px 0 var(--ink);opacity:0;transform:translateY(10px);transition:opacity .3s,transform .3s}
|
||||
.toast.in{opacity:1;transform:none}
|
||||
.toast span{color:var(--sub)}
|
||||
|
||||
@media (max-width:900px){.under,.grid2{grid-template-columns:1fr}.bed{grid-template-columns:repeat(2,minmax(0,1fr))}}
|
||||
@media (max-width:700px){
|
||||
.plate{display:block;min-height:0}
|
||||
.plate>img{position:static;display:block;aspect-ratio:16/9;height:auto;max-width:100%}
|
||||
.plate::before{display:none}
|
||||
.plate .copy{padding:20px 18px 24px}
|
||||
}
|
||||
@media (max-width:560px){.bed{grid-template-columns:1fr}.steps{grid-template-columns:1fr}.step{border-right:0;border-bottom:2px dashed var(--line)}.step:last-child{border-bottom:0}nav.links{gap:4px 12px;font-size:14px}}
|
||||
@media (prefers-reduced-motion:no-preference){.bar>span{transition:width .6s ease}}
|
||||
@media (prefers-reduced-motion:reduce){.toast{transition:none}}
|
||||
Reference in New Issue
Block a user