22 lines
866 B
JavaScript
22 lines
866 B
JavaScript
const EPG_SOURCES = <?= json_encode(array_values($epg_sources)) ?>;
|
|
const L = <?= json_encode($L) ?>;
|
|
const ALLOW_PERSONAL_EPG = <?= $allow_personal_epg ? 'true' : 'false' ?>;
|
|
|
|
// Index of the currently selected source.
|
|
let activeSourceIndex = 0;
|
|
|
|
const DEFAULT_EPG_URL = EPG_SOURCES[0]?.epg_url ?? '';
|
|
const DEFAULT_M3U_URL = EPG_SOURCES[0]?.m3u_url ?? '';
|
|
const PX_PER_MIN = 5;
|
|
const GRID_HOURS = 72;
|
|
const CORS_PROXY = '/proxy.php?url=';
|
|
|
|
// Anchor the grid 2 hours before "now", rounded down to the previous quarter-hour.
|
|
const _d = new Date();
|
|
_d.setMinutes(Math.floor(_d.getMinutes()/15)*15, 0, 0);
|
|
const GRID_START = new Date(_d.getTime() - 2*3600000);
|
|
const GRID_END = new Date(GRID_START.getTime() + GRID_HOURS*3600000);
|
|
const TOTAL_WIDTH_PX = GRID_HOURS * 60 * PX_PER_MIN;
|
|
|
|
function msToX(ms) { return (ms - GRID_START.getTime()) / 60000 * PX_PER_MIN; }
|