mirror of
https://github.com/jellyfin/jellyfin-web.git
synced 2024-11-17 19:08:18 -07:00
add guide auto-refresh
This commit is contained in:
parent
90a63f4c7d
commit
a8c3ec87ea
@ -38,15 +38,19 @@
|
||||
var currentDate;
|
||||
var currentStartIndex = 0;
|
||||
var currentChannelLimit = 0;
|
||||
var autoRefreshInterval;
|
||||
|
||||
self.refresh = function () {
|
||||
|
||||
currentDate = null;
|
||||
reloadPage(options.element);
|
||||
restartAutoRefresh();
|
||||
};
|
||||
|
||||
self.destroy = function () {
|
||||
|
||||
stopAutoRefresh();
|
||||
|
||||
events.off(serverNotifications, 'TimerCreated', onTimerCreated);
|
||||
events.off(serverNotifications, 'SeriesTimerCreated', onSeriesTimerCreated);
|
||||
events.off(serverNotifications, 'TimerCancelled', onTimerCancelled);
|
||||
@ -58,6 +62,24 @@
|
||||
items = {};
|
||||
};
|
||||
|
||||
function restartAutoRefresh() {
|
||||
|
||||
stopAutoRefresh();
|
||||
|
||||
var intervalMs = 60000 * 15; // (minutes)
|
||||
|
||||
autoRefreshInterval = setInterval(function () {
|
||||
self.refresh();
|
||||
}, intervalMs);
|
||||
}
|
||||
|
||||
function stopAutoRefresh() {
|
||||
if (autoRefreshInterval) {
|
||||
clearInterval(autoRefreshInterval);
|
||||
autoRefreshInterval = null;
|
||||
}
|
||||
}
|
||||
|
||||
function normalizeDateToTimeslot(date) {
|
||||
|
||||
var minutesOffset = date.getMinutes() - cellCurationMinutes;
|
||||
@ -928,29 +950,35 @@
|
||||
|
||||
context.querySelector('.btnSelectDate').addEventListener('click', function () {
|
||||
selectDate(context);
|
||||
restartAutoRefresh();
|
||||
});
|
||||
|
||||
context.querySelector('.btnUnlockGuide').addEventListener('click', function () {
|
||||
currentStartIndex = 0;
|
||||
reloadPage(context);
|
||||
restartAutoRefresh();
|
||||
});
|
||||
|
||||
context.querySelector('.btnNextPage').addEventListener('click', function () {
|
||||
currentStartIndex += currentChannelLimit;
|
||||
reloadPage(context);
|
||||
restartAutoRefresh();
|
||||
});
|
||||
|
||||
context.querySelector('.btnPreviousPage').addEventListener('click', function () {
|
||||
currentStartIndex = Math.max(currentStartIndex - currentChannelLimit, 0);
|
||||
reloadPage(context);
|
||||
restartAutoRefresh();
|
||||
});
|
||||
|
||||
context.querySelector('.btnGuideViewSettings').addEventListener('click', function () {
|
||||
showViewSettings(self);
|
||||
restartAutoRefresh();
|
||||
});
|
||||
|
||||
context.querySelector('.btnCategories').addEventListener('click', function () {
|
||||
showCategoryOptions(self);
|
||||
restartAutoRefresh();
|
||||
});
|
||||
|
||||
context.classList.add('tvguide');
|
||||
|
Loading…
Reference in New Issue
Block a user