Reward / Power-up icon as a top-left sticker on the cassette and the video box

Twitch icons of channel point rewards (custom images) and Custom Power-ups are cached
(10 min, refreshed on unknown triggers, never holding an alert more than 2 s) and
attached as alert.icon; cassette.js and video.js show it as a white-outlined sticker
on the top-left corner.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Bashy 2026-11-22 16:14:39 +02:00
parent b3caac7a31
commit 8ac8fe024c
6 changed files with 63 additions and 7 deletions

View file

@ -17,7 +17,7 @@
if (vid) return;
vid = document.createElement('video'); vid.id = 'vfx-video'; vid.playsInline = true; document.body.appendChild(vid);
box = document.createElement('div'); box.id = 'vfx-box';
box.innerHTML = '<div class="rec">● REC</div><div class="tc"></div><div class="title"></div><div class="who"></div><div class="amt"></div><div class="brand">POWER-UP</div>';
box.innerHTML = '<img class="ico" alt=""><div class="rec">● REC</div><div class="tc"></div><div class="title"></div><div class="who"></div><div class="amt"></div><div class="brand">POWER-UP</div>';
document.body.appendChild(box);
fit(); addEventListener('resize', fit);
}
@ -31,6 +31,8 @@
box.querySelector('.who').textContent = a.user || '';
box.querySelector('.amt').textContent = a.bits ? `◆ ${a.bits} bits ◆` : '';
box.querySelector('.tc').textContent = fmt(0);
const ico = box.querySelector('.ico'); // the Power-up's / reward's Twitch icon, top-left corner
if (a.icon) { ico.src = a.icon; ico.hidden = false; } else { ico.removeAttribute('src'); ico.hidden = true; }
box.style.visibility = 'visible';
box.animate([{ opacity: 0, transform: 'translateY(-12px)' }, { opacity: 1, transform: 'none' }], { duration: 400, easing: 'ease-out', fill: 'both' });
clearInterval(tcTimer); tcTimer = setInterval(() => { box.querySelector('.tc').textContent = fmt(vid.currentTime); }, 250);