jellyfin-web/dashboard-ui/scripts/livetvseriestimers.js

63 lines
1.7 KiB
JavaScript
Raw Normal View History

2016-10-12 11:23:09 -07:00
define(['datetime', 'cardBuilder', 'imageLoader', 'apphost', 'paper-icon-button-light', 'emby-button'], function (datetime, cardBuilder, imageLoader, appHost) {
2016-10-22 22:11:46 -07:00
'use strict';
2016-05-15 10:11:26 -07:00
var query = {
SortBy: "SortName",
SortOrder: "Ascending"
};
function renderTimers(context, timers) {
var html = '';
2016-10-12 11:23:09 -07:00
var supportsImageAnalysis = appHost.supports('imageanalysis');
var cardLayout = appHost.preferVisualCards || supportsImageAnalysis;
2016-10-02 23:28:45 -07:00
html += cardBuilder.getCardsHtml({
items: timers,
shape: 'backdrop',
showTitle: true,
2016-10-12 11:23:09 -07:00
cardLayout: cardLayout,
vibrant: supportsImageAnalysis,
2016-10-02 23:28:45 -07:00
preferThumb: true,
coverImage: true,
overlayText: false,
showSeriesTimerTime: true,
2016-10-12 11:23:09 -07:00
showSeriesTimerChannel: true,
centerText: !cardLayout,
overlayMoreButton: !cardLayout
2016-10-02 23:28:45 -07:00
});
2016-05-15 10:11:26 -07:00
2016-06-06 18:55:16 -07:00
var elem = context.querySelector('#items');
elem.innerHTML = html;
2016-05-15 10:11:26 -07:00
2016-10-09 00:18:43 -07:00
imageLoader.lazyChildren(elem);
2016-05-15 10:11:26 -07:00
Dashboard.hideLoadingMsg();
}
2016-10-02 23:28:45 -07:00
function reload(context, promise) {
2016-05-15 10:11:26 -07:00
Dashboard.showLoadingMsg();
2016-10-02 23:28:45 -07:00
promise.then(function (result) {
2016-05-15 10:11:26 -07:00
2016-06-21 21:39:47 -07:00
renderTimers(context, result.Items);
2016-05-15 10:11:26 -07:00
});
}
return function (view, params, tabContent) {
var self = this;
2016-10-02 23:28:45 -07:00
var timersPromise; self.preRender = function () {
timersPromise = ApiClient.getLiveTvSeriesTimers(query);
};
self.renderTab = function () {
2016-05-15 10:11:26 -07:00
2016-10-02 23:28:45 -07:00
reload(tabContent, timersPromise);
2016-05-15 10:11:26 -07:00
};
};
});