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

51 lines
1.5 KiB
JavaScript
Raw Normal View History

(function ($, document, apiClient) {
2013-02-20 18:33:05 -07:00
2013-04-01 08:59:56 -07:00
$(document).on('pageshow', "#indexPage", function () {
2013-02-20 18:33:05 -07:00
2013-04-01 08:59:56 -07:00
var page = this;
2013-02-20 18:33:05 -07:00
2013-04-01 08:59:56 -07:00
var userId = Dashboard.getCurrentUserId();
2013-02-20 18:33:05 -07:00
if (!userId) {
return;
}
page = $(page);
var options = {
sortBy: "SortName"
};
apiClient.getItems(userId, options).done(function (result) {
2013-02-20 18:33:05 -07:00
2013-04-01 22:14:37 -07:00
$('#divCollections', page).html(LibraryBrowser.getPosterViewHtml({
2013-02-20 18:33:05 -07:00
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);
2013-04-01 08:59:56 -07:00
});
2013-02-20 18:33:05 -07:00
})(jQuery, document, ApiClient);