Files
5xyourteam/public/assets/coach.js
T
martbost 47389a4169 Traffic-exchange frames: framed pages open sign-in, Get a Position, My Team, wallet and off-site links in a new tab carrying ?ref=<sponsor>
Traffic exchanges, rotators and Massifly Adpoints show 5xyourteam.com inside another site's frame, where the browser drops the
SameSite=Lax fx.ref and fx.sid cookies, so signing in, buying or joining from the frame lost the sponsor (Marty 2026-11-19).
- common.js: framed (window.top !== window.self) -> /team, /join, /admin, /sso/ and off-site links get target=_blank
  rel=noopener (on load and again at click time); /team, /join and /sso/ links add ?ref= from the page's ?ref= (or ?r=), the
  coach page it is, or the cookie. The wallet buttons ([data-wallet-signin], Pay = [data-full-window]) open this page in a new
  tab with ?ref= instead of signing inside the frame. Public pages stay in the frame.
- server: /sso/start?...&ref=<name> sets fx.ref first-party and 302s to the plain start; /sso/* sends X-Frame-Options DENY
  (/team and /admin already did). Sponsor rules unchanged.
- coach.js marks the coach; join.js keeps Pay clickable when framed; asset tags bumped.
Checked with the fake traffic-exchange harness (cross-site frame, JS a.click()): 11/11 flows open a new tab with the sponsor.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-19 07:21:13 -06:00

16 lines
1.2 KiB
JavaScript

// A coach page, 5xyourteam.com/<username>: the coach card (since, positions, picks started) and the team as trading cards. Public:
// milestones only, never earnings or contact details.
(async function () {
FX.renderNav(''); FX.renderFooter();
const $ = FX.$, esc = FX.esc;
const u = decodeURIComponent(location.pathname.replace(/^\/|\/$/g, ''));
document.body.dataset.pageRef = u; // framed: new-tab sign-in and Get a Position links carry ?ref=<this coach> (common.js)
const d = await FX.getJSON('/api/coach?u=' + encodeURIComponent(u));
if (d.error) { $('cName').textContent = 'No coach by that name yet'; return; }
$('cName').textContent = '@' + d.username;
$('cSince').textContent = 'Coach since ' + FX.when(d.since);
$('cStats').innerHTML = '<div class="kvr"><span>Positions</span><b>' + FX.n(d.positions) + '</b></div><div class="kvr"><span>On the team</span><b>' + FX.n(d.team.length) + '</b></div><div class="kvr"><span>Picks started</span><b>' + FX.n(d.started) + '</b></div>';
$('cTeam').innerHTML = d.team.length ? d.team.map(x => FX.card(x)).join('') : '<p class="muted">Their first picks show here.</p>';
$('cJoin').href = d.joinUrl; $('cJoin').textContent = 'Join the network free under @' + d.username; FX.frameLinks();
})();