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

77 lines
2.1 KiB
JavaScript
Raw Normal View History

2014-02-22 22:52:30 -07:00
(function ($, document) {
2015-05-12 21:55:19 -07:00
function getView() {
return 'Thumb';
}
2015-06-18 21:23:55 -07:00
$(document).on('pagebeforeshowready', "#tvNextUpPage", function () {
2014-02-22 22:52:30 -07:00
var userId = Dashboard.getCurrentUserId();
2014-02-22 22:52:30 -07:00
2014-05-01 19:54:33 -07:00
var parentId = LibraryMenu.getTopParentId();
2014-02-22 22:52:30 -07:00
var page = this;
2015-05-12 21:55:19 -07:00
var limit = 30;
if (AppInfo.hasLowImageBandwidth) {
limit = 16;
}
2015-05-07 07:04:10 -07:00
2014-02-22 22:52:30 -07:00
var options = {
IncludeItemTypes: "Episode",
2015-05-07 07:04:10 -07:00
Limit: limit,
2014-12-10 23:20:28 -07:00
Fields: "PrimaryImageAspectRatio,SyncInfo",
ParentId: parentId,
2014-11-30 12:01:33 -07:00
ImageTypeLimit: 1,
2014-12-01 05:43:34 -07:00
EnableImageTypes: "Primary,Backdrop,Banner,Thumb"
2014-02-22 22:52:30 -07:00
};
ApiClient.getJSON(ApiClient.getUrl('Users/' + userId + '/Items/Latest', options)).done(function (items) {
2014-02-22 22:52:30 -07:00
2015-05-12 21:55:19 -07: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
});
}
2015-06-28 08:43:49 -07:00
var elem = page.querySelector('#latestEpisodes');
elem.innerHTML = html;
ImageLoader.lazyChildren(elem);
2014-02-22 22:52:30 -07:00
});
});
})(jQuery, document);