Encode gift/self-fund in share URL so recipients see the exact plan
This commit is contained in:
+23
-3
@@ -1444,7 +1444,7 @@
|
|||||||
<h3 style="margin:0 0 10px;color:var(--accent);font-size:1.15rem;">📖 How to Use This Calculator as a Sponsor</h3>
|
<h3 style="margin:0 0 10px;color:var(--accent);font-size:1.15rem;">📖 How to Use This Calculator as a Sponsor</h3>
|
||||||
<div style="background:var(--bg);border:1px solid var(--border);border-radius:var(--radius-sm);padding:16px;margin-bottom:16px;">
|
<div style="background:var(--bg);border:1px solid var(--border);border-radius:var(--radius-sm);padding:16px;margin-bottom:16px;">
|
||||||
<strong style="color:var(--accent);">🧍♂️ Live Demo Mode (for their eyes)</strong>
|
<strong style="color:var(--accent);">🧍♂️ Live Demo Mode (for their eyes)</strong>
|
||||||
<p style="margin:6px 0 0;font-size:0.88rem;line-height:1.5;">When you set the controls and send someone the share link, they see exactly what you configured — gift level, self-fund level, the full plan. They just open it and read. No account needed.</p>
|
<p style="margin:6px 0 0;font-size:0.88rem;line-height:1.5;">Set the gift and self-fund levels, then copy the share link. When they open it, the calculator loads with those exact settings — they see the plan you built for them. No account needed.</p>
|
||||||
</div>
|
</div>
|
||||||
<div style="background:var(--bg);border:1px solid var(--border);border-radius:var(--radius-sm);padding:16px;margin-bottom:16px;">
|
<div style="background:var(--bg);border:1px solid var(--border);border-radius:var(--radius-sm);padding:16px;margin-bottom:16px;">
|
||||||
<strong style="color:var(--accent);">🎁 Gifting vs Self-Fund</strong>
|
<strong style="color:var(--accent);">🎁 Gifting vs Self-Fund</strong>
|
||||||
@@ -1949,7 +1949,22 @@ document.querySelectorAll('.tab-btn').forEach(btn => {
|
|||||||
document.getElementById('tab-' + btn.dataset.tab).classList.add('active');
|
document.getElementById('tab-' + btn.dataset.tab).classList.add('active');
|
||||||
setTimeout(() => { if (chart1) chart1.resize(); if (chart2) chart2.resize(); if (chart3) chart3.resize(); }, 50);
|
setTimeout(() => { if (chart1) chart1.resize(); if (chart2) chart2.resize(); if (chart3) chart3.resize(); }, 50);
|
||||||
});
|
});
|
||||||
});
|
})();
|
||||||
|
|
||||||
|
// ─── Load URL params (gift, self) into controls ────────
|
||||||
|
(function loadURLParams() {
|
||||||
|
const p = new URLSearchParams(window.location.search);
|
||||||
|
const gift = p.get('gift');
|
||||||
|
const self = p.get('self');
|
||||||
|
if (gift) {
|
||||||
|
const el = document.getElementById('giftLevel');
|
||||||
|
if (el && [...el.options].some(o => o.value === gift)) el.value = gift;
|
||||||
|
}
|
||||||
|
if (self) {
|
||||||
|
const el = document.getElementById('selfFundLevel');
|
||||||
|
if (el && [...el.options].some(o => o.value === self)) el.value = self;
|
||||||
|
}
|
||||||
|
})();
|
||||||
|
|
||||||
updateAll();
|
updateAll();
|
||||||
|
|
||||||
@@ -1967,7 +1982,12 @@ function getBaseUrl() {
|
|||||||
|
|
||||||
function getShareUrl(refUser) {
|
function getShareUrl(refUser) {
|
||||||
const u = refUser || getRefFromURL() || 'cryptoteambuild';
|
const u = refUser || getRefFromURL() || 'cryptoteambuild';
|
||||||
return getBaseUrl() + '?ref=' + encodeURIComponent(u);
|
const gift = document.getElementById('giftLevel').value;
|
||||||
|
const self = document.getElementById('selfFundLevel').value;
|
||||||
|
let url = getBaseUrl() + '?ref=' + encodeURIComponent(u);
|
||||||
|
if (gift !== '0') url += '&gift=' + gift;
|
||||||
|
if (self !== '0') url += '&self=' + self;
|
||||||
|
return url;
|
||||||
}
|
}
|
||||||
|
|
||||||
function updateSharedLinkBox() {
|
function updateSharedLinkBox() {
|
||||||
|
|||||||
Reference in New Issue
Block a user