Network Weekend (Marty 2026-11-17): Boost views from the live VABShop SKU on every page, quote and chatbot, the network ribbon
chainskus.js reads skus(1) every 60 s and keeps C.boost in step (BOOST_VIEWS stays the normal 500 as normalViews), so a $5 Boost shows 750 once the owner signs setSku and 500 before or after; crediting already follows the Purchase event's views. common.js rewrites the pages' static '500 guaranteed views' copy to the live number only when the chain differs. weekend.js: the Fri 11-27 00:00 CT to Tue 12-01 00:00 CT gate (WEEKEND_NOW test clock) for the dated chatbot fact; the ribbon line (netdeals.setLocal) only exists while the chain really holds the weekend Boost. chatcore render hook, live intro. qa/weekend.test.mjs 18 pass, chatbot 206, smoke 197. common.js?v=9. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -1,10 +1,25 @@
|
||||
// Shared page helpers (VAB namespace, modelled on VBB / Downline Banners common.js): nav, the royal ticker, verified visits,
|
||||
// ad cards, the shared SVG bits of the daylight look (mark, network lines, green checks), footer (legal, company line, the network line from the hub), network ad zones and toasts of real events.
|
||||
window.VAB = (function () {
|
||||
// Network Weekend ribbon (Marty 2026-11-17): netweekend.js paints itself only while a network event is live (exact Central times)
|
||||
if (!/^\/admin/.test(location.pathname)) { const nw = document.createElement('script'); nw.src = '/assets/netweekend.js?v=20261117a'; nw.defer = true; nw.setAttribute('data-site', 'viraladblitz'); document.head.appendChild(nw); }
|
||||
let cfgP = null, vt = null;
|
||||
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()));
|
||||
// the Boost's views as the contract holds them (Marty 2026-11-17, Network Weekend): when the owner has set a different number on
|
||||
// chain than the normal one, the page's own copy ("500 guaranteed views") is rewritten to the live number; never the ribbon or ads
|
||||
function liveViewsCopy() {
|
||||
getConfig().then(c => {
|
||||
const b = c && c.boost; if (!b || !b.normalViews || !b.views || b.views === b.normalViews) return;
|
||||
const from = String(b.normalViews), to = Number(b.views).toLocaleString('en-US');
|
||||
const re2 = new RegExp('\\b(your )' + from + '\\b', 'g');
|
||||
const w = document.createTreeWalker(document.body, NodeFilter.SHOW_TEXT, { acceptNode: t => (t.parentElement && t.parentElement.closest('.nw-ribbon,script,style,textarea,input,.vab-ad,.ad')) ? NodeFilter.FILTER_REJECT : NodeFilter.FILTER_ACCEPT });
|
||||
const hits = []; while (w.nextNode()) { const t = w.currentNode; if (t.nodeValue.indexOf(from) >= 0) hits.push(t); }
|
||||
hits.forEach(t => { t.nodeValue = t.nodeValue.replace(new RegExp('(^|[^0-9,.$])' + from + '(?=( guaranteed| GUARANTEED| views| VIEWS))', 'g'), '$1' + to).replace(re2, '$1' + to); });
|
||||
}).catch(() => {});
|
||||
}
|
||||
if (document.readyState === 'loading') document.addEventListener('DOMContentLoaded', liveViewsCopy); else setTimeout(liveViewsCopy, 0);
|
||||
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');
|
||||
|
||||
Reference in New Issue
Block a user