Added 60 second refresh interval for epg now indicator
This commit is contained in:
+1
-1
@@ -1116,7 +1116,7 @@ video::cue {
|
|||||||
bottom: 0;
|
bottom: 0;
|
||||||
width: 2px;
|
width: 2px;
|
||||||
background: var(--color-error);
|
background: var(--color-error);
|
||||||
z-index: 15;
|
z-index: 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* =====================================================
|
/* =====================================================
|
||||||
|
|||||||
@@ -483,8 +483,14 @@ class EpgGuide {
|
|||||||
// Sync header corner width with actual sidebar width (handles CSS overrides)
|
// Sync header corner width with actual sidebar width (handles CSS overrides)
|
||||||
this.syncHeaderCornerWidth();
|
this.syncHeaderCornerWidth();
|
||||||
|
|
||||||
// Add now indicator
|
// Add now indicator and set up periodic refresh
|
||||||
this.updateNowIndicator();
|
this.updateNowIndicator();
|
||||||
|
// Clear any existing interval
|
||||||
|
if (this._nowIndicatorInterval) {
|
||||||
|
clearInterval(this._nowIndicatorInterval);
|
||||||
|
}
|
||||||
|
// Update indicator every 60 seconds
|
||||||
|
this._nowIndicatorInterval = setInterval(() => this.updateNowIndicator(), 60000);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -851,29 +857,29 @@ class EpgGuide {
|
|||||||
|
|
||||||
updateNowIndicator() {
|
updateNowIndicator() {
|
||||||
const now = new Date();
|
const now = new Date();
|
||||||
const container = this.container.querySelector('.epg-container');
|
// Place indicator inside the spacer so it scrolls with content
|
||||||
if (!container) return;
|
const spacer = this.container.querySelector('.epg-spacer');
|
||||||
|
if (!spacer) return;
|
||||||
|
|
||||||
// Remove existing indicator
|
// Remove existing indicator
|
||||||
const existing = container.querySelector('.epg-now-line');
|
const existing = spacer.querySelector('.epg-now-line');
|
||||||
if (existing) existing.remove();
|
if (existing) existing.remove();
|
||||||
|
|
||||||
// Calculate position
|
// Calculate position relative to EPG start time
|
||||||
const startTime = new Date();
|
const minutesFromStart = (now - this.startTime) / 60000;
|
||||||
startTime.setHours(startTime.getHours() + this.timeOffset);
|
if (minutesFromStart < 0 || minutesFromStart > 1440) return; // Not in visible 24h range
|
||||||
startTime.setMinutes(0, 0, 0);
|
|
||||||
|
|
||||||
const minutesFromStart = (now - startTime) / 60000;
|
// Get sidebar width to offset the indicator
|
||||||
if (minutesFromStart < 0 || minutesFromStart > 240) return; // Not in visible range
|
const sidebar = this.container.querySelector('.epg-channel-info');
|
||||||
|
const sidebarWidth = sidebar ? sidebar.offsetWidth : 150;
|
||||||
|
|
||||||
// Get current sidebar width
|
// Position is sidebar + time offset
|
||||||
const sidebarWidth = parseInt(getComputedStyle(document.documentElement).getPropertyValue('--epg-sidebar-width')) || 150;
|
|
||||||
const leftPos = sidebarWidth + (minutesFromStart * this.pixelsPerMinute);
|
const leftPos = sidebarWidth + (minutesFromStart * this.pixelsPerMinute);
|
||||||
|
|
||||||
const indicator = document.createElement('div');
|
const indicator = document.createElement('div');
|
||||||
indicator.className = 'epg-now-line';
|
indicator.className = 'epg-now-line';
|
||||||
indicator.style.left = `${leftPos}px`;
|
indicator.style.left = `${leftPos}px`;
|
||||||
container.appendChild(indicator);
|
spacer.appendChild(indicator);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user