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

66 lines
1.9 KiB
JavaScript
Raw Normal View History

2013-10-24 10:49:24 -07:00
(function ($, document) {
$(document).on('pagebeforeshow', "#tvUpcomingPage", function () {
var page = this;
var query = {
2013-10-24 10:49:24 -07:00
SortBy: "PremiereDate,AirTime,SortName",
2013-10-24 10:49:24 -07:00
SortOrder: "Ascending",
IncludeItemTypes: "Episode",
Limit: 30,
2013-10-24 10:49:24 -07:00
Recursive: true,
Fields: "SeriesInfo,UserData"
2013-10-24 10:49:24 -07:00
};
var missedItemsQuery = $.extend({
IsUnaired: false
}, query);
var yesterday = new Date();
yesterday.setDate(yesterday.getDate() - 1);
yesterday.setHours(0, 0, 0, 0);
missedItemsQuery.MinPremiereDate = yesterday.toISOString();
var unairedQuery = $.extend({
2013-10-24 10:49:24 -07:00
IsUnaired: true
}, query);
var promise1 = ApiClient.getItems(Dashboard.getCurrentUserId(), missedItemsQuery);
var promise2 = ApiClient.getItems(Dashboard.getCurrentUserId(), unairedQuery);
$.when(promise1, promise2).done(function (response1, response2) {
var missedItems = response1[0].Items;
var unairedItems = response2[0].Items;
for (var i = 0, length = unairedItems.length; i < length; i++) {
missedItems.push(unairedItems[i]);
}
if (!missedItems.length) {
$('#upcomingItems', page).html("<p>Nothing here. Please ensure <a href='metadata.html'>downloading of internet metadata</a> is enabled.</p>").trigger('create');
2013-10-24 10:49:24 -07:00
return;
}
2013-10-24 10:49:24 -07:00
$('#upcomingItems', page).html(LibraryBrowser.getPosterViewHtml({
items: missedItems,
2013-10-24 10:49:24 -07:00
showLocationTypeIndicator: false,
shape: "backdrop",
showTitle: true,
showPremiereDate: true,
showPremiereDateIndex: true,
preferThumb: true
2014-01-14 22:01:58 -07:00
})).createPosterItemHoverMenu();
2013-10-24 10:49:24 -07:00
});
});
})(jQuery, document);