From 7caff0eea25bd54073bcb4186f106969160f433d Mon Sep 17 00:00:00 2001 From: martbost Date: Mon, 7 Sep 2026 06:34:49 -0500 Subject: [PATCH] Unblock testing: message-your-sponsor entries, video pause-on-blur, tour polish - Sponsor messaging is now reachable everywhere a new referral looks: a "Message your sponsor" card on My line, the Overview quick action, and a pinned "Message your sponsor" row atop the Messages drawer (even with no thread yet). Chat stores the sponsor from the dashboard. - Watch-to-earn video + Shorts now PAUSE when the tab/window loses focus and resume on return, so a viewer must stay on the page for the watch to count. - Welcome tour hides its frame on completion (no white about:blank panel). NOTE: rmcircle.team allows framing (frame-ancestors *); the blank was just the post-dwell blank state. Co-Authored-By: Claude Opus 4.8 --- a.jar | 5 +++++ b.jar | 5 +++++ p.jar | 5 +++++ public/assets/my.js | 34 ++++++++++++++++++++++++++++++---- public/assets/shorts.js | 7 +++++++ public/my.html | 16 +++++++++++----- public/shorts.html | 2 +- 7 files changed, 64 insertions(+), 10 deletions(-) create mode 100644 a.jar create mode 100644 b.jar create mode 100644 p.jar diff --git a/a.jar b/a.jar new file mode 100644 index 0000000..7394399 --- /dev/null +++ b/a.jar @@ -0,0 +1,5 @@ +# Netscape HTTP Cookie File +# https://curl.se/docs/http-cookies.html +# This file was generated by libcurl! Edit at your own risk. + +#HttpOnly_127.0.0.1 FALSE / FALSE 1788867258 iap.sid ef5bf189318d5c20a0d3c252de07f6c5d3b15d05c4749e71344c5e279ff8f35f diff --git a/b.jar b/b.jar new file mode 100644 index 0000000..670e8ca --- /dev/null +++ b/b.jar @@ -0,0 +1,5 @@ +# Netscape HTTP Cookie File +# https://curl.se/docs/http-cookies.html +# This file was generated by libcurl! Edit at your own risk. + +#HttpOnly_127.0.0.1 FALSE / FALSE 1788867258 iap.sid 83b4332fb0ddfa471e537298108a022c1c214444846494075bfa4d432ac7a683 diff --git a/p.jar b/p.jar new file mode 100644 index 0000000..63b6835 --- /dev/null +++ b/p.jar @@ -0,0 +1,5 @@ +# Netscape HTTP Cookie File +# https://curl.se/docs/http-cookies.html +# This file was generated by libcurl! Edit at your own risk. + +#HttpOnly_127.0.0.1 FALSE / FALSE 1788866028 iap.sid 6ee49f05f7b3b754792fda5f81d92f5d79f8e560853a982c2234ceae281d552c diff --git a/public/assets/my.js b/public/assets/my.js index 07fd3c4..f638c92 100644 --- a/public/assets/my.js +++ b/public/assets/my.js @@ -769,6 +769,14 @@ $('vidStartBtn').textContent = 'Next video'; } $('vidStartBtn').addEventListener('click', () => loadVideoAd()); + // presence enforcement: pause the watch-to-earn video when the tab/window loses focus, + // resume when it comes back — the viewer must stay on the page for the watch to complete + document.addEventListener('visibilitychange', () => { + const p = $('vidPlayer'); if (!p || !p.src) return; + if (document.hidden) p.pause(); else if (!vidState.done) p.play().catch(() => {}); + }); + window.addEventListener('blur', () => { const p = $('vidPlayer'); if (p && p.src) p.pause(); }); + window.addEventListener('focus', () => { const p = $('vidPlayer'); if (p && p.src && !vidState.done) p.play().catch(() => {}); }); // ── unmissable sponsor-message modal on sign-in ── function showSponsorModal(msg) { @@ -1215,6 +1223,7 @@ const s = g.slides[i]; $('ggWho').textContent = 'Position ' + (i + 1) + ': ' + s.name + (i === 0 ? ' — the person who invited you' : ''); $('ggProgress').textContent = 'Meeting your line: ' + (i + 1) + ' of ' + g.slides.length; + $('ggFrame').hidden = false; $('ggFrame').src = s.targetUrl; let left = g.dwell || 10; $('ggTimer').textContent = left + 's'; @@ -1228,6 +1237,7 @@ }); } $('ggFrame').src = 'about:blank'; + $('ggFrame').hidden = true; // avoid a white about:blank panel once the tour is done $('ggTimer').textContent = '✓'; $('ggWho').textContent = 'That is your line. When you grow, they earn — and yours starts the day you share.'; $('ggClaim').hidden = false; @@ -1371,17 +1381,24 @@ } // ── SPONSOR CHAT: two-way threads, presence-aware, with a slide-in drawer ── - let CHAT_ME = null, CHAT_OTHER = null, CHAT_LASTID = 0, CHAT_POLL = null, CHAT_CANMUTE = false, CHAT_IMUTE = false; + let CHAT_ME = null, CHAT_OTHER = null, CHAT_LASTID = 0, CHAT_POLL = null, CHAT_CANMUTE = false, CHAT_IMUTE = false, CHAT_SPONSOR = null; function chatSync(d) { CHAT_ME = d.email || CHAT_ME; + CHAT_SPONSOR = (d.sponsor && d.sponsor.email) ? d.sponsor : null; const link = $('chatMenuBtn'); if (link && link.closest('.bo-links')) link.closest('.bo-links').hidden = !d.email; setChatBadge(d.chatUnread || 0); const tog = $('chatAvailToggle'); if (tog) tog.checked = d.chatAvailable !== false; + // Overview quick action + My line card: message-your-sponsor entry points const qs = $('qaMsgSponsor'); if (qs) { - if (d.sponsor && d.sponsor.email) { qs.hidden = false; qs.dataset.email = d.sponsor.email; qs.dataset.name = d.sponsor.name || 'your sponsor'; } + if (CHAT_SPONSOR) { qs.hidden = false; qs.dataset.email = CHAT_SPONSOR.email; qs.dataset.name = CHAT_SPONSOR.name || 'your sponsor'; } else qs.hidden = true; } + const card = $('sponsorMsgCard'); + if (card) { + card.hidden = !CHAT_SPONSOR; + if (CHAT_SPONSOR && $('sponsorMsgName')) $('sponsorMsgName').textContent = CHAT_SPONSOR.name || 'your sponsor'; + } } function setChatBadge(n) { const b = $('chatNavBadge'); if (b) { b.hidden = !n; b.textContent = n > 9 ? '9+' : n; } } function stopPoll() { if (CHAT_POLL) { clearInterval(CHAT_POLL); CHAT_POLL = null; } } @@ -1399,8 +1416,16 @@ try { const r = await (await fetch('/api/my/chat/threads')).json(); const list = r.threads || []; - if (!list.length) { $('chatThreads').innerHTML = '
No conversations yet. Message your sponsor from Overview, or anyone in your line from “My line”.
'; return; } - $('chatThreads').innerHTML = list.map(t => + // always offer "message your sponsor" up top when they have one and no thread yet + const hasSponsorThread = CHAT_SPONSOR && list.some(t => t.email === CHAT_SPONSOR.email); + const sponsorRow = (CHAT_SPONSOR && !hasSponsorThread) + ? '
' + + '' + + '
' + esc(CHAT_SPONSOR.name) + '
' + + '
Your sponsor · tap to message
' + : ''; + if (!list.length && !sponsorRow) { $('chatThreads').innerHTML = '
No conversations yet. You can message anyone in your line from “My line”.
'; return; } + $('chatThreads').innerHTML = sponsorRow + list.map(t => '
' + '' + '
' + esc(t.name) + '
' @@ -1491,6 +1516,7 @@ inp.addEventListener('keydown', e => { if (e.key === 'Enter' && !e.shiftKey) { e.preventDefault(); chatSend(); } }); } on('qaMsgSponsor', 'click', () => { const q = $('qaMsgSponsor'); if (q.dataset.email) openConvo(q.dataset.email, q.dataset.name || 'your sponsor'); }); + on('lineMsgSponsor', 'click', () => { if (CHAT_SPONSOR) openConvo(CHAT_SPONSOR.email, CHAT_SPONSOR.name || 'your sponsor'); }); on('chatAvailToggle', 'change', async () => { const t = $('chatAvailToggle'); try { await api('/api/my/chat/available', { available: t.checked }); IAP.status(t.checked ? 'You are available to chat with your line.' : 'Live chat off. People can still leave you a note.', 'ok'); } diff --git a/public/assets/shorts.js b/public/assets/shorts.js index ff69b7e..4f5b4c8 100644 --- a/public/assets/shorts.js +++ b/public/assets/shorts.js @@ -53,6 +53,13 @@ $('shNext').hidden = false; } $('shNext').addEventListener('click', load); + // presence enforcement: pause when the tab/window loses focus, resume on return + document.addEventListener('visibilitychange', () => { + const v = $('shVideo'); if (!v || !v.src) return; + if (document.hidden) v.pause(); else if (!st.done) v.play().catch(() => {}); + }); + window.addEventListener('blur', () => { const v = $('shVideo'); if (v && v.src) v.pause(); }); + window.addEventListener('focus', () => { const v = $('shVideo'); if (v && v.src && !st.done) v.play().catch(() => {}); }); // tap the video to pause/resume $('shVideo').addEventListener('click', () => { const v = $('shVideo'); if (v.paused) v.play(); else v.pause(); }); load(); diff --git a/public/my.html b/public/my.html index 39a824c..5242981 100644 --- a/public/my.html +++ b/public/my.html @@ -4,7 +4,7 @@ Member area | InstantAdPay - + @@ -222,6 +222,12 @@
- - - - + + + + diff --git a/public/shorts.html b/public/shorts.html index 34a83a7..2101abd 100644 --- a/public/shorts.html +++ b/public/shorts.html @@ -43,6 +43,6 @@ - +