// Network Weekend strip (Home, above the Five Dollar Friday strip) and Overview card (/my, above the Friday card), Marty 2026-11-17. // Data: /api/promodays (promodays.js). Shown only while the weekend is live (Fri 11-27 00:00 CT to Tue 12-01 00:00 CT) and, as a // heads-up, on Thanksgiving Thursday 11-26 Central; the page's own clock decides at the exact midnights, the server's `live` too. // No inline styles (CSP), no native dialogs. Test clock: window.__NW_NOW (ms). (function () { if (window.__nwCard) return; window.__nwCard = 1; var now = function () { return typeof window.__NW_NOW === 'number' ? window.__NW_NOW : Date.now(); }; var ctDay = function (ms) { return new Date(ms - 6 * 3600 * 1000).toISOString().slice(0, 10); }; var esc = function (s) { return String(s == null ? '' : s).replace(/[&<>"]/g, function (c) { return { '&': '&', '<': '<', '>': '>', '"': '"' }[c]; }); }; var usd = function (n) { return '$' + (Number(n) % 1 ? Number(n).toFixed(2) : Number(n)); }; var hidden = function (k) { try { return localStorage.getItem('iap-hide-nw-' + k) === '1'; } catch (e) { return false; } }; var hide = function (k) { try { localStorage.setItem('iap-hide-nw-' + k, '1'); } catch (e) {} }; function dayLine(v) { return (v.days || []).map(function (d) { return '' + esc(d.name.replace(/^Network Weekend /, '')) + ' +' + d.pct + '% on ' + usd(d.minUsd) + '+'; }).join(' · '); } function state(v) { var t = now(), s = Date.parse(v.startsAt), e = Date.parse(v.endsAt); if (!v.on) return ''; if (t >= s && t < e) return 'live'; if (t >= s - 86400000 && t < s) return 'soon'; return ''; } function extras(v) { return 'Any $20+ pack also gets a 500-credit LinkSpin code' + (v.lsCode ? ' (' + esc(v.lsCode) + ')' : '') + ' on your purchase notice. Any $100+ pack also gets DownlineHydra Pro free, while the first ' + esc(v.builderCap) + ' comps last. Code NETWORKWEEKEND: 300 bonus ad credits, one per account.'; } function paintStrip(v, st) { var anchor = document.getElementById('fdfStrip'); if (!anchor) return; var el = document.getElementById('nwStrip'); if (!st) { if (el) el.hidden = true; return; } if (!el) { el = document.createElement('div'); el.className = 'fdf'; el.id = 'nwStrip'; anchor.parentNode.insertBefore(el, anchor); } el.hidden = false; el.innerHTML = st === 'live' && v.today ? '\u{1F6CD}️ Network Weekend: it’s ' + esc(v.today.name.replace(/^Network Weekend /, '')) + '. +' + v.today.pct + '% bonus ad credits on any ' + usd(v.today.minUsd) + '+ pack until midnight Central. ' + extras(v) + ' ' + esc(v.note) + ' Every deal' : '\u{1F6CD}️ Network Weekend starts at midnight Central. ' + dayLine(v) + ', midnight to midnight through Cyber Monday. ' + esc(v.note) + ' Every deal'; } function paintCard(v, st) { var anchor = document.getElementById('fdfCard'); if (!anchor) return; var card = document.getElementById('nwCard'); var key = st + '-' + ctDay(now()); if (!st || hidden(key)) { if (card) card.hidden = true; return; } if (!card) { card = document.createElement('div'); card.className = 'card'; card.id = 'nwCard'; anchor.parentNode.insertBefore(card, anchor); } card.hidden = false; var live = st === 'live' && v.today; card.innerHTML = '
' + (live && v.today.stats ? '' + v.today.stats.packs + ' pack' + (v.today.stats.packs === 1 ? '' : 's') + ' so far today. ' : '') + dayLine(v) + ', each day midnight to midnight Central. ' + extras(v) + '
' + '' + esc(v.note) + ' Every pack pays its sponsor line in full, at the normal price.
' + ' Every network deal'; var b = document.getElementById('nwBuy'); if (b) b.addEventListener('click', function () { var m = document.querySelector('.bo-menu [data-pane="buy"]'); if (m) m.click(); else location.href = '/my#buy'; }); var head = card.querySelector('.card-head'); var x = document.createElement('button'); x.type = 'button'; x.className = 'card-x'; x.setAttribute('aria-label', 'Hide for today'); x.textContent = '×'; x.addEventListener('click', function () { hide(key); card.hidden = true; }); head.appendChild(x); } var last = null; function load() { fetch('/api/promodays').then(function (r) { return r.ok ? r.json() : null; }).then(function (v) { if (!v) return; last = v; var st = state(v); paintStrip(v, st); paintCard(v, st); }).catch(function () {}); } function run() { if (!document.getElementById('fdfStrip') && !document.getElementById('fdfCard')) return; load(); setInterval(load, 120000); } if (document.readyState === 'loading') document.addEventListener('DOMContentLoaded', run); else run(); window.__nwCardPaint = function (v) { last = v; var st = state(v); paintStrip(v, st); paintCard(v, st); return st; }; // tests })();