From 2659993a7d3b49b1a1a2e9bd39b2ca5d07d517f6 Mon Sep 17 00:00:00 2001 From: Bashy Date: Mon, 23 Nov 2026 11:24:56 +0200 Subject: [PATCH] Poll card and emote effects use the corner sticker from Actions -> Alerts The heart on the winning poll option and the picture when Twitch sends no emote were still a fixed file name; they now come from the alert theme (placeholder when none is set). Co-Authored-By: Claude Opus 5.5 --- public/alerts/fx.js | 5 +++-- public/alerts/poll.js | 5 +++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/public/alerts/fx.js b/public/alerts/fx.js index e1cdaf6..2a4970e 100644 --- a/public/alerts/fx.js +++ b/public/alerts/fx.js @@ -11,7 +11,8 @@ */ (function () { const AFTER_ANIM = 3000, SOUND_LEAD = 300; - const FALLBACK = window.FX_FALLBACK || (window.ALERTS_BASE || '/alerts/') + 'art/Heart.png'; // when Twitch sends no emote + // when Twitch sends no emote: the corner sticker from Actions → Alerts, else a plain shape + const fallback = () => window.FX_FALLBACK || (window.S && window.S.alert_theme && window.S.alert_theme.heart) || (window.ALERTS_BASE || '/alerts/') + 'art/placeholder.svg'; const esc = s => String(s ?? '').replace(/[&<>"]/g, c => ({ '&':'&', '<':'<', '>':'>', '"':'"' }[c])); const between = (a, b) => a + Math.random() * (b - a); @@ -27,7 +28,7 @@ const a = new Audio(url); a.volume = volume; cur.timer = setTimeout(() => { cur.audio = a; a.play().catch(err => console.warn('[alerts] sound blocked:', err.message)); }, SOUND_LEAD); } - const imgTag = (src, cls = '') => ``; + const imgTag = (src, cls = '') => ``; const A = (cur, node, frames, opts) => { const a = node.animate(frames, { fill:'both', ...opts }); cur.anims.push(a); return a; }; const done = (cur, anim) => anim.finished.then(() => hide()).catch(() => {}); diff --git a/public/alerts/poll.js b/public/alerts/poll.js index 0fc9c06..13d4aed 100644 --- a/public/alerts/poll.js +++ b/public/alerts/poll.js @@ -6,7 +6,8 @@ */ (function () { const COLORS = ['#f4a0a8', '#a88be0', '#7fcfa6', '#f6c75b', '#8cc8f0']; - const HEART = (window.ALERTS_BASE || '/alerts/') + 'art/Heart.png'; + // heart on the winning option: the corner sticker from Actions → Alerts, else a plain shape + const heart = () => (window.S && window.S.alert_theme && window.S.alert_theme.heart) || (window.ALERTS_BASE || '/alerts/') + 'art/placeholder.svg'; const SHOW_RESULT_MS = 9000; const esc = s => String(s ?? '').replace(/[&<>"]/g, c => ({ '&':'&', '<':'<', '>':'>', '"':'"' }[c])); let el = null, pollId = null, timer = null, hideTimer = null, endsAt = 0; @@ -25,7 +26,7 @@ ${poll.choices.map((c, i) => `
${esc(c.title)}0
-
`).join('')} + `).join('')}
WINNER
`; el.style.visibility = 'visible'; const tilt = (Math.random() * 4 - 2).toFixed(2);