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

114 lines
3.4 KiB
JavaScript
Raw Normal View History

2013-04-25 16:28:01 -07:00
(function ($, document) {
$(document).on('pagebeforeshow', "#musicRecommendedPage", function () {
var screenWidth = $(window).width();
2013-04-25 16:28:01 -07:00
var page = this;
var options = {
SortBy: "DateCreated",
SortOrder: "Descending",
IncludeItemTypes: "MusicAlbum",
2014-02-21 11:48:15 -07:00
Limit: screenWidth >= 1920 ? 6 : (screenWidth >= 1440 ? 6 : 5),
2013-04-25 16:28:01 -07:00
Recursive: true,
Fields: "PrimaryImageAspectRatio"
};
ApiClient.getItems(Dashboard.getCurrentUserId(), options).done(function (result) {
$('#recentlyAddedAlbums', page).html(LibraryBrowser.getPosterViewHtml({
items: result.Items,
2013-12-27 14:20:27 -07:00
showUnplayedIndicator: false,
shape: "square",
showTitle: true,
showParentTitle: true
})).createPosterItemMenus();
2013-04-25 16:28:01 -07:00
});
options = {
SortBy: "DateCreated",
SortOrder: "Descending",
IncludeItemTypes: "Audio",
2014-02-21 11:48:15 -07:00
Limit: screenWidth >= 1920 ? 6 : (screenWidth >= 1440 ? 6 : 5),
2013-04-25 16:28:01 -07:00
Recursive: true,
2013-04-25 17:52:55 -07:00
Fields: "PrimaryImageAspectRatio,AudioInfo"
2013-04-25 16:28:01 -07:00
};
ApiClient.getItems(Dashboard.getCurrentUserId(), options).done(function (result) {
$('#recentlyAddedSongs', page).html(LibraryBrowser.getPosterViewHtml({
items: result.Items,
2013-12-27 14:20:27 -07:00
showUnplayedIndicator: false,
2013-04-25 17:52:55 -07:00
shape: "square",
showTitle: true,
showParentTitle: true
})).createPosterItemMenus();
2013-04-25 17:52:55 -07:00
});
options = {
SortBy: "DatePlayed",
SortOrder: "Descending",
IncludeItemTypes: "Audio",
2014-02-21 11:48:15 -07:00
Limit: screenWidth >= 1920 ? 6 : (screenWidth >= 1440 ? 6 : 5),
2013-04-25 17:52:55 -07:00
Recursive: true,
Fields: "PrimaryImageAspectRatio,AudioInfo",
Filters: "IsPlayed"
};
ApiClient.getItems(Dashboard.getCurrentUserId(), options).done(function (result) {
if (result.Items.length) {
$('#recentlyPlayed', page).show();
} else {
$('#recentlyPlayed', page).hide();
}
$('#recentlyPlayedSongs', page).html(LibraryBrowser.getPosterViewHtml({
items: result.Items,
2013-12-27 14:20:27 -07:00
showUnplayedIndicator: false,
2013-04-25 17:52:55 -07:00
shape: "square",
showTitle: true,
showParentTitle: true
})).createPosterItemMenus();
2013-04-25 17:52:55 -07:00
});
options = {
SortBy: "PlayCount",
SortOrder: "Descending",
IncludeItemTypes: "Audio",
2014-02-21 11:48:15 -07:00
Limit: screenWidth >= 1920 ? 12 : (screenWidth >= 1440 ? 12 : 10),
2013-04-25 17:52:55 -07:00
Recursive: true,
Fields: "PrimaryImageAspectRatio,AudioInfo",
Filters: "IsPlayed"
};
ApiClient.getItems(Dashboard.getCurrentUserId(), options).done(function (result) {
if (result.Items.length) {
$('#topPlayed', page).show();
} else {
$('#topPlayed', page).hide();
}
$('#topPlayedSongs', page).html(LibraryBrowser.getPosterViewHtml({
items: result.Items,
2013-12-27 14:20:27 -07:00
showUnplayedIndicator: false,
2013-04-25 17:52:55 -07:00
shape: "square",
showTitle: true,
showParentTitle: true
})).createPosterItemMenus();
2013-04-25 16:28:01 -07:00
});
});
})(jQuery, document);