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

88 lines
2.4 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() {
return 'Thumb';
}
2015-06-29 22:52:23 -04:00
function loadLatest(page) {
2014-02-23 00:52:30 -05:00
2015-06-30 01:45:20 -04:00
Dashboard.showLoadingMsg();
var userId = Dashboard.getCurrentUserId();
2014-02-23 00:52:30 -05:00
2014-05-01 22:54:33 -04:00
var parentId = LibraryMenu.getTopParentId();
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
});
}
2015-06-28 11:43:49 -04:00
var elem = page.querySelector('#latestEpisodes');
elem.innerHTML = html;
ImageLoader.lazyChildren(elem);
2015-06-30 01:45:20 -04:00
Dashboard.hideLoadingMsg();
LibraryBrowser.setLastRefreshed(page);
2014-02-23 00:52:30 -05:00
});
2015-06-29 22:52:23 -04:00
}
$(document).on('pagebeforeshowready', "#tvNextUpPage", function () {
var page = this;
2015-06-30 01:45:20 -04:00
if (LibraryBrowser.needsRefresh(page)) {
2015-06-29 22:52:23 -04:00
loadLatest(page);
}
2014-02-23 00:52:30 -05:00
});
})(jQuery, document);