# Overview announcement cards: the x now hides a card for 24 hours on this browser instead of # "until my next sign-in" (Marty, 2026-10-03: they stack up and greet him at every login). ROOT = 'D:/Projects/HighRisk/onchain-ad-membership/site/' def edit(path, pairs): b = open(ROOT + path, 'rb').read(); crlf = b.count(b'\r\n') > b.count(b'\n') // 2 s = b.decode('utf-8').replace('\r\n', '\n') for a, r in pairs: if s.count(a) != 1: raise SystemExit('%s anchor %d: %s' % (path, s.count(a), a[:70])) s = s.replace(a, r) if crlf: s = s.replace('\n', '\r\n') open(ROOT + path, 'wb').write(s.encode('utf-8')); print('patched', path) edit('public/assets/my.js', [ (" // The announcement cards at the top of the Overview are repeated on a timer, so a member who has read\n" " // one can put it away: dismissed for the rest of this browser session, back at the next sign-in\n" " // (Marty, 2026-09-22) so a message nobody has acted on is never gone for good.\n" " function cardHidden(key) { try { return sessionStorage.getItem('iap-hide-' + key) === '1'; } catch (e) { return false; } }\n", " // The announcement cards at the top of the Overview are repeated on a timer, so a member who has read\n" " // one can put it away: dismissed for 24 hours on this browser (Marty, 2026-10-03; it used to come back\n" " // at every sign-in and the cards stacked up), then it shows again so it is never gone for good.\n" " const CARD_SNOOZE_MS = 24 * 3600 * 1000;\n" " 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; } }\n"), (" x.title = 'Hide this until my next sign-in';\n" " x.setAttribute('aria-label', 'Hide this message until my next sign-in');\n" " x.addEventListener('click', () => { try { sessionStorage.setItem('iap-hide-' + key, '1'); } catch (e) {} card.hidden = true; });\n", " x.title = 'Hide this for 24 hours';\n" " x.setAttribute('aria-label', 'Hide this message for 24 hours');\n" " x.addEventListener('click', () => { try { localStorage.setItem('iap-hide-' + key, String(Date.now())); } catch (e) {} card.hidden = true; });\n"), ]) edit('public/my.html', [('/assets/my.js?v=20261002sdp', '/assets/my.js?v=20261003snz')]) print('ok')