5613d10224
- netdeals.js + /api/network-deals (hub /v1/network-deals) and /assets/netweekend.js loaded from common.js and netline.js: the ribbon shows only Fri 11-27 00:00 CT to Tue 12-01 00:00 CT by the page's own clock (common/netline ?v=20261117nw) - promos: optional starts (MySQL promo_codes.starts) so a code can be created dormant and open by itself; setClock for tests - weekendfact.js: chatbot FACTS for the event (live deal lines from the hub) Fri to Mon, the WEEKEND500 line to Tue 12-08 00:00 CT - qa/networkweekend.test.cjs: 8 pass (test clocks only) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
42 lines
4.0 KiB
JavaScript
42 lines
4.0 KiB
JavaScript
// "Part of the network" footer line for pages that do not load common.js (Marty 2026-11-14 trust pack): company line + the network
|
|
// list from the hub (/api/network-sites, built-in copy if it does not answer). The current site comes from data-site on this tag.
|
|
(function () {
|
|
var me = (document.currentScript && document.currentScript.getAttribute('data-site')) || 'linkspin';
|
|
var FALLBACK = [['iap', 'InstantAdPay', 'https://instantadpay.com'], ['linkspin', 'LinkSpin', 'https://linkspin.app'], ['dlb', 'Downline Banners', 'https://downlinebanners.com'],
|
|
['vbb', 'Viral Banner Blitz', 'https://viralbannerblitz.com'], ['stackpol', 'Stack POL', 'https://stackpol.com'], ['earnerscorner', 'Earners Corner', 'https://earnerscorner.com']].map(function (a) { return { id: a[0], name: a[1], url: a[2] }; });
|
|
// the links carry a referral username (Marty 2026-11-15): the signed-in member's own, else the referral this visitor came in on
|
|
// (?ref= here, remembered for the visit, then the iap.sponsor cookie; usernames only). Tracked links get it as s1 (LinkSpin sends it
|
|
// on as ?ref=), plain links as ?ref=; Earners Corner none.
|
|
function okRef(v) { return /^[A-Za-z0-9_.-]{1,40}$/.test(v) && !/^\d+$/.test(v) && !/^0x[0-9a-f]{40}$/i.test(v) && v !== 'company' && v !== 'top'; }
|
|
function arrivedRef() {
|
|
try { var q = String(new URLSearchParams(location.search).get('ref') || '').trim().toLowerCase(); if (okRef(q)) { try { sessionStorage.setItem('ls.netref', q); } catch (e) {} return q; } } catch (e) {}
|
|
try { var v = sessionStorage.getItem('ls.netref') || ''; if (okRef(v)) return v; } catch (e) {}
|
|
var m = document.cookie.match(/(?:^|;\s*)iap\.sponsor=([^;]*)/); try { var c = m ? decodeURIComponent(m[1]) : ''; return okRef(c) ? c : ''; } catch (e) { return ''; }
|
|
}
|
|
function withRef(s, ref) {
|
|
var href = s.go || s.url; if (!ref || s.id === 'earnerscorner') return href;
|
|
try { var u = new URL(href); u.searchParams.set(s.go ? 's1' : 'ref', ref); return u.toString(); } catch (e) { return href; }
|
|
}
|
|
function esc(s) { return String(s).replace(/[&<>"]/g, function (c) { return { '&': '&', '<': '<', '>': '>', '"': '"' }[c]; }); }
|
|
function run() {
|
|
var f = document.querySelector('footer'); if (!f || f.querySelector('.netline')) return;
|
|
var host = f.querySelector('.wrap') || f;
|
|
var box = document.createElement('div'); box.className = 'netline';
|
|
box.style.cssText = 'flex-basis:100%;width:100%;margin-top:10px;display:flex;gap:6px 14px;flex-wrap:wrap;align-items:baseline;font-size:12.5px';
|
|
host.appendChild(box);
|
|
var list = FALLBACK, ref = arrivedRef();
|
|
var paint = function () {
|
|
box.innerHTML = '<span style="flex-basis:100%">© 2026 TrustClickz</span><b>Part of the network</b><span>One account across the network:</span>' + list.map(function (s) {
|
|
return s.id === me ? '<span aria-current="page" style="font-weight:700">' + esc(s.name) + ' (you are here)</span>' : '<a href="' + esc(withRef(s, ref)) + '" target="_blank" rel="noopener nofollow">' + esc(s.name) + '</a>';
|
|
}).join('');
|
|
};
|
|
paint();
|
|
fetch('/api/network-sites').then(function (r) { return r.json(); }).then(function (l) { if (Array.isArray(l) && l.length) { list = l; paint(); } }).catch(function () {});
|
|
fetch('/api/me', { credentials: 'same-origin' }).then(function (r) { return r.json(); }).then(function (m) { if (m && m.signedIn && m.username && okRef(m.username)) { ref = m.username; paint(); } }).catch(function () {});
|
|
}
|
|
if (document.readyState === 'loading') document.addEventListener('DOMContentLoaded', run); else run();
|
|
})();
|
|
|
|
// Network Weekend ribbon (Marty 2026-11-17): netweekend.js paints it only while a network event is live (dates from the hub)
|
|
(function () { try { if (window.__nwRibbon || document.querySelector('script[src^="/assets/netweekend.js"]')) return; var s = document.createElement('script'); s.src = '/assets/netweekend.js?v=20261117a'; s.defer = true; s.setAttribute('data-site', 'linkspin'); (document.head || document.documentElement).appendChild(s); } catch (e) {} })();
|