jellyfin-web/dashboard-ui/scripts/indexpage.js
2013-04-01 22:14:37 -07:00

51 lines
1.5 KiB
JavaScript

(function ($, document, apiClient) {
$(document).on('pageshow', "#indexPage", function () {
var page = this;
var userId = Dashboard.getCurrentUserId();
if (!userId) {
return;
}
page = $(page);
var options = {
sortBy: "SortName"
};
apiClient.getItems(userId, options).done(function (result) {
$('#divCollections', page).html(LibraryBrowser.getPosterViewHtml({
items: result.Items,
showTitle: true
}));
});
var views = [
{ name: "Movies", url: "moviesrecommended.html", img: "css/images/items/list/chapter.png", background: "#E12026" },
{ name: "TV Shows", url: "tvrecommended.html", img: "css/images/items/list/collection.png", background: "#FF870F" },
{ name: "Music", url: "musicrecommended.html", img: "css/images/items/list/audiowide.png", background: "#4BB3DD" }
];
var html = '';
for (var i = 0, length = views.length; i < length; i++) {
var view = views[i];
html += '<div class="posterViewItem">';
html += '<a href="' + view.url + '">';
html += '<img style="background: ' + view.background + ';" src="' + view.img + '"><div class="posterViewItemText">' + view.name + '</div>';
html += '</a>';
html += '</div>';
}
$('#views', page).html(html);
});
})(jQuery, document, ApiClient);