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 <noreply@anthropic.com>
This commit is contained in:
Bashy 2026-11-23 11:24:56 +02:00
parent c481ca92cb
commit 2659993a7d
2 changed files with 6 additions and 4 deletions

View file

@ -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 => ({ '&':'&amp;', '<':'&lt;', '>':'&gt;', '"':'&quot;' }[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 = '') => `<img class="${cls}" src="${esc(src || FALLBACK)}" alt="" onerror="this.onerror=null;this.src='${FALLBACK}'">`;
const imgTag = (src, cls = '') => `<img class="${cls}" src="${esc(src || fallback())}" alt="" onerror="this.onerror=null;this.src='${fallback()}'">`;
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(() => {});