Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e924c945d6 | ||
|
|
7b42539bc8 | ||
|
|
d7617bfeaa | ||
|
|
23e0f29990 | ||
|
|
2b201b7ec3 | ||
|
|
c905497c38 | ||
|
|
14ddd411b0 | ||
|
|
54265a2d9f | ||
|
|
d81e8d70c8 | ||
|
|
de7ef1645b | ||
|
|
8826926168 |
@@ -27,16 +27,20 @@ This demo runs with sample XMLTV feeds to showcase the interface.
|
|||||||
## ✨ Features
|
## ✨ Features
|
||||||
|
|
||||||
- 🎛️ **Timeline grid** — horizontal EPG-style view with a live "now" indicator
|
- 🎛️ **Timeline grid** — horizontal EPG-style view with a live "now" indicator
|
||||||
|
- 📅 **Date in timebar** — midnight markers show the day/date so you always know where you are
|
||||||
- 📱 **Responsive** — optimized list view on mobile
|
- 📱 **Responsive** — optimized list view on mobile
|
||||||
- ⏱️ **Live progress bar** on the currently airing program
|
- ⏱️ **Live progress bar** on the currently airing program
|
||||||
- 🕶️ **Past programs** automatically dimmed
|
- 🕶️ **Past programs** automatically dimmed
|
||||||
- 📋 **Hover tooltip** — title, synopsis, season/episode, schedule, duration
|
- 📋 **Hover tooltip** — title, synopsis, season/episode, schedule, duration
|
||||||
|
- 🎬 **Program popup** — click any program for full details + IMDb search link
|
||||||
- 🔗 **One-click copy** buttons for EPG & M3U URLs in the topbar
|
- 🔗 **One-click copy** buttons for EPG & M3U URLs in the topbar
|
||||||
- ▶️ **Built-in HLS player** — click any channel or live program to watch in a PiP overlay
|
- ▶️ **Built-in HLS player** — click any channel or live program to watch in a PiP overlay
|
||||||
- 🔀 **HTTP→HTTPS proxy** — streams Tunarr over HTTP transparently from an HTTPS page
|
- 🔀 **HTTP→HTTPS proxy** — streams Tunarr over HTTP transparently from an HTTPS page
|
||||||
- 🎨 **Theme system** — drop a CSS file in `themes/` and it appears in the menu automatically
|
- 🎨 **Theme system** — drop a CSS file in `themes/` and it appears in the menu automatically
|
||||||
- 📡 **Multi-EPG sources** — configure multiple EPG/M3U sources, switch from the topbar
|
- 📡 **Multi-EPG sources** — configure multiple EPG/M3U sources, switch from the topbar
|
||||||
- 👤 **Personal EPG** — optionally let visitors use your instance with their own EPG/M3U URLs (saved in localStorage)
|
- 👤 **Personal EPG** — optionally let visitors use your instance with their own EPG/M3U URLs (saved in localStorage)
|
||||||
|
- 🔍 **Search** — filter the grid by channel name or program title/synopsis (debounced)
|
||||||
|
- 🌍 **i18n** — auto-detects browser language, supports EN / FR / ES (add your own in `locales/`)
|
||||||
- ⚙️ **Guided setup** on first launch — no config files to edit manually
|
- ⚙️ **Guided setup** on first launch — no config files to edit manually
|
||||||
- 🔄 **Auto-reload** EPG every 30 minutes
|
- 🔄 **Auto-reload** EPG every 30 minutes
|
||||||
- 0️⃣ **Zero JS dependencies** — vanilla PHP, hls.js loaded from CDN
|
- 0️⃣ **Zero JS dependencies** — vanilla PHP, hls.js loaded from CDN
|
||||||
@@ -208,21 +212,25 @@ gridtv/
|
|||||||
├── Dockerfile
|
├── Dockerfile
|
||||||
├── docker-compose.yml
|
├── docker-compose.yml
|
||||||
├── .gitignore # config.json excluded
|
├── .gitignore # config.json excluded
|
||||||
|
├── locales/ # i18n translation files
|
||||||
|
│ ├── en.json
|
||||||
|
│ ├── fr.json
|
||||||
|
│ └── es.json
|
||||||
├── themes/ # CSS theme files
|
├── themes/ # CSS theme files
|
||||||
│ ├── default.css
|
│ ├── default.css
|
||||||
│ ├── magazine.css
|
│ ├── magazine.css
|
||||||
│ ├── cyberpunk.css
|
│ ├── cyberpunk.css
|
||||||
│ └── steampunk.css
|
│ └── steampunk.css
|
||||||
└── src/
|
└── src/
|
||||||
├── config.php # Config loader + migration
|
├── config.php # Config loader, migration, locale detection
|
||||||
├── tpl/ # HTML templates
|
├── tpl/ # HTML templates
|
||||||
│ ├── head.php # DOCTYPE, <head>, CSS
|
│ ├── head.php # DOCTYPE, <head>, CSS
|
||||||
│ ├── topbar.php # Topbar (nav, source switcher, search, theme)
|
│ ├── topbar.php # Topbar (nav, source switcher, search, theme)
|
||||||
│ ├── grid.php # Grid + mobile + PiP + overlays
|
│ ├── grid.php # Grid + mobile + PiP + overlays
|
||||||
│ ├── modals.php # Personal EPG modal
|
│ ├── modals.php # Program info modal + Personal EPG modal
|
||||||
│ └── footer.php # JS modules loader, </body></html>
|
│ └── footer.php # JS modules loader, </body></html>
|
||||||
└── js/ # JavaScript modules
|
└── js/ # JavaScript modules
|
||||||
├── config.js # Constants + PHP-injected vars
|
├── config.js # Constants + PHP-injected vars (incl. locale)
|
||||||
├── utils.js # Helpers, clock, EPG fetch
|
├── utils.js # Helpers, clock, EPG fetch
|
||||||
├── epg.js # Grid rendering
|
├── epg.js # Grid rendering
|
||||||
├── mobile.js # Mobile list view
|
├── mobile.js # Mobile list view
|
||||||
@@ -232,6 +240,7 @@ gridtv/
|
|||||||
├── player.js # HLS PiP player
|
├── player.js # HLS PiP player
|
||||||
├── themes.js # Theme switcher
|
├── themes.js # Theme switcher
|
||||||
├── search.js # Search + filter (debounced)
|
├── search.js # Search + filter (debounced)
|
||||||
|
├── program.js # Program info modal + IMDb link
|
||||||
└── live.js # Live updates + responsive
|
└── live.js # Live updates + responsive
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -296,6 +305,22 @@ GridTV parses the standard **XMLTV format**. Tested with:
|
|||||||
- ✅ [Jellyfin](https://jellyfin.org/)
|
- ✅ [Jellyfin](https://jellyfin.org/)
|
||||||
- ✅ Any XMLTV-compliant source
|
- ✅ Any XMLTV-compliant source
|
||||||
|
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 🌍 Internationalization
|
||||||
|
|
||||||
|
GridTV auto-detects the visitor's browser language and serves the matching locale. Supported out of the box: **English**, **French**, **Spanish**.
|
||||||
|
|
||||||
|
To add a new language, create a file in `locales/` based on an existing one:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
cp locales/en.json locales/de.json
|
||||||
|
# then translate the values
|
||||||
|
```
|
||||||
|
|
||||||
|
GridTV will automatically pick it up for browsers with that language set — no code changes needed.
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
## 🤝 Contributing
|
## 🤝 Contributing
|
||||||
@@ -322,7 +347,10 @@ GNU Affero General Public License v3.0 (AGPLv3)
|
|||||||
- Personal EPG (localStorage)
|
- Personal EPG (localStorage)
|
||||||
- Modular codebase (src/tpl + src/js)
|
- Modular codebase (src/tpl + src/js)
|
||||||
- Docker support
|
- Docker support
|
||||||
- **Search** — filter grid by channel name or program title/synopsis
|
- **Search** — filter grid by channel name or program title/synopsis (debounced)
|
||||||
|
- **Date in timebar** — midnight markers with day/date in the ruler
|
||||||
|
- **Program popup** — full details + IMDb search link on any program click
|
||||||
|
- **i18n** — EN / FR / ES with browser auto-detection, extensible via locales/
|
||||||
|
|
||||||
### 🔜 Coming soon
|
### 🔜 Coming soon
|
||||||
- **Favorites** — pin channels to the top of the grid (localStorage)
|
- **Favorites** — pin channels to the top of the grid (localStorage)
|
||||||
|
|||||||
Binary file not shown.
|
Before Width: | Height: | Size: 642 KiB After Width: | Height: | Size: 1.0 MiB |
@@ -0,0 +1,53 @@
|
|||||||
|
{
|
||||||
|
"days": [
|
||||||
|
"Sun",
|
||||||
|
"Mon",
|
||||||
|
"Tue",
|
||||||
|
"Wed",
|
||||||
|
"Thu",
|
||||||
|
"Fri",
|
||||||
|
"Sat"
|
||||||
|
],
|
||||||
|
"months": [
|
||||||
|
"Jan",
|
||||||
|
"Feb",
|
||||||
|
"Mar",
|
||||||
|
"Apr",
|
||||||
|
"May",
|
||||||
|
"Jun",
|
||||||
|
"Jul",
|
||||||
|
"Aug",
|
||||||
|
"Sep",
|
||||||
|
"Oct",
|
||||||
|
"Nov",
|
||||||
|
"Dec"
|
||||||
|
],
|
||||||
|
"now": "Now",
|
||||||
|
"channels": "Channels",
|
||||||
|
"live": "LIVE",
|
||||||
|
"loading": "Loading guide...",
|
||||||
|
"epg_error": "Unable to load EPG",
|
||||||
|
"epg_error_sub": "Check your XMLTV stream URL.",
|
||||||
|
"load": "Load",
|
||||||
|
"search_placeholder": "Search channel or program...",
|
||||||
|
"copy_epg": "EPG",
|
||||||
|
"copy_m3u": "M3U",
|
||||||
|
"copied": "✓ copied",
|
||||||
|
"program_info": "Program info",
|
||||||
|
"watch_now": "Watch now",
|
||||||
|
"imdb_search": "Search on IMDb",
|
||||||
|
"close": "Close",
|
||||||
|
"duration_min": "min",
|
||||||
|
"personal_epg_title": "Personal EPG",
|
||||||
|
"personal_epg_subtitle": "Use your own EPG/M3U source on this instance.",
|
||||||
|
"personal_epg_label": "EPG URL (XMLTV) *",
|
||||||
|
"personal_epg_m3u_label": "M3U URL",
|
||||||
|
"personal_epg_optional": "optional",
|
||||||
|
"cancel": "Cancel",
|
||||||
|
"apply": "Apply",
|
||||||
|
"setup_already_done": "Configuration already done. Use your admin key to access setup again.",
|
||||||
|
"shift_back": "◄ 1h",
|
||||||
|
"shift_fwd": "1h ►",
|
||||||
|
"fav_add": "Add to favorites",
|
||||||
|
"fav_remove": "Remove from favorites"
|
||||||
|
}
|
||||||
@@ -0,0 +1,53 @@
|
|||||||
|
{
|
||||||
|
"days": [
|
||||||
|
"Dom",
|
||||||
|
"Lun",
|
||||||
|
"Mar",
|
||||||
|
"Mié",
|
||||||
|
"Jue",
|
||||||
|
"Vie",
|
||||||
|
"Sáb"
|
||||||
|
],
|
||||||
|
"months": [
|
||||||
|
"Ene",
|
||||||
|
"Feb",
|
||||||
|
"Mar",
|
||||||
|
"Abr",
|
||||||
|
"May",
|
||||||
|
"Jun",
|
||||||
|
"Jul",
|
||||||
|
"Ago",
|
||||||
|
"Sep",
|
||||||
|
"Oct",
|
||||||
|
"Nov",
|
||||||
|
"Dic"
|
||||||
|
],
|
||||||
|
"now": "Ahora",
|
||||||
|
"channels": "Canales",
|
||||||
|
"live": "LIVE",
|
||||||
|
"loading": "Cargando guía...",
|
||||||
|
"epg_error": "No se puede cargar el EPG",
|
||||||
|
"epg_error_sub": "Comprueba la URL de tu fuente XMLTV.",
|
||||||
|
"load": "Cargar",
|
||||||
|
"search_placeholder": "Buscar canal o programa...",
|
||||||
|
"copy_epg": "EPG",
|
||||||
|
"copy_m3u": "M3U",
|
||||||
|
"copied": "✓ copiado",
|
||||||
|
"program_info": "Info del programa",
|
||||||
|
"watch_now": "Ver ahora",
|
||||||
|
"imdb_search": "Buscar en IMDb",
|
||||||
|
"close": "Cerrar",
|
||||||
|
"duration_min": "min",
|
||||||
|
"personal_epg_title": "EPG Personal",
|
||||||
|
"personal_epg_subtitle": "Usa tu propia fuente EPG/M3U en esta instancia.",
|
||||||
|
"personal_epg_label": "URL EPG (XMLTV) *",
|
||||||
|
"personal_epg_m3u_label": "URL M3U",
|
||||||
|
"personal_epg_optional": "opcional",
|
||||||
|
"cancel": "Cancelar",
|
||||||
|
"apply": "Aplicar",
|
||||||
|
"setup_already_done": "Configuración ya realizada. Usa tu clave de administrador para volver al setup.",
|
||||||
|
"shift_back": "◄ 1h",
|
||||||
|
"shift_fwd": "1h ►",
|
||||||
|
"fav_add": "Agregar a favoritos",
|
||||||
|
"fav_remove": "Quitar de favoritos"
|
||||||
|
}
|
||||||
@@ -0,0 +1,53 @@
|
|||||||
|
{
|
||||||
|
"days": [
|
||||||
|
"Dim",
|
||||||
|
"Lun",
|
||||||
|
"Mar",
|
||||||
|
"Mer",
|
||||||
|
"Jeu",
|
||||||
|
"Ven",
|
||||||
|
"Sam"
|
||||||
|
],
|
||||||
|
"months": [
|
||||||
|
"Jan",
|
||||||
|
"Fév",
|
||||||
|
"Mar",
|
||||||
|
"Avr",
|
||||||
|
"Mai",
|
||||||
|
"Jun",
|
||||||
|
"Jul",
|
||||||
|
"Aoû",
|
||||||
|
"Sep",
|
||||||
|
"Oct",
|
||||||
|
"Nov",
|
||||||
|
"Déc"
|
||||||
|
],
|
||||||
|
"now": "Maintenant",
|
||||||
|
"channels": "Chaînes",
|
||||||
|
"live": "LIVE",
|
||||||
|
"loading": "Chargement du guide...",
|
||||||
|
"epg_error": "Impossible de charger l'EPG",
|
||||||
|
"epg_error_sub": "Vérifiez l'URL de votre flux XMLTV.",
|
||||||
|
"load": "Charger",
|
||||||
|
"search_placeholder": "Rechercher une chaîne ou un programme...",
|
||||||
|
"copy_epg": "EPG",
|
||||||
|
"copy_m3u": "M3U",
|
||||||
|
"copied": "✓ copié",
|
||||||
|
"program_info": "Infos programme",
|
||||||
|
"watch_now": "Regarder",
|
||||||
|
"imdb_search": "Rechercher sur IMDb",
|
||||||
|
"close": "Fermer",
|
||||||
|
"duration_min": "min",
|
||||||
|
"personal_epg_title": "EPG Personnel",
|
||||||
|
"personal_epg_subtitle": "Utilisez votre propre source EPG/M3U sur cette instance.",
|
||||||
|
"personal_epg_label": "URL EPG (XMLTV) *",
|
||||||
|
"personal_epg_m3u_label": "URL M3U",
|
||||||
|
"personal_epg_optional": "optionnel",
|
||||||
|
"cancel": "Annuler",
|
||||||
|
"apply": "Appliquer",
|
||||||
|
"setup_already_done": "Configuration déjà effectuée. Utilisez votre clé admin pour accéder à nouveau au setup.",
|
||||||
|
"shift_back": "◄ 1h",
|
||||||
|
"shift_fwd": "1h ►",
|
||||||
|
"fav_add": "Ajouter aux favoris",
|
||||||
|
"fav_remove": "Retirer des favoris"
|
||||||
|
}
|
||||||
+13
-1
@@ -30,9 +30,21 @@ $allow_personal_epg = !empty($config['allow_personal_epg']);
|
|||||||
$first_source = $epg_sources[0] ?? [];
|
$first_source = $epg_sources[0] ?? [];
|
||||||
$epg_url = htmlspecialchars($first_source['epg_url'] ?? '');
|
$epg_url = htmlspecialchars($first_source['epg_url'] ?? '');
|
||||||
$m3u_url = htmlspecialchars($first_source['m3u_url'] ?? '');
|
$m3u_url = htmlspecialchars($first_source['m3u_url'] ?? '');
|
||||||
|
|
||||||
|
// ── Locale detection ─────────────────────────────────────────────────────────
|
||||||
|
$supported_locales = ['en', 'fr', 'es'];
|
||||||
|
$locale = 'en';
|
||||||
|
$accept = $_SERVER['HTTP_ACCEPT_LANGUAGE'] ?? 'en';
|
||||||
|
foreach (explode(',', $accept) as $lang) {
|
||||||
|
$code = strtolower(substr(trim($lang), 0, 2));
|
||||||
|
if (in_array($code, $supported_locales)) { $locale = $code; break; }
|
||||||
|
}
|
||||||
|
$locale_path = __DIR__ . "/../locales/{$locale}.json";
|
||||||
|
$L = json_decode(file_get_contents($locale_path), true);
|
||||||
|
// ─────────────────────────────────────────────────────────────────────────────
|
||||||
?>
|
?>
|
||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html lang="fr">
|
<html lang="<?= $locale ?>">
|
||||||
<head>
|
<head>
|
||||||
<meta charset="UTF-8">
|
<meta charset="UTF-8">
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
const EPG_SOURCES = <?= json_encode(array_values($epg_sources)) ?>;
|
const EPG_SOURCES = <?= json_encode(array_values($epg_sources)) ?>;
|
||||||
|
const L = <?= json_encode($L) ?>;
|
||||||
const ALLOW_PERSONAL_EPG = <?= $allow_personal_epg ? 'true' : 'false' ?>;
|
const ALLOW_PERSONAL_EPG = <?= $allow_personal_epg ? 'true' : 'false' ?>;
|
||||||
|
|
||||||
// Source active (index)
|
// Source active (index)
|
||||||
|
|||||||
+32
-13
@@ -10,10 +10,7 @@ function makePlaceholder(name) {
|
|||||||
return el;
|
return el;
|
||||||
}
|
}
|
||||||
|
|
||||||
function renderChannels() {
|
function makeChannelCell(ch) {
|
||||||
const list = document.getElementById('channelsList');
|
|
||||||
list.innerHTML = '';
|
|
||||||
channels.forEach(ch => {
|
|
||||||
const cell = document.createElement('div');
|
const cell = document.createElement('div');
|
||||||
cell.className = 'channel-cell';
|
cell.className = 'channel-cell';
|
||||||
if (ch.icon) {
|
if (ch.icon) {
|
||||||
@@ -25,9 +22,23 @@ function renderChannels() {
|
|||||||
const name = document.createElement('div');
|
const name = document.createElement('div');
|
||||||
name.className = 'channel-name'; name.textContent = ch.name; name.title = ch.name;
|
name.className = 'channel-name'; name.textContent = ch.name; name.title = ch.name;
|
||||||
cell.appendChild(name);
|
cell.appendChild(name);
|
||||||
|
cell.appendChild(makeFavBtn(ch.id));
|
||||||
cell.addEventListener('click', () => openPip(ch.name, getNowPlaying(ch.id)));
|
cell.addEventListener('click', () => openPip(ch.name, getNowPlaying(ch.id)));
|
||||||
list.appendChild(cell);
|
return cell;
|
||||||
});
|
}
|
||||||
|
|
||||||
|
function renderChannels() {
|
||||||
|
const list = document.getElementById('channelsList');
|
||||||
|
list.innerHTML = '';
|
||||||
|
const { favs, rest } = sortedChannels(channels);
|
||||||
|
|
||||||
|
if (favs.length) {
|
||||||
|
favs.forEach(ch => list.appendChild(makeChannelCell(ch)));
|
||||||
|
const sep = document.createElement('div');
|
||||||
|
sep.className = 'fav-separator';
|
||||||
|
list.appendChild(sep);
|
||||||
|
}
|
||||||
|
rest.forEach(ch => list.appendChild(makeChannelCell(ch)));
|
||||||
}
|
}
|
||||||
|
|
||||||
function renderRuler() {
|
function renderRuler() {
|
||||||
@@ -37,10 +48,18 @@ function renderRuler() {
|
|||||||
let t = new Date(GRID_START); t.setSeconds(0,0);
|
let t = new Date(GRID_START); t.setSeconds(0,0);
|
||||||
const rem = t.getMinutes()%15; if (rem) t.setMinutes(t.getMinutes()+(15-rem));
|
const rem = t.getMinutes()%15; if (rem) t.setMinutes(t.getMinutes()+(15-rem));
|
||||||
while (t <= GRID_END) {
|
while (t <= GRID_END) {
|
||||||
const x = msToX(t.getTime()); const isHour = t.getMinutes()===0;
|
const x = msToX(t.getTime());
|
||||||
|
const isHour = t.getMinutes() === 0;
|
||||||
|
const isMidnight = isHour && t.getHours() === 0;
|
||||||
const tick = document.createElement('div'); tick.className='time-tick'; tick.style.left=x+'px';
|
const tick = document.createElement('div'); tick.className='time-tick'; tick.style.left=x+'px';
|
||||||
const lbl = document.createElement('div'); lbl.className='time-tick-label'+(isHour?' hour':''); lbl.textContent=fmtTime(t);
|
const lbl = document.createElement('div');
|
||||||
const line = document.createElement('div'); line.className='time-tick-line'+(isHour?' hour':'');
|
lbl.className = 'time-tick-label' + (isHour ? ' hour' : '') + (isMidnight ? ' midnight' : '');
|
||||||
|
if (isMidnight) {
|
||||||
|
lbl.textContent = `${L.days[t.getDay()]} ${t.getDate()} ${L.months[t.getMonth()]}`;
|
||||||
|
} else {
|
||||||
|
lbl.textContent = fmtTime(t);
|
||||||
|
}
|
||||||
|
const line = document.createElement('div'); line.className='time-tick-line'+(isHour?' hour':'')+(isMidnight?' midnight':'');
|
||||||
tick.appendChild(lbl); tick.appendChild(line); ruler.appendChild(tick);
|
tick.appendChild(lbl); tick.appendChild(line); ruler.appendChild(tick);
|
||||||
t = new Date(t.getTime()+15*60000);
|
t = new Date(t.getTime()+15*60000);
|
||||||
}
|
}
|
||||||
@@ -62,7 +81,9 @@ function renderPrograms() {
|
|||||||
|
|
||||||
const now = new Date();
|
const now = new Date();
|
||||||
|
|
||||||
channels.forEach((ch, i) => {
|
const { favs: _f, rest: _r } = sortedChannels(channels);
|
||||||
|
const orderedChannels = [..._f, ..._r];
|
||||||
|
orderedChannels.forEach((ch, i) => {
|
||||||
const row = document.createElement('div');
|
const row = document.createElement('div');
|
||||||
row.className = 'program-row';
|
row.className = 'program-row';
|
||||||
row.style.cssText = `top:${i*ROW_H}px;position:absolute;left:0;right:0;`;
|
row.style.cssText = `top:${i*ROW_H}px;position:absolute;left:0;right:0;`;
|
||||||
@@ -88,9 +109,7 @@ function renderPrograms() {
|
|||||||
block.addEventListener('mouseenter', e=>showTooltip(e,p));
|
block.addEventListener('mouseenter', e=>showTooltip(e,p));
|
||||||
block.addEventListener('mousemove', e=>moveTooltip(e));
|
block.addEventListener('mousemove', e=>moveTooltip(e));
|
||||||
block.addEventListener('mouseleave', hideTooltip);
|
block.addEventListener('mouseleave', hideTooltip);
|
||||||
if (p.start <= now && p.stop > now) {
|
block.addEventListener('click', (e) => { hideTooltip(); openProgramModal(ch, p); });
|
||||||
block.addEventListener('click', () => openPip(ch.name, p.title));
|
|
||||||
}
|
|
||||||
row.appendChild(block);
|
row.appendChild(block);
|
||||||
});
|
});
|
||||||
inner.appendChild(row);
|
inner.appendChild(row);
|
||||||
|
|||||||
@@ -0,0 +1,35 @@
|
|||||||
|
// ── FAVORITES ─────────────────────────────────────────────────────────────────
|
||||||
|
let favorites = new Set(JSON.parse(localStorage.getItem('gridtv-favorites') || '[]'));
|
||||||
|
|
||||||
|
function saveFavorites() {
|
||||||
|
localStorage.setItem('gridtv-favorites', JSON.stringify([...favorites]));
|
||||||
|
}
|
||||||
|
|
||||||
|
function toggleFavorite(chId, btn) {
|
||||||
|
if (favorites.has(chId)) {
|
||||||
|
favorites.delete(chId);
|
||||||
|
btn.classList.remove('is-fav');
|
||||||
|
btn.title = L.fav_add;
|
||||||
|
} else {
|
||||||
|
favorites.add(chId);
|
||||||
|
btn.classList.add('is-fav');
|
||||||
|
btn.title = L.fav_remove;
|
||||||
|
}
|
||||||
|
saveFavorites();
|
||||||
|
renderAll();
|
||||||
|
}
|
||||||
|
|
||||||
|
function makeFavBtn(chId) {
|
||||||
|
const btn = document.createElement('button');
|
||||||
|
btn.className = 'fav-btn' + (favorites.has(chId) ? ' is-fav' : '');
|
||||||
|
btn.title = favorites.has(chId) ? L.fav_remove : L.fav_add;
|
||||||
|
btn.textContent = '★';
|
||||||
|
btn.addEventListener('click', e => { e.stopPropagation(); toggleFavorite(chId, btn); });
|
||||||
|
return btn;
|
||||||
|
}
|
||||||
|
|
||||||
|
function sortedChannels(list) {
|
||||||
|
const favs = list.filter(ch => favorites.has(ch.id));
|
||||||
|
const rest = list.filter(ch => !favorites.has(ch.id));
|
||||||
|
return { favs, rest };
|
||||||
|
}
|
||||||
+4
-1
@@ -6,7 +6,9 @@ function renderMobile() {
|
|||||||
const winStart = new Date(now.getTime() - 30*60000);
|
const winStart = new Date(now.getTime() - 30*60000);
|
||||||
const winEnd = new Date(now.getTime() + 4*3600000);
|
const winEnd = new Date(now.getTime() + 4*3600000);
|
||||||
|
|
||||||
channels.forEach(ch => {
|
const { favs: _f, rest: _r } = sortedChannels(channels);
|
||||||
|
const orderedChannels = [..._f, ..._r];
|
||||||
|
orderedChannels.forEach(ch => {
|
||||||
const progs = (programs[ch.id]||[]).filter(p => p.stop>winStart && p.start<winEnd);
|
const progs = (programs[ch.id]||[]).filter(p => p.stop>winStart && p.start<winEnd);
|
||||||
if (!progs.length) return;
|
if (!progs.length) return;
|
||||||
|
|
||||||
@@ -49,6 +51,7 @@ function renderMobile() {
|
|||||||
const badge = document.createElement('div'); badge.className='mobile-live-badge'; badge.textContent='LIVE';
|
const badge = document.createElement('div'); badge.className='mobile-live-badge'; badge.textContent='LIVE';
|
||||||
item.appendChild(badge);
|
item.appendChild(badge);
|
||||||
}
|
}
|
||||||
|
item.addEventListener('click', () => openProgramModal(ch, p));
|
||||||
list.appendChild(item);
|
list.appendChild(item);
|
||||||
});
|
});
|
||||||
section.appendChild(list); container.appendChild(section);
|
section.appendChild(list); container.appendChild(section);
|
||||||
|
|||||||
@@ -0,0 +1,45 @@
|
|||||||
|
// ── PROGRAM MODAL ─────────────────────────────────────────────────────────────
|
||||||
|
function openProgramModal(ch, p) {
|
||||||
|
const now = new Date();
|
||||||
|
const isLive = p.start <= now && p.stop > now;
|
||||||
|
const dur = Math.round((p.stop - p.start) / 60000);
|
||||||
|
const ep = fmtEpisode(p.season, p.episode);
|
||||||
|
|
||||||
|
document.getElementById('pm-title').textContent = p.title;
|
||||||
|
document.getElementById('pm-channel').textContent = ch.name;
|
||||||
|
document.getElementById('pm-time').textContent =
|
||||||
|
`${fmtTime(p.start)} — ${fmtTime(p.stop)} · ${dur} ${L.duration_min}` +
|
||||||
|
(ep ? ` · ${ep}` : '');
|
||||||
|
document.getElementById('pm-desc').textContent = p.desc || '';
|
||||||
|
document.getElementById('pm-desc').style.display = p.desc ? 'block' : 'none';
|
||||||
|
|
||||||
|
// Bouton Watch now — seulement si live ET M3U fourni pour la source active
|
||||||
|
const watchBtn = document.getElementById('pm-watch');
|
||||||
|
if (isLive && currentM3uUrl) {
|
||||||
|
watchBtn.style.display = 'inline-flex';
|
||||||
|
watchBtn.onclick = () => { closeProgramModal(); openPip(ch.name, p.title); };
|
||||||
|
} else {
|
||||||
|
watchBtn.style.display = 'none';
|
||||||
|
}
|
||||||
|
|
||||||
|
// Bouton IMDb
|
||||||
|
document.getElementById('pm-imdb').href =
|
||||||
|
`https://www.imdb.com/find/?q=${encodeURIComponent(p.title)}&s=tt`;
|
||||||
|
|
||||||
|
document.getElementById('programModal').classList.add('visible');
|
||||||
|
}
|
||||||
|
|
||||||
|
function closeProgramModal() {
|
||||||
|
document.getElementById('programModal').classList.remove('visible');
|
||||||
|
}
|
||||||
|
|
||||||
|
// Fermer sur clic overlay
|
||||||
|
document.addEventListener('click', e => {
|
||||||
|
const modal = document.getElementById('programModal');
|
||||||
|
if (e.target === modal) closeProgramModal();
|
||||||
|
});
|
||||||
|
|
||||||
|
// Fermer sur Escape
|
||||||
|
document.addEventListener('keydown', e => {
|
||||||
|
if (e.key === 'Escape') closeProgramModal();
|
||||||
|
});
|
||||||
+4
-6
@@ -12,12 +12,12 @@ function copyUrl(type) {
|
|||||||
navigator.clipboard.writeText(url).then(() => {
|
navigator.clipboard.writeText(url).then(() => {
|
||||||
const btns = document.querySelectorAll('.copy-btn');
|
const btns = document.querySelectorAll('.copy-btn');
|
||||||
btns.forEach(b => { if (b.textContent.toLowerCase() === type) {
|
btns.forEach(b => { if (b.textContent.toLowerCase() === type) {
|
||||||
b.textContent = '✓ copié';
|
b.textContent = L.copied;
|
||||||
b.classList.add('copied');
|
b.classList.add('copied');
|
||||||
setTimeout(() => { b.textContent = type.toUpperCase(); b.classList.remove('copied'); }, 1800);
|
setTimeout(() => { b.textContent = type.toUpperCase(); b.classList.remove('copied'); }, 1800);
|
||||||
}});
|
}});
|
||||||
}).catch(() => {
|
}).catch(() => {
|
||||||
prompt('Copiez cette URL :', url);
|
prompt(url, url);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
function fmtTime(d) { return `${pad(d.getHours())}:${pad(d.getMinutes())}`; }
|
function fmtTime(d) { return `${pad(d.getHours())}:${pad(d.getMinutes())}`; }
|
||||||
@@ -36,10 +36,8 @@ function parseXMLTVDate(str) {
|
|||||||
function updateClock() {
|
function updateClock() {
|
||||||
const now = new Date();
|
const now = new Date();
|
||||||
document.getElementById('clock').textContent = fmtTimeFull(now);
|
document.getElementById('clock').textContent = fmtTimeFull(now);
|
||||||
const days=['Dim','Lun','Mar','Mer','Jeu','Ven','Sam'];
|
|
||||||
const months=['Jan','Fév','Mar','Avr','Mai','Jun','Jul','Aoû','Sep','Oct','Nov','Déc'];
|
|
||||||
document.getElementById('dateLabel').textContent =
|
document.getElementById('dateLabel').textContent =
|
||||||
`${days[now.getDay()]} ${now.getDate()} ${months[now.getMonth()]} ${now.getFullYear()}`;
|
`${L.days[now.getDay()]} ${now.getDate()} ${L.months[now.getMonth()]} ${now.getFullYear()}`;
|
||||||
}
|
}
|
||||||
setInterval(updateClock, 1000);
|
setInterval(updateClock, 1000);
|
||||||
updateClock();
|
updateClock();
|
||||||
@@ -62,7 +60,7 @@ async function loadEPG(url) {
|
|||||||
} catch(e) {
|
} catch(e) {
|
||||||
document.getElementById('loading').style.display = 'none';
|
document.getElementById('loading').style.display = 'none';
|
||||||
document.getElementById('errorMsg').style.display = 'flex';
|
document.getElementById('errorMsg').style.display = 'flex';
|
||||||
document.getElementById('errorDetail').textContent = `Erreur: ${e.message}`;
|
document.getElementById('errorDetail').textContent = `${L.epg_error_sub} (${e.message})`;
|
||||||
document.getElementById('epgInput').value = url;
|
document.getElementById('epgInput').value = url;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -3,7 +3,7 @@
|
|||||||
<?php
|
<?php
|
||||||
$js_dir = __DIR__ . '/../js/';
|
$js_dir = __DIR__ . '/../js/';
|
||||||
include $js_dir . 'config.js';
|
include $js_dir . 'config.js';
|
||||||
$js_modules = ['utils', 'epg', 'mobile', 'tooltip', 'sources', 'm3u', 'player', 'themes', 'search', 'live'];
|
$js_modules = ['utils', 'favorites', 'epg', 'mobile', 'tooltip', 'sources', 'm3u', 'player', 'themes', 'search', 'program', 'live'];
|
||||||
foreach ($js_modules as $mod) {
|
foreach ($js_modules as $mod) {
|
||||||
echo file_get_contents($js_dir . $mod . '.js');
|
echo file_get_contents($js_dir . $mod . '.js');
|
||||||
}
|
}
|
||||||
|
|||||||
+5
-5
@@ -1,14 +1,14 @@
|
|||||||
<div class="loading" id="loading">
|
<div class="loading" id="loading">
|
||||||
<div class="loading-text">Chargement du guide</div>
|
<div class="loading-text"><?= htmlspecialchars($L["loading"]) ?></div>
|
||||||
<div class="loading-bar"></div>
|
<div class="loading-bar"></div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="error-msg" id="errorMsg">
|
<div class="error-msg" id="errorMsg">
|
||||||
<div class="err-title">⚠ Impossible de charger l'EPG</div>
|
<div class="err-title">⚠ <?= htmlspecialchars($L["epg_error"]) ?></div>
|
||||||
<div class="err-sub" id="errorDetail">Vérifiez l'URL de votre flux XMLTV.</div>
|
<div class="err-sub" id="errorDetail"><?= htmlspecialchars($L["epg_error_sub"]) ?></div>
|
||||||
<div class="epg-input-bar">
|
<div class="epg-input-bar">
|
||||||
<input class="epg-input" id="epgInput" type="text" placeholder="<?= $epg_url ?>" />
|
<input class="epg-input" id="epgInput" type="text" placeholder="<?= $epg_url ?>" />
|
||||||
<button class="epg-btn" onclick="loadFromInput()">Charger</button>
|
<button class="epg-btn" onclick="loadFromInput()"><?= htmlspecialchars($L["load"]) ?></button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@@ -32,7 +32,7 @@
|
|||||||
<!-- GRID (desktop/tablet) -->
|
<!-- GRID (desktop/tablet) -->
|
||||||
<div class="grid-wrapper">
|
<div class="grid-wrapper">
|
||||||
<div class="channels-col">
|
<div class="channels-col">
|
||||||
<div class="channels-col-header"><span>Chaînes</span></div>
|
<div class="channels-col-header"><span><?= htmlspecialchars($L["channels"]) ?></span></div>
|
||||||
<div class="channels-list" id="channelsList"></div>
|
<div class="channels-list" id="channelsList"></div>
|
||||||
</div>
|
</div>
|
||||||
<div class="timeline-area" id="timelineArea">
|
<div class="timeline-area" id="timelineArea">
|
||||||
|
|||||||
@@ -800,6 +800,75 @@
|
|||||||
border-left: 3px solid var(--accent);
|
border-left: 3px solid var(--accent);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* ── PROGRAM MODAL ───────────────────────────────────────────────────────── */
|
||||||
|
.program-card {
|
||||||
|
max-width: 520px; padding: 28px; position: relative;
|
||||||
|
}
|
||||||
|
.pm-close {
|
||||||
|
position: absolute; top: 14px; right: 14px;
|
||||||
|
background: none; border: none; color: var(--text-muted);
|
||||||
|
cursor: pointer; font-size: 18px; line-height: 1;
|
||||||
|
transition: color .2s;
|
||||||
|
}
|
||||||
|
.pm-close:hover { color: var(--accent); }
|
||||||
|
.pm-channel {
|
||||||
|
font-size: 11px; letter-spacing: .1em; text-transform: uppercase;
|
||||||
|
color: var(--accent); margin-bottom: 6px;
|
||||||
|
}
|
||||||
|
.pm-title {
|
||||||
|
font-size: 20px; font-weight: 700; color: var(--text);
|
||||||
|
margin-bottom: 8px; line-height: 1.2;
|
||||||
|
}
|
||||||
|
.pm-time {
|
||||||
|
font-size: 12px; color: var(--accent); margin-bottom: 14px;
|
||||||
|
}
|
||||||
|
.pm-desc {
|
||||||
|
font-size: 13px; color: var(--text-muted); line-height: 1.6;
|
||||||
|
margin-bottom: 20px; max-height: 140px; overflow-y: auto;
|
||||||
|
}
|
||||||
|
.pm-actions {
|
||||||
|
display: flex; gap: 10px; flex-wrap: wrap;
|
||||||
|
}
|
||||||
|
.pm-btn {
|
||||||
|
border-radius: 4px; cursor: pointer; font-family: inherit;
|
||||||
|
font-size: 13px; font-weight: 600; padding: 8px 16px;
|
||||||
|
text-decoration: none; transition: opacity .2s;
|
||||||
|
display: inline-flex; align-items: center; gap: 6px;
|
||||||
|
border: none;
|
||||||
|
}
|
||||||
|
.pm-btn:hover { opacity: .8; }
|
||||||
|
.pm-watch { background: var(--accent); color: var(--bg); }
|
||||||
|
.pm-imdb { background: #f5c518; color: #000; }
|
||||||
|
.pm-cancel { background: var(--bg); color: var(--text-muted); border: 1px solid var(--border); }
|
||||||
|
|
||||||
|
/* Date midnight dans la timebar */
|
||||||
|
.time-tick-label.midnight {
|
||||||
|
color: var(--accent); font-weight: 700; font-size: 11px;
|
||||||
|
white-space: nowrap;
|
||||||
|
}
|
||||||
|
.time-tick-line.midnight {
|
||||||
|
background: var(--accent); opacity: .4; width: 2px;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* ── FAVORITES ───────────────────────────────────────────────────────────── */
|
||||||
|
.fav-btn {
|
||||||
|
background: none; border: none; color: var(--text-muted);
|
||||||
|
cursor: pointer; font-size: 14px; line-height: 1;
|
||||||
|
margin-left: auto; padding: 2px 4px; flex-shrink: 0;
|
||||||
|
transition: color .15s, transform .15s;
|
||||||
|
opacity: 0;
|
||||||
|
}
|
||||||
|
.channel-cell:hover .fav-btn { opacity: 1; }
|
||||||
|
.fav-btn.is-fav { color: var(--accent); opacity: 1; }
|
||||||
|
.fav-btn:hover { transform: scale(1.2); }
|
||||||
|
|
||||||
|
.fav-separator {
|
||||||
|
height: 2px; background: var(--accent);
|
||||||
|
opacity: .3; margin: 0;
|
||||||
|
}
|
||||||
|
|
||||||
</style>
|
</style>
|
||||||
<link id="themeStylesheet" rel="stylesheet" href="themes/default.css">
|
<link id="themeStylesheet" rel="stylesheet" href="themes/default.css">
|
||||||
</head>
|
</head>
|
||||||
|
|||||||
+22
-6
@@ -1,19 +1,35 @@
|
|||||||
|
<!-- MODAL PROGRAMME -->
|
||||||
|
<div class="modal-overlay" id="programModal">
|
||||||
|
<div class="modal-card program-card">
|
||||||
|
<button class="pm-close" onclick="closeProgramModal()">✕</button>
|
||||||
|
<div class="pm-channel" id="pm-channel"></div>
|
||||||
|
<div class="pm-title" id="pm-title"></div>
|
||||||
|
<div class="pm-time" id="pm-time"></div>
|
||||||
|
<div class="pm-desc" id="pm-desc"></div>
|
||||||
|
<div class="pm-actions">
|
||||||
|
<button class="pm-btn pm-watch" id="pm-watch">▶ <?= htmlspecialchars($L["watch_now"]) ?></button>
|
||||||
|
<a class="pm-btn pm-imdb" id="pm-imdb" href="#" target="_blank" rel="noopener">🎥 <?= htmlspecialchars($L["imdb_search"]) ?></a>
|
||||||
|
<button class="pm-btn pm-cancel" onclick="closeProgramModal()"><?= htmlspecialchars($L["close"]) ?></button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<!-- MODAL PERSONAL EPG -->
|
<!-- MODAL PERSONAL EPG -->
|
||||||
<div class="modal-overlay" id="personalEpgModal">
|
<div class="modal-overlay" id="personalEpgModal">
|
||||||
<div class="modal-card">
|
<div class="modal-card">
|
||||||
<div class="modal-title">✏ Personal EPG</div>
|
<div class="modal-title">✏ <?= htmlspecialchars($L["personal_epg_title"]) ?></div>
|
||||||
<div class="modal-subtitle">Utilisez votre propre source EPG/M3U sur cette instance.</div>
|
<div class="modal-subtitle"><?= htmlspecialchars($L["personal_epg_subtitle"]) ?></div>
|
||||||
<div class="modal-field">
|
<div class="modal-field">
|
||||||
<label>URL EPG (XMLTV) *</label>
|
<label><?= htmlspecialchars($L["personal_epg_label"]) ?></label>
|
||||||
<input type="url" id="personalEpgInput" placeholder="http://mon-serveur/xmltv.xml">
|
<input type="url" id="personalEpgInput" placeholder="http://mon-serveur/xmltv.xml">
|
||||||
</div>
|
</div>
|
||||||
<div class="modal-field">
|
<div class="modal-field">
|
||||||
<label>URL M3U <span style="opacity:.5;font-size:10px">(optionnel)</span></label>
|
<label><?= htmlspecialchars($L["personal_epg_m3u_label"]) ?> <span style="opacity:.5;font-size:10px">(<?= htmlspecialchars($L["personal_epg_optional"]) ?>)</span></label>
|
||||||
<input type="url" id="personalM3uInput" placeholder="http://mon-serveur/channels.m3u">
|
<input type="url" id="personalM3uInput" placeholder="http://mon-serveur/channels.m3u">
|
||||||
</div>
|
</div>
|
||||||
<div class="modal-actions">
|
<div class="modal-actions">
|
||||||
<button class="modal-btn-cancel" onclick="closePersonalEpgModal()">Annuler</button>
|
<button class="modal-btn-cancel" onclick="closePersonalEpgModal()"><?= htmlspecialchars($L["cancel"]) ?></button>
|
||||||
<button class="modal-btn-apply" onclick="applyPersonalEpg()">Appliquer</button>
|
<button class="modal-btn-apply" onclick="applyPersonalEpg()"><?= htmlspecialchars($L["apply"]) ?></button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
+7
-7
@@ -3,14 +3,14 @@
|
|||||||
<div class="date-label" id="dateLabel"></div>
|
<div class="date-label" id="dateLabel"></div>
|
||||||
<div class="clock" id="clock">00:00:00</div>
|
<div class="clock" id="clock">00:00:00</div>
|
||||||
<div class="nav-btns" id="navBtns">
|
<div class="nav-btns" id="navBtns">
|
||||||
<button class="nav-btn" onclick="shiftView(-60)">◀ 1h</button>
|
<button class="nav-btn" onclick="shiftView(-60)"><?= htmlspecialchars($L["shift_back"]) ?></button>
|
||||||
<button class="nav-btn active" onclick="centerNow()">Maintenant</button>
|
<button class="nav-btn active" onclick="centerNow()"><?= htmlspecialchars($L["now"]) ?></button>
|
||||||
<button class="nav-btn" onclick="shiftView(60)">1h ▶</button>
|
<button class="nav-btn" onclick="shiftView(60)"><?= htmlspecialchars($L["shift_fwd"]) ?></button>
|
||||||
</div>
|
</div>
|
||||||
<div class="copy-btns">
|
<div class="copy-btns">
|
||||||
<button class="copy-btn" onclick="copyUrl('epg')" title="Copier l'URL EPG">EPG</button>
|
<button class="copy-btn" onclick="copyUrl('epg')" title="<?= htmlspecialchars($L["copy_epg"]) ?>"><?= htmlspecialchars($L["copy_epg"]) ?></button>
|
||||||
<?php if (!empty($m3u_url)): ?>
|
<?php if (!empty($m3u_url)): ?>
|
||||||
<button class="copy-btn" onclick="copyUrl('m3u')" title="Copier l'URL M3U">M3U</button>
|
<button class="copy-btn" onclick="copyUrl('m3u')" title="<?= htmlspecialchars($L["copy_m3u"]) ?>"><?= htmlspecialchars($L["copy_m3u"]) ?></button>
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
</div>
|
</div>
|
||||||
<?php if (count($epg_sources) > 1 || $allow_personal_epg): ?>
|
<?php if (count($epg_sources) > 1 || $allow_personal_epg): ?>
|
||||||
@@ -48,10 +48,10 @@ foreach ($theme_files as $file) {
|
|||||||
?>
|
?>
|
||||||
</select>
|
</select>
|
||||||
<button class="search-btn" onclick="toggleSearch()" title="Search">🔍</button>
|
<button class="search-btn" onclick="toggleSearch()" title="Search">🔍</button>
|
||||||
<div class="live-dot">LIVE</div>
|
<div class="live-dot"><?= htmlspecialchars($L["live"]) ?></div>
|
||||||
</div>
|
</div>
|
||||||
<div class="search-bar" id="searchBar">
|
<div class="search-bar" id="searchBar">
|
||||||
<input class="search-input" id="searchInput" type="text" placeholder="Search channel or program..." oninput="onSearchInput(this.value)" />
|
<input class="search-input" id="searchInput" type="text" placeholder="<?= htmlspecialchars($L["search_placeholder"]) ?>" oninput="onSearchInput(this.value)" />
|
||||||
<button class="search-clear" onclick="clearSearch()">✕</button>
|
<button class="search-clear" onclick="clearSearch()">✕</button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user