refactor: split monolithic index.php into src/tpl + src/js modules

This commit is contained in:
Johnnybegood90
2026-03-11 23:47:22 +01:00
parent 2b163be684
commit 0be8c34b31
17 changed files with 1526 additions and 1517 deletions
+27
View File
@@ -0,0 +1,27 @@
// ── HELPERS ──────────────────────────────────────────────────────────────────
function getNowPlaying(chId) {
const now = new Date();
const p = (programs[chId] || []).find(p => p.start <= now && p.stop > now);
return p ? p.title : null;
}
// ── TOOLTIP ───────────────────────────────────────────────────────────────────
function showTooltip(e, p) {
const ep = fmtEpisode(p.season, p.episode);
document.getElementById('tt-title').textContent = p.title + (ep ? ' ' + ep : '');
document.getElementById('tt-time').textContent = `${fmtTime(p.start)}${fmtTime(p.stop)} · ${Math.round((p.stop-p.start)/60000)} min`;
document.getElementById('tt-desc').textContent = p.desc || '—';
document.getElementById('tooltip').classList.add('visible');
moveTooltip(e);
}
function moveTooltip(e) {
const tt = document.getElementById('tooltip');
const x=e.clientX+16, y=e.clientY+16;
tt.style.left = (x+tt.offsetWidth >window.innerWidth ? x-tt.offsetWidth -32 : x)+'px';
tt.style.top = (y+tt.offsetHeight>window.innerHeight ? y-tt.offsetHeight-32 : y)+'px';
}
function hideTooltip() { document.getElementById('tooltip').classList.remove('visible'); }