diff --git a/public/join-now.js b/public/join-now.js index 0799d86..323a4b1 100644 --- a/public/join-now.js +++ b/public/join-now.js @@ -44,9 +44,16 @@ async function loadSponsor(){ try{ - var r=await fetch('/api/public/current-sponsor'); var j=await r.json(); var sp=j&&j.sponsor; + // personal invite: ?ref= -> place in that member's leg via the site's moving-link joinTarget + var ref=new URLSearchParams(location.search).get('ref'); + if(ref&&/^\d{1,15}$/.test(ref)){ + try{ var rm=await (await fetch('/api/public/member?id='+ref)).json(); var t=rm&&rm.joinTarget; + if(t&&t.id){ sponsorId=String(t.id); $('sponsorLine').innerHTML='You’ll join under #'+t.id+''+(String(t.id)!==String(ref)?' — the next open spot in #'+ref+'’s team':'')+'.'; return; } + }catch(e){} + } + var j=await (await fetch('/api/public/current-sponsor')).json(); var sp=j&&j.sponsor; if(sp&&sp.id){ sponsorId=String(sp.id); $('sponsorLine').innerHTML='You’ll join the team under #'+sp.id+(sp.name?' ('+sp.name+')':'')+' — the current team placement.'; } - else { $('sponsorLine').textContent='Loading the current team placement…'; } + else $('sponsorLine').textContent='Loading the current team placement…'; }catch(e){ $('sponsorLine').textContent='Could not load the current sponsor — please refresh.'; } } diff --git a/public/join.js b/public/join.js index 88685ac..be81dd8 100644 --- a/public/join.js +++ b/public/join.js @@ -56,7 +56,7 @@ const t=d.joinTarget||{id:d.id,referralUrl:d.referralUrl,reason:'self'}; joinTargetId=t.id; const jb=document.getElementById('joinBtn'); - if(t.referralUrl)jb.href=t.referralUrl; + jb.href='/join-now?ref='+id; jb.removeAttribute('target'); // self-enroll page, placed in this leg // the join CTA + "join under" header + dApp-sponsor mentions reflect the // ACTUAL sponsor the entry lands on, not the inviter (only the top // "invited by #X" line keeps the inviter's id) diff --git a/public/my.js b/public/my.js index 31823f6..77accd1 100644 --- a/public/my.js +++ b/public/my.js @@ -21,8 +21,8 @@ set('pEarned',Math.round(d.totalEarnedPol||0).toLocaleString()); set('pTeam',(d.subtree&&d.subtree.downCount!=null)?String(d.subtree.downCount):'—'); set('pLevel',d.levelName||'—'); - const jb=document.getElementById('pJoinBtn'); if(jb){jb.href='/join/'+d.id;jb.textContent='Join under #'+d.id+' →';} - const hj=document.getElementById('pHeroJoin'); if(hj)hj.href='/join/'+d.id; + const jb=document.getElementById('pJoinBtn'); if(jb){jb.href='/join-now?ref='+d.id;jb.textContent='Join under #'+d.id+' →';} + const hj=document.getElementById('pHeroJoin'); if(hj)hj.href='/join-now?ref='+d.id; const pp=document.getElementById('pPayouts'); if(pp){ const inc=(d.income||[]).slice(0,3); diff --git a/public/start.html b/public/start.html index 5062423..684b475 100644 --- a/public/start.html +++ b/public/start.html @@ -5,7 +5,7 @@
Current placement

Use the sponsor shown on this page.

Team placements rotate as positions become qualified. Do not use an old screenshot or saved referral link.

-