screentinker/Examples/PIP-Welcome-Board/welcome-overlay.js
screentinker 0b138f10c6
Add PiP overlay example recipes (#132)
Self-contained examples for the PiP overlay API (POST /api/pip), each
with a CSP-safe query-param overlay (external JS), config.example.json,
zero runtime deps, an offline test, and a README:

- PIP-Announce-Broadcast    manual one-shot message to a screen/group
- PIP-Weather-Widget        Open-Meteo current conditions (keyless)
- PIP-Air-Quality           Open-Meteo US AQI widget (keyless)
- PIP-Crypto-Ticker         CoinGecko price strip (keyless)
- PIP-News-Ticker           scrolling RSS/Atom headlines
- PIP-Room-Status-Calendar  ICS-driven Available/Busy room sign
- PIP-Event-Countdown       client-side countdown, auto-clears at zero
- PIP-Welcome-Board         rotating welcome/birthday cards from CSV
- PIP-Fundraiser-Thermometer goal-progress bar from local/URL JSON
- PIP-QR-Rotator            rotating QR codes, encoded client-side
- PIP-Incident-Webhook      event-driven: red on firing, clear on resolved

Also includes the CAP-AU (NSW RFS) and US NWS/NOAA emergency-alert
monitors that push expiry-aware PiP overlays.

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-18 20:20:37 -05:00

24 lines
1 KiB
JavaScript

// External overlay script — same-origin so the server CSP (scriptSrc 'self')
// permits it. Reads the card fields from the URL query string. All text is set
// via textContent / element.style, so nothing from the query is ever parsed as
// HTML (XSS-safe).
(function () {
var q = new URLSearchParams(location.search);
var get = function (k) { return (q.get(k) || '').trim(); };
var color = '#' + (get('color').replace(/[^0-9a-fA-F]/g, '') || '1F9D55');
document.getElementById('accent').style.background = color;
var kind = get('kind');
document.getElementById('kind').textContent = kind;
document.getElementById('kind').style.color = color;
document.getElementById('emoji').textContent = get('emoji') || '👋';
document.getElementById('greeting').textContent = get('greeting') || 'Welcome';
document.getElementById('name').textContent = get('name');
var note = get('note');
var noteEl = document.getElementById('note');
if (note) noteEl.textContent = note; else noteEl.style.display = 'none';
})();