mirror of
https://github.com/jellyfin/jellyfin-web
synced 2025-03-30 19:56:21 +00:00
update latest channel content display
This commit is contained in:
parent
0c7a62c3d9
commit
d12c2644e7
9 changed files with 92 additions and 64 deletions
|
@ -1,21 +1,47 @@
|
|||
(function ($, document) {
|
||||
|
||||
function reloadItems(page) {
|
||||
function reloadFromChannels(page, channels) {
|
||||
|
||||
Dashboard.showLoadingMsg();
|
||||
var channelsHtml = channels.map(function (c) {
|
||||
|
||||
return '<div id="channel' + c.Id + '"></div>';
|
||||
|
||||
}).join('');
|
||||
|
||||
$('.items', page).html(channelsHtml);
|
||||
|
||||
for (var i = 0, length = channels.length; i < length; i++) {
|
||||
|
||||
var channel = channels[i];
|
||||
|
||||
reloadFromChannel(page, channel, i);
|
||||
}
|
||||
}
|
||||
|
||||
function reloadFromChannel(page, channel, index) {
|
||||
|
||||
var options = {
|
||||
|
||||
Limit: 30,
|
||||
Limit: 7,
|
||||
Fields: "PrimaryImageAspectRatio",
|
||||
Filters: "IsUnplayed",
|
||||
UserId: Dashboard.getCurrentUserId()
|
||||
UserId: Dashboard.getCurrentUserId(),
|
||||
ChannelIds: channel.Id
|
||||
};
|
||||
|
||||
$.getJSON(ApiClient.getUrl("Channels/Items/Latest", options)).done(function (result) {
|
||||
|
||||
var html = '';
|
||||
|
||||
if (result.Items.length) {
|
||||
|
||||
var text = Globalize.translate('HeaderLatestFromChannel').replace('{0}', channel.Name);
|
||||
if (index) {
|
||||
html += '<h1 class="listHeader">' + text + '</h1>';
|
||||
} else {
|
||||
html += '<h1 class="listHeader firstListHeader">' + text + '</h1>';
|
||||
}
|
||||
}
|
||||
html += LibraryBrowser.getPosterViewHtml({
|
||||
items: result.Items,
|
||||
shape: 'auto',
|
||||
|
@ -25,8 +51,24 @@
|
|||
lazy: true
|
||||
});
|
||||
|
||||
$("#items", page).html(html).trigger('create').createPosterItemMenus();
|
||||
|
||||
$('#channel' + channel.Id + '', page).html(html).trigger('create').createPosterItemMenus();
|
||||
});
|
||||
}
|
||||
|
||||
function reloadItems(page) {
|
||||
|
||||
Dashboard.showLoadingMsg();
|
||||
|
||||
var options = {
|
||||
|
||||
UserId: Dashboard.getCurrentUserId(),
|
||||
SupportsLatestItems: true
|
||||
};
|
||||
|
||||
$.getJSON(ApiClient.getUrl("Channels", options)).done(function (result) {
|
||||
|
||||
reloadFromChannels(page, result.Items);
|
||||
|
||||
Dashboard.hideLoadingMsg();
|
||||
});
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue