1
0
Fork 0
mirror of https://github.com/jellyfin/jellyfin-web synced 2025-03-30 19:56:21 +00:00

add library folder option to home page

This commit is contained in:
Luke Pulverenti 2014-06-14 19:13:09 -04:00
parent 1987dfe628
commit 9029ce93d3
14 changed files with 94 additions and 17 deletions

View file

@ -103,7 +103,7 @@
switch (index) {
case 0:
return 'librarybuttons';
return 'smalllibrarytiles';
case 1:
return 'resume';
case 2:
@ -179,14 +179,16 @@
});
}
function loadLibraryTiles(elem, userId, shape) {
function loadLibraryTiles(elem, userId, shape, index) {
getUserViews(userId).done(function (items) {
var html = '';
if (items.length) {
html += '<h1 class="listHeader">' + Globalize.translate('HeaderMyLibrary') + '</h1>';
html += '<div>';
html += LibraryBrowser.getPosterViewHtml({
items: items,
@ -205,6 +207,42 @@
});
}
function loadLibraryFolders(elem, userId, shape, index) {
ApiClient.getItems(userId, {
SortBy: "SortName"
}).done(function (result) {
var html = '';
var items = result.Items;
for (var i = 0, length = items.length; i < length; i++) {
items[i].url = 'itemlist.html?parentid=' + items[i].Id;
}
if (items.length) {
html += '<h1 class="listHeader">' + Globalize.translate('HeaderLibraryFolders') + '</h1>';
html += '<div>';
html += LibraryBrowser.getPosterViewHtml({
items: items,
shape: shape,
showTitle: true,
centerText: true,
lazy: true
});
html += '</div>';
}
$(elem).html(html).trigger('create').createPosterItemMenus();
handleLibraryLinkNavigations(elem);
});
}
function loadResume(elem, userId) {
var screenWidth = $(window).width();
@ -256,10 +294,10 @@
loadRecentlyAdded(elem, userId);
}
else if (section == 'librarytiles') {
loadLibraryTiles(elem, userId, 'backdrop');
loadLibraryTiles(elem, userId, 'backdrop', index);
}
else if (section == 'smalllibrarytiles') {
loadLibraryTiles(elem, userId, 'smallBackdrop');
loadLibraryTiles(elem, userId, 'smallBackdrop', index);
}
else if (section == 'resume') {
loadResume(elem, userId);
@ -267,6 +305,9 @@
else if (section == 'librarybuttons') {
loadlibraryButtons(elem, userId, index);
} else if (section == 'folders') {
loadLibraryFolders(elem, userId, 'backdrop', index);
} else {
elem.empty();