mirror of
https://github.com/screentinker/screentinker.git
synced 2026-06-29 09:23:16 -06:00
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>
33 lines
1.4 KiB
JavaScript
33 lines
1.4 KiB
JavaScript
// External overlay script — same-origin so the server CSP (scriptSrc 'self') permits it.
|
|
// Reads the weather fields from the URL query string and populates the widget.
|
|
(function () {
|
|
var q = new URLSearchParams(location.search);
|
|
var get = function (k) { return (q.get(k) || '').trim(); };
|
|
var set = function (id, txt) { var el = document.getElementById(id); if (el) el.textContent = txt; };
|
|
|
|
if (get('day') === '1') document.getElementById('card').classList.add('day');
|
|
|
|
set('loc', get('location') || 'Weather');
|
|
set('emoji', get('emoji') || '🌡️');
|
|
set('temp', get('temp') !== '' ? get('temp') : '--');
|
|
set('unit', get('tempunit') || '°');
|
|
|
|
var cond = get('cond');
|
|
var feels = get('feels');
|
|
set('cond', cond + (feels !== '' ? ' · feels ' + feels + (get('tempunit') || '°') : ''));
|
|
|
|
var hi = get('hi'), lo = get('lo'), u = get('tempunit') || '°';
|
|
set('hilo', (hi !== '' ? 'H ' + hi + u : '') + (hi !== '' && lo !== '' ? ' ' : '') + (lo !== '' ? 'L ' + lo + u : ''));
|
|
|
|
var extra = [];
|
|
if (get('humidity') !== '') extra.push('💧 ' + get('humidity') + '%');
|
|
if (get('wind') !== '') extra.push('💨 ' + get('wind') + ' ' + (get('windunit') || ''));
|
|
set('extra', extra.join(' '));
|
|
|
|
var updated = get('updated');
|
|
if (updated) {
|
|
var d = new Date(updated);
|
|
set('updated', isNaN(d) ? ('· ' + updated) : ('· ' + d.toLocaleTimeString([], { hour: '2-digit', minute: '2-digit' })));
|
|
}
|
|
})();
|