mirror of
https://github.com/jellyfin/jellyfin-web
synced 2025-03-30 19:56:21 +00:00
add guide auto-refresh
This commit is contained in:
parent
90a63f4c7d
commit
a8c3ec87ea
1 changed files with 28 additions and 0 deletions
|
@ -38,15 +38,19 @@
|
||||||
var currentDate;
|
var currentDate;
|
||||||
var currentStartIndex = 0;
|
var currentStartIndex = 0;
|
||||||
var currentChannelLimit = 0;
|
var currentChannelLimit = 0;
|
||||||
|
var autoRefreshInterval;
|
||||||
|
|
||||||
self.refresh = function () {
|
self.refresh = function () {
|
||||||
|
|
||||||
currentDate = null;
|
currentDate = null;
|
||||||
reloadPage(options.element);
|
reloadPage(options.element);
|
||||||
|
restartAutoRefresh();
|
||||||
};
|
};
|
||||||
|
|
||||||
self.destroy = function () {
|
self.destroy = function () {
|
||||||
|
|
||||||
|
stopAutoRefresh();
|
||||||
|
|
||||||
events.off(serverNotifications, 'TimerCreated', onTimerCreated);
|
events.off(serverNotifications, 'TimerCreated', onTimerCreated);
|
||||||
events.off(serverNotifications, 'SeriesTimerCreated', onSeriesTimerCreated);
|
events.off(serverNotifications, 'SeriesTimerCreated', onSeriesTimerCreated);
|
||||||
events.off(serverNotifications, 'TimerCancelled', onTimerCancelled);
|
events.off(serverNotifications, 'TimerCancelled', onTimerCancelled);
|
||||||
|
@ -58,6 +62,24 @@
|
||||||
items = {};
|
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) {
|
function normalizeDateToTimeslot(date) {
|
||||||
|
|
||||||
var minutesOffset = date.getMinutes() - cellCurationMinutes;
|
var minutesOffset = date.getMinutes() - cellCurationMinutes;
|
||||||
|
@ -928,29 +950,35 @@
|
||||||
|
|
||||||
context.querySelector('.btnSelectDate').addEventListener('click', function () {
|
context.querySelector('.btnSelectDate').addEventListener('click', function () {
|
||||||
selectDate(context);
|
selectDate(context);
|
||||||
|
restartAutoRefresh();
|
||||||
});
|
});
|
||||||
|
|
||||||
context.querySelector('.btnUnlockGuide').addEventListener('click', function () {
|
context.querySelector('.btnUnlockGuide').addEventListener('click', function () {
|
||||||
currentStartIndex = 0;
|
currentStartIndex = 0;
|
||||||
reloadPage(context);
|
reloadPage(context);
|
||||||
|
restartAutoRefresh();
|
||||||
});
|
});
|
||||||
|
|
||||||
context.querySelector('.btnNextPage').addEventListener('click', function () {
|
context.querySelector('.btnNextPage').addEventListener('click', function () {
|
||||||
currentStartIndex += currentChannelLimit;
|
currentStartIndex += currentChannelLimit;
|
||||||
reloadPage(context);
|
reloadPage(context);
|
||||||
|
restartAutoRefresh();
|
||||||
});
|
});
|
||||||
|
|
||||||
context.querySelector('.btnPreviousPage').addEventListener('click', function () {
|
context.querySelector('.btnPreviousPage').addEventListener('click', function () {
|
||||||
currentStartIndex = Math.max(currentStartIndex - currentChannelLimit, 0);
|
currentStartIndex = Math.max(currentStartIndex - currentChannelLimit, 0);
|
||||||
reloadPage(context);
|
reloadPage(context);
|
||||||
|
restartAutoRefresh();
|
||||||
});
|
});
|
||||||
|
|
||||||
context.querySelector('.btnGuideViewSettings').addEventListener('click', function () {
|
context.querySelector('.btnGuideViewSettings').addEventListener('click', function () {
|
||||||
showViewSettings(self);
|
showViewSettings(self);
|
||||||
|
restartAutoRefresh();
|
||||||
});
|
});
|
||||||
|
|
||||||
context.querySelector('.btnCategories').addEventListener('click', function () {
|
context.querySelector('.btnCategories').addEventListener('click', function () {
|
||||||
showCategoryOptions(self);
|
showCategoryOptions(self);
|
||||||
|
restartAutoRefresh();
|
||||||
});
|
});
|
||||||
|
|
||||||
context.classList.add('tvguide');
|
context.classList.add('tvguide');
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue