Overview announcement cards: the x hides a card for 24 hours (was until next sign-in, so they stacked up at every login)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
martbost
2026-10-03 09:32:29 -05:00
parent 8f61d11d43
commit 737ed28e1d
3 changed files with 39 additions and 7 deletions
+7 -6
View File
@@ -1596,16 +1596,17 @@
}));
}
// The announcement cards at the top of the Overview are repeated on a timer, so a member who has read
// one can put it away: dismissed for the rest of this browser session, back at the next sign-in
// (Marty, 2026-09-22) so a message nobody has acted on is never gone for good.
function cardHidden(key) { try { return sessionStorage.getItem('iap-hide-' + key) === '1'; } catch (e) { return false; } }
// one can put it away: dismissed for 24 hours on this browser (Marty, 2026-10-03; it used to come back
// at every sign-in and the cards stacked up), then it shows again so it is never gone for good.
const CARD_SNOOZE_MS = 24 * 3600 * 1000;
function cardHidden(key) { try { const t = Number(localStorage.getItem('iap-hide-' + key)); return t > 0 && Date.now() - t < CARD_SNOOZE_MS; } catch (e) { return false; } }
function cardDismiss(card, key) {
if (!card || card.querySelector('.card-x')) return;
const x = document.createElement('button');
x.type = 'button'; x.className = 'card-x'; x.innerHTML = '&times;';
x.title = 'Hide this until my next sign-in';
x.setAttribute('aria-label', 'Hide this message until my next sign-in');
x.addEventListener('click', () => { try { sessionStorage.setItem('iap-hide-' + key, '1'); } catch (e) {} card.hidden = true; });
x.title = 'Hide this for 24 hours';
x.setAttribute('aria-label', 'Hide this message for 24 hours');
x.addEventListener('click', () => { try { localStorage.setItem('iap-hide-' + key, String(Date.now())); } catch (e) {} card.hidden = true; });
(card.querySelector('.card-head') || card).appendChild(x);
}
// Five Dollar Friday card on the Overview: the live wave on Fridays, the date the rest of the week
+1 -1
View File
@@ -1129,7 +1129,7 @@
<script src="/assets/common.js?v=20260929b"></script><script src="/assets/welcome.js?v=20260923b"></script>
<script src="/assets/wallet.js?v=20260911a"></script>
<script src="/assets/promo.js?v=20261002ref"></script>
<script src="/assets/my.js?v=20261002sdp"></script>
<script src="/assets/my.js?v=20261003snz"></script>
<script src="/assets/chat.js?v=20260907l"></script>
</body>
</html>