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/tvlatest.js

80 lines
2.1 KiB
JavaScript
Raw Normal View History

2014-02-23 00:52:30 -05:00
(function ($, document) {
2015-05-13 00:55:19 -04:00
function getView() {
if (AppInfo.hasLowImageBandwidth) {
return 'ThumbCard';
}
return 'Thumb';
}
2015-05-17 21:27:48 -04:00
$(document).on('pageshown', "#tvNextUpPage", function () {
2014-02-23 00:52:30 -05:00
var userId = Dashboard.getCurrentUserId();
2014-02-23 00:52:30 -05:00
2014-05-01 22:54:33 -04:00
var parentId = LibraryMenu.getTopParentId();
2014-02-23 00:52:30 -05:00
var page = this;
2015-05-13 00:55:19 -04:00
var limit = 30;
if (AppInfo.hasLowImageBandwidth) {
limit = 16;
}
2015-05-07 10:04:10 -04:00
2014-02-23 00:52:30 -05:00
var options = {
IncludeItemTypes: "Episode",
2015-05-07 10:04:10 -04:00
Limit: limit,
2014-12-11 01:20:28 -05:00
Fields: "PrimaryImageAspectRatio,SyncInfo",
ParentId: parentId,
2014-11-30 14:01:33 -05:00
ImageTypeLimit: 1,
2014-12-01 07:43:34 -05:00
EnableImageTypes: "Primary,Backdrop,Banner,Thumb"
2014-02-23 00:52:30 -05:00
};
ApiClient.getJSON(ApiClient.getUrl('Users/' + userId + '/Items/Latest', options)).done(function (items) {
2014-02-23 00:52:30 -05:00
2015-05-13 00:55:19 -04:00
var view = getView();
var html = '';
if (view == 'ThumbCard') {
html += LibraryBrowser.getPosterViewHtml({
items: items,
shape: "backdrop",
preferThumb: true,
inheritThumb: false,
showUnplayedIndicator: false,
showChildCountIndicator: true,
overlayText: false,
showParentTitle: true,
lazy: true,
showTitle: true,
cardLayout: true
});
} else if (view == 'Thumb') {
html += LibraryBrowser.getPosterViewHtml({
items: items,
shape: "backdrop",
preferThumb: true,
inheritThumb: false,
showParentTitle: false,
showUnplayedIndicator: false,
showChildCountIndicator: true,
overlayText: false,
centerText: true,
lazy: true,
showTitle: false
});
}
$('#latestEpisodes', page).html(html).lazyChildren();
2014-02-23 00:52:30 -05:00
});
});
})(jQuery, document);