1
0
Fork 0
mirror of https://github.com/jellyfin/jellyfin-web synced 2025-03-30 19:56:21 +00:00
jellyfin-web/dashboard-ui/scripts/livetvtimers.js

55 lines
1.3 KiB
JavaScript
Raw Normal View History

2014-10-15 23:26:39 -04:00
(function ($, document) {
2013-11-27 14:04:19 -05:00
function deleteTimer(page, id) {
2014-05-30 15:23:56 -04:00
Dashboard.confirm(Globalize.translate('MessageConfirmRecordingCancellation'), Globalize.translate('HeaderConfirmRecordingCancellation'), function (result) {
if (result) {
Dashboard.showLoadingMsg();
2015-12-14 10:43:03 -05:00
ApiClient.cancelLiveTvTimer(id).then(function () {
2014-05-30 15:23:56 -04:00
Dashboard.alert(Globalize.translate('MessageRecordingCancelled'));
reload(page);
});
}
});
}
2013-11-27 14:04:19 -05:00
function renderTimers(page, timers) {
2015-12-14 10:43:03 -05:00
LiveTvHelpers.getTimersHtml(timers).then(function (html) {
var elem = $('#items', page).html(html);
2013-11-27 14:04:19 -05:00
2015-12-14 10:43:03 -05:00
$('.btnDeleteTimer', elem).on('click', function () {
2015-12-14 10:43:03 -05:00
var id = this.getAttribute('data-timerid');
2015-12-14 10:43:03 -05:00
deleteTimer(page, id);
});
2015-12-14 10:43:03 -05:00
Dashboard.hideLoadingMsg();
});
2013-11-27 14:04:19 -05:00
}
function reload(page) {
2013-11-29 13:44:51 -05:00
Dashboard.showLoadingMsg();
2013-12-14 10:49:11 -05:00
2015-12-14 10:43:03 -05:00
ApiClient.getLiveTvTimers().then(function (result) {
2013-11-27 14:04:19 -05:00
renderTimers(page, result.Items);
});
}
2015-08-18 11:52:48 -04:00
window.LiveTvPage.renderTimersTab = function (page, tabContent) {
2013-11-27 14:04:19 -05:00
2015-08-18 11:52:48 -04:00
if (LibraryBrowser.needsRefresh(tabContent)) {
reload(tabContent);
}
};
2013-11-27 14:04:19 -05:00
2014-10-15 23:26:39 -04:00
})(jQuery, document);