refactor: split monolithic index.php into src/tpl + src/js modules
This commit is contained in:
@@ -0,0 +1,35 @@
|
||||
// ── RESPONSIVE SWITCH ─────────────────────────────────────────────────────────
|
||||
let lastMobile = null;
|
||||
window.addEventListener('resize', () => {
|
||||
const m = isMobile();
|
||||
if (m !== lastMobile) { lastMobile=m; scrollListenerAdded=false; if (channels.length) renderAll(); }
|
||||
});
|
||||
|
||||
window.addEventListener('load', () => {
|
||||
const savedSource = localStorage.getItem('gridtv-active-source');
|
||||
if (savedSource === 'personal') {
|
||||
const epg = localStorage.getItem('gridtv-personal-epg');
|
||||
const m3u = localStorage.getItem('gridtv-personal-m3u') ?? '';
|
||||
if (epg) {
|
||||
currentEpgUrl = epg;
|
||||
currentM3uUrl = m3u;
|
||||
const sel = document.getElementById('sourceSelect');
|
||||
if (sel) sel.value = 'personal';
|
||||
loadEPG(epg);
|
||||
if (m3u) loadM3U(m3u);
|
||||
return;
|
||||
}
|
||||
} else if (savedSource !== null) {
|
||||
const idx = parseInt(savedSource);
|
||||
const src = EPG_SOURCES[idx];
|
||||
if (src) {
|
||||
activeSourceIndex = idx;
|
||||
currentEpgUrl = src.epg_url;
|
||||
currentM3uUrl = src.m3u_url ?? '';
|
||||
const sel = document.getElementById('sourceSelect');
|
||||
if (sel) sel.value = idx;
|
||||
}
|
||||
}
|
||||
loadEPG(currentEpgUrl);
|
||||
loadM3U(currentM3uUrl);
|
||||
});
|
||||
Reference in New Issue
Block a user