From 8251c0e6935c8ec13f83475c771f0f66391374d0 Mon Sep 17 00:00:00 2001 From: martbost Date: Mon, 5 Oct 2026 11:57:06 -0500 Subject: [PATCH] Broadcasts: a pop-up when sent (how many members) and when not sent (why); an expired sign-in keeps the draft and offers Sign in again (Brian 2026-10-05) Co-Authored-By: Claude Opus 5.5 --- public/admin.html | 2 +- public/assets/common.js | 4 ++-- public/assets/my.js | 27 +++++++++++++++++++++------ public/contract.html | 2 +- public/disclaimer.html | 2 +- public/earning.html | 2 +- public/friday.html | 2 +- public/index.html | 2 +- public/join.html | 2 +- public/launch.html | 2 +- public/ledger.html | 2 +- public/my.html | 4 ++-- public/partners.html | 2 +- public/plays.html | 2 +- public/privacy.html | 2 +- public/terms.html | 2 +- public/tx.html | 2 +- public/wall.html | 2 +- public/wallets.html | 2 +- public/wednesday.html | 2 +- 20 files changed, 42 insertions(+), 27 deletions(-) diff --git a/public/admin.html b/public/admin.html index 0396cc0..e9d88d9 100644 --- a/public/admin.html +++ b/public/admin.html @@ -520,7 +520,7 @@ - + diff --git a/public/assets/common.js b/public/assets/common.js index 732ffea..9f9e616 100644 --- a/public/assets/common.js +++ b/public/assets/common.js @@ -247,7 +247,7 @@ window.IAP = (function () { : ''; back.innerHTML = ''; + + '
' + (o.noCancel ? '' : '') + '
'; document.body.appendChild(back); const inp = back.querySelector('#dlgInput'); const done = v => { document.removeEventListener('keydown', onKey); back.remove(); resolve(v); }; @@ -255,7 +255,7 @@ window.IAP = (function () { const onKey = e => { if (e.key === 'Escape') { e.preventDefault(); done(o.type === 'none' ? false : null); } else if (e.key === 'Enter' && o.type !== 'textarea') { e.preventDefault(); okv(); } }; document.addEventListener('keydown', onKey); back.querySelector('#dlgOk').addEventListener('click', okv); - back.querySelector('#dlgCancel').addEventListener('click', () => done(o.type === 'none' ? false : null)); + if (back.querySelector('#dlgCancel')) back.querySelector('#dlgCancel').addEventListener('click', () => done(o.type === 'none' ? false : null)); back.addEventListener('click', e => { if (e.target === back) done(o.type === 'none' ? false : null); }); setTimeout(() => { if (inp) { inp.focus(); if (inp.select && o.type !== 'textarea') inp.select(); } else back.querySelector('#dlgOk').focus(); }, 30); }); diff --git a/public/assets/my.js b/public/assets/my.js index 86cfc14..c4a9e39 100644 --- a/public/assets/my.js +++ b/public/assets/my.js @@ -2034,12 +2034,27 @@ const u = await IAP.ask({ title: 'Insert link', text: 'Link URL (https://…)', placeholder: 'https://', ok: 'Insert' }); if (u) { $('bcEd').focus(); if (range) { sel.removeAllRanges(); sel.addRange(range); } document.execCommand('createLink', false, u); } }); - if ($('bcSendBtn')) $('bcSendBtn').addEventListener('click', busy2($('bcSendBtn'), async () => { - const r = await api('/api/my/broadcast', { scope: $('bcScope').value, subject: $('bcSubject').value, body: $('bcEd').innerHTML }); - IAP.status('Broadcast sent to ' + r.sent + ' member' + (r.sent === 1 ? '' : 's') + '.', 'ok'); - $('bcSubject').value = ''; $('bcEd').innerHTML = ''; - $('bcHint').textContent = 'Sent. You can send your next broadcast in 24 hours.'; - })); + // broadcast send (2026-10-05, Brian: "clicking send didn't give me anything to feel it was sent"): a pop-up either way, + // and an expired sign-in keeps the draft so nothing typed is lost + const BC_DRAFT = 'iap.bcDraft'; + try { const d = JSON.parse(localStorage.getItem(BC_DRAFT) || 'null'); if (d && $('bcSubject') && !$('bcSubject').value) { $('bcSubject').value = d.subject || ''; $('bcEd').innerHTML = d.body || ''; if ($('bcScope') && d.scope) $('bcScope').value = d.scope; localStorage.removeItem(BC_DRAFT); } } catch (e) {} + if ($('bcSendBtn')) $('bcSendBtn').addEventListener('click', async () => { + const btn = $('bcSendBtn'); btn.disabled = true; const label = btn.textContent; btn.textContent = 'Sending…'; + try { + const r = await api('/api/my/broadcast', { scope: $('bcScope').value, subject: $('bcSubject').value, body: $('bcEd').innerHTML }); + $('bcSubject').value = ''; $('bcEd').innerHTML = ''; + $('bcHint').textContent = 'Sent. You can send your next broadcast in 24 hours.'; + await IAP.confirmBox('Your broadcast was delivered to ' + r.sent + ' member' + (r.sent === 1 ? '' : 's') + ' in your line. They see it in their Messages, and get a copy by email. You can send your next broadcast in 24 hours.', { title: '✅ Broadcast sent', ok: 'Done', noCancel: true }); + } catch (e) { + const msg = (e && e.message) || String(e); + if (/sign in/i.test(msg)) { + try { localStorage.setItem(BC_DRAFT, JSON.stringify({ subject: $('bcSubject').value, body: $('bcEd').innerHTML, scope: $('bcScope').value })); } catch (x) {} + if (await IAP.confirmBox('Your sign-in expired, so the broadcast was NOT sent. Your message is saved: sign in again and it will be waiting for you here.', { title: 'Not sent yet', ok: 'Sign in again', cancel: 'Close' })) location.href = '/my#line'; + } else { + await IAP.confirmBox(msg + ' Your message is still in the box.', { title: 'Broadcast not sent', ok: 'OK', noCancel: true }); + } + } finally { btn.disabled = false; btn.textContent = label; } + }); // ── solo-ads inbox: list, read view, dwell-gated read reward ── let ibTimer = null; diff --git a/public/contract.html b/public/contract.html index 0a41acc..e218243 100644 --- a/public/contract.html +++ b/public/contract.html @@ -142,7 +142,7 @@
Advertising services with a performance referral program. Not an investment product; no income guarantees. Crypto transactions are irreversible. Never spend what you cannot afford.
- + diff --git a/public/disclaimer.html b/public/disclaimer.html index 72372e1..b86f197 100644 --- a/public/disclaimer.html +++ b/public/disclaimer.html @@ -26,7 +26,7 @@

You decide whether, and how much, to spend. Never spend more than you can afford to lose.

- + diff --git a/public/earning.html b/public/earning.html index 63ca157..38873e1 100644 --- a/public/earning.html +++ b/public/earning.html @@ -84,6 +84,6 @@
Advertising services with a performance referral program. Not an investment product; no income guarantees.
- + diff --git a/public/friday.html b/public/friday.html index 1f9d5c8..2e414ac 100644 --- a/public/friday.html +++ b/public/friday.html @@ -71,6 +71,6 @@ - + diff --git a/public/index.html b/public/index.html index cfa1005..9f92406 100644 --- a/public/index.html +++ b/public/index.html @@ -498,7 +498,7 @@ - + diff --git a/public/join.html b/public/join.html index 12dcb3f..a46c212 100644 --- a/public/join.html +++ b/public/join.html @@ -157,7 +157,7 @@ InstantAdPay · Contract · Terms · Privacy · Disclaimer - + diff --git a/public/launch.html b/public/launch.html index 3a83099..59ef704 100644 --- a/public/launch.html +++ b/public/launch.html @@ -105,7 +105,7 @@
Advertising services with a performance referral program. Not an investment product; no income guarantees.
- + diff --git a/public/ledger.html b/public/ledger.html index 1b3b0cb..aa2074c 100644 --- a/public/ledger.html +++ b/public/ledger.html @@ -40,7 +40,7 @@
InstantAdPay is the Polygon hub of the Crypto Team Build Network.
- + diff --git a/public/my.html b/public/my.html index a46d5b8..177a368 100644 --- a/public/my.html +++ b/public/my.html @@ -1129,10 +1129,10 @@ - + - + diff --git a/public/partners.html b/public/partners.html index 7c26f32..7c8f354 100644 --- a/public/partners.html +++ b/public/partners.html @@ -128,7 +128,7 @@
Advertising services with a performance referral program. Not an investment product; no income guarantees. Crypto transactions are irreversible. Never spend what you cannot afford to lose.
- + diff --git a/public/plays.html b/public/plays.html index 737540c..ac4381e 100644 --- a/public/plays.html +++ b/public/plays.html @@ -193,7 +193,7 @@
Advertising services with a performance referral program. Not an investment product; no income guarantees. Crypto transactions are irreversible. Never spend what you cannot afford.
- + diff --git a/public/privacy.html b/public/privacy.html index d5c8508..f818e44 100644 --- a/public/privacy.html +++ b/public/privacy.html @@ -29,7 +29,7 @@

We use reasonable safeguards, but no system is perfectly secure. Protect your email and your wallet.

- + diff --git a/public/terms.html b/public/terms.html index 4f87830..9c3f482 100644 --- a/public/terms.html +++ b/public/terms.html @@ -38,7 +38,7 @@

See also the Disclaimer and Privacy Policy.

- + diff --git a/public/tx.html b/public/tx.html index cbc4bd3..a946934 100644 --- a/public/tx.html +++ b/public/tx.html @@ -34,7 +34,7 @@

← Back to the live ledger · Read the contract review

- + diff --git a/public/wall.html b/public/wall.html index d8d0aef..7b98ece 100644 --- a/public/wall.html +++ b/public/wall.html @@ -47,7 +47,7 @@ - + diff --git a/public/wallets.html b/public/wallets.html index 82c1f09..e793818 100644 --- a/public/wallets.html +++ b/public/wallets.html @@ -122,7 +122,7 @@
Advertising services with a performance referral program. Not an investment product; no income guarantees. Crypto transactions are irreversible. Never share your recovery phrase.
- + diff --git a/public/wednesday.html b/public/wednesday.html index 84caf3c..7b0ca7a 100644 --- a/public/wednesday.html +++ b/public/wednesday.html @@ -64,6 +64,6 @@ - +