mirror of
https://github.com/jellyfin/jellyfin-web
synced 2025-03-30 19:56:21 +00:00
new Artist entity
This commit is contained in:
parent
70668fe8d5
commit
7304a6584e
16 changed files with 914 additions and 196 deletions
|
@ -101,16 +101,7 @@
|
|||
$('#itemTagline', page).hide();
|
||||
}
|
||||
|
||||
if (item.Overview || item.OverviewHtml) {
|
||||
var overview = item.OverviewHtml || item.Overview;
|
||||
|
||||
$('#itemOverview', page).html(overview).show();
|
||||
$('#itemOverview a').each(function () {
|
||||
$(this).attr("target", "_blank");
|
||||
});
|
||||
} else {
|
||||
$('#itemOverview', page).hide();
|
||||
}
|
||||
LibraryBrowser.renderOverview($('#itemOverview', page), item);
|
||||
|
||||
if (item.CommunityRating) {
|
||||
$('#itemCommunityRating', page).html(LibraryBrowser.getStarRatingHtml(item)).show().attr('title', item.CommunityRating);
|
||||
|
|
|
@ -42,16 +42,7 @@
|
|||
$('#itemTagline', page).hide();
|
||||
}
|
||||
|
||||
if (item.Overview || item.OverviewHtml) {
|
||||
var overview = item.OverviewHtml || item.Overview;
|
||||
|
||||
$('#itemOverview', page).html(overview).show();
|
||||
$('#itemOverview a').each(function () {
|
||||
$(this).attr("target", "_blank");
|
||||
});
|
||||
} else {
|
||||
$('#itemOverview', page).hide();
|
||||
}
|
||||
LibraryBrowser.renderOverview($('#itemOverview', page), item);
|
||||
|
||||
if (item.CommunityRating) {
|
||||
$('#itemCommunityRating', page).html(LibraryBrowser.getStarRatingHtml(item)).show().attr('title', item.CommunityRating);
|
||||
|
|
|
@ -58,16 +58,7 @@
|
|||
$('#itemTagline', page).hide();
|
||||
}
|
||||
|
||||
if (item.Overview || item.OverviewHtml) {
|
||||
var overview = item.OverviewHtml || item.Overview;
|
||||
|
||||
$('#itemOverview', page).html(overview).show();
|
||||
$('#itemOverview a').each(function () {
|
||||
$(this).attr("target", "_blank");
|
||||
});
|
||||
} else {
|
||||
$('#itemOverview', page).hide();
|
||||
}
|
||||
LibraryBrowser.renderOverview($('#itemOverview', page), item);
|
||||
|
||||
if (item.CommunityRating) {
|
||||
$('#itemCommunityRating', page).html(LibraryBrowser.getStarRatingHtml(item)).show().attr('title', item.CommunityRating);
|
||||
|
|
|
@ -25,16 +25,7 @@
|
|||
|
||||
function renderDetails(page, item) {
|
||||
|
||||
if (item.Overview || item.OverviewHtml) {
|
||||
var overview = item.OverviewHtml || item.Overview;
|
||||
|
||||
$('#itemOverview', page).html(overview).show();
|
||||
$('#itemOverview a').each(function () {
|
||||
$(this).attr("target", "_blank");
|
||||
});
|
||||
} else {
|
||||
$('#itemOverview', page).hide();
|
||||
}
|
||||
LibraryBrowser.renderOverview($('#itemOverview', page), item);
|
||||
|
||||
if (item.CommunityRating) {
|
||||
$('#itemCommunityRating', page).html(LibraryBrowser.getStarRatingHtml(item)).show().attr('title', item.CommunityRating);
|
||||
|
|
|
@ -11,38 +11,40 @@
|
|||
var name = getParameterByName('person');
|
||||
|
||||
if (name) {
|
||||
getItemPromise = ApiClient.getPerson(name);
|
||||
getItemPromise = ApiClient.getPerson(name, Dashboard.getCurrentUserId());
|
||||
} else {
|
||||
|
||||
name = getParameterByName('studio');
|
||||
|
||||
if (name) {
|
||||
|
||||
getItemPromise = ApiClient.getStudio(name);
|
||||
getItemPromise = ApiClient.getStudio(name, Dashboard.getCurrentUserId());
|
||||
|
||||
} else {
|
||||
|
||||
name = getParameterByName('genre');
|
||||
|
||||
if (name) {
|
||||
getItemPromise = ApiClient.getGenre(name);
|
||||
getItemPromise = ApiClient.getGenre(name, Dashboard.getCurrentUserId());
|
||||
}
|
||||
else {
|
||||
throw new Error('Invalid request');
|
||||
|
||||
name = getParameterByName('artist');
|
||||
|
||||
if (name) {
|
||||
getItemPromise = ApiClient.getArtist(name, Dashboard.getCurrentUserId());
|
||||
}
|
||||
else {
|
||||
throw new Error('Invalid request');
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var getUserDataPromise = ApiClient.getItembyNameUserData(Dashboard.getCurrentUserId(), name);
|
||||
|
||||
$.when(getItemPromise, getUserDataPromise).done(function (response1, response2) {
|
||||
|
||||
var item = response1[0];
|
||||
var userdata = response2[0];
|
||||
getItemPromise.done(function (item) {
|
||||
|
||||
currentItem = item;
|
||||
|
||||
item.UserData = userdata;
|
||||
name = item.Name;
|
||||
|
||||
$('#itemImage', page).html(LibraryBrowser.getDetailImageHtml(item));
|
||||
|
@ -70,7 +72,11 @@
|
|||
}
|
||||
else if (item.Type == "Studio") {
|
||||
promise = ApiClient.getStudioItemCounts(Dashboard.getCurrentUserId(), item.Name);
|
||||
} else {
|
||||
}
|
||||
else if (item.Type == "Artist") {
|
||||
promise = ApiClient.getArtistItemCounts(Dashboard.getCurrentUserId(), item.Name);
|
||||
}
|
||||
else {
|
||||
throw new Error("Unknown item type: " + item.Type);
|
||||
}
|
||||
|
||||
|
@ -173,16 +179,7 @@
|
|||
|
||||
function renderDetails(page, item) {
|
||||
|
||||
if (item.Overview || item.OverviewHtml) {
|
||||
var overview = item.OverviewHtml || item.Overview;
|
||||
|
||||
$('#itemOverview', page).html(overview).show();
|
||||
$('#itemOverview a').each(function () {
|
||||
$(this).attr("target", "_blank");
|
||||
});
|
||||
} else {
|
||||
$('#itemOverview', page).hide();
|
||||
}
|
||||
LibraryBrowser.renderOverview($('#itemOverview', page), item);
|
||||
|
||||
renderUserDataIcons(page, item);
|
||||
LibraryBrowser.renderLinks($('#itemLinks', page), item);
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
var LibraryBrowser = (function (window, $) {
|
||||
|
||||
var defaultBackground = "#999;";
|
||||
|
||||
return {
|
||||
|
||||
getDetaultPageSize: function () {
|
||||
|
@ -26,11 +28,9 @@
|
|||
|
||||
if (options.preferBackdrop && item.BackdropImageTags && item.BackdropImageTags.length) {
|
||||
|
||||
html += "<img class='posterDetailViewImage' src='" + ApiClient.getImageUrl(item.Id, {
|
||||
type: "Backdrop",
|
||||
html += "<img class='posterDetailViewImage' src='" + LibraryBrowser.getImageUrl(item, 'Backdrop', 0, {
|
||||
height: 198,
|
||||
width: 352,
|
||||
tag: item.BackdropImageTags[0]
|
||||
width: 352
|
||||
|
||||
}) + "' />";
|
||||
|
||||
|
@ -44,14 +44,13 @@
|
|||
tag: item.ImageTags.Thumb
|
||||
|
||||
}) + "' />";
|
||||
|
||||
}
|
||||
else if (item.ImageTags && item.ImageTags.Primary) {
|
||||
|
||||
var height = 300;
|
||||
var width = primaryImageAspectRatio ? parseInt(height * primaryImageAspectRatio) : null;
|
||||
|
||||
html += "<img class='posterDetailViewImage' src='" + LibraryBrowser.getPrimaryImageUrl(item, {
|
||||
html += "<img class='posterDetailViewImage' src='" + LibraryBrowser.getImageUrl(item, 'Primary', 0, {
|
||||
height: height,
|
||||
width: width
|
||||
|
||||
|
@ -59,33 +58,35 @@
|
|||
|
||||
}
|
||||
else if (item.BackdropImageTags && item.BackdropImageTags.length) {
|
||||
html += "<img class='posterDetailViewImage' src='" + ApiClient.getImageUrl(item.Id, {
|
||||
type: "Backdrop",
|
||||
html += "<img class='posterDetailViewImage' src='" + LibraryBrowser.getImageUrl(item, 'Backdrop', 0, {
|
||||
height: 198,
|
||||
width: 352,
|
||||
tag: item.BackdropImageTags[0]
|
||||
width: 352
|
||||
|
||||
}) + "' />";
|
||||
}
|
||||
else if (item.MediaType == "Audio" || item.Type == "MusicAlbum" || item.Type == "MusicArtist") {
|
||||
|
||||
html += "<img class='posterDetailViewImage' style='background:" + LibraryBrowser.getMetroColor(item.Id) + ";' src='css/images/items/list/audio.png' />";
|
||||
html += "<img class='posterDetailViewImage' style='background:" + defaultBackground + ";' src='css/images/items/list/audio.png' />";
|
||||
}
|
||||
else if (item.MediaType == "Video" || item.Type == "Season" || item.Type == "Series") {
|
||||
|
||||
html += "<img class='posterDetailViewImage' style='background:" + LibraryBrowser.getMetroColor(item.Id) + ";' src='css/images/items/list/video.png' />";
|
||||
html += "<img class='posterDetailViewImage' style='background:" + defaultBackground + ";' src='css/images/items/list/video.png' />";
|
||||
}
|
||||
else if (item.Type == "Person") {
|
||||
|
||||
html += "<img class='posterDetailViewImage' style='background:" + LibraryBrowser.getMetroColor(item.Id) + ";' src='css/images/items/list/person.png' />";
|
||||
html += "<img class='posterDetailViewImage' style='background:" + defaultBackground + ";' src='css/images/items/list/person.png' />";
|
||||
}
|
||||
else if (item.Type == "Artist") {
|
||||
|
||||
html += "<img class='posterDetailViewImage' style='background:" + defaultBackground + ";' src='css/images/items/list/audiocollection.png' />";
|
||||
}
|
||||
else if (item.MediaType == "Game") {
|
||||
|
||||
html += "<img class='posterDetailViewImage' style='background:" + LibraryBrowser.getMetroColor(item.Id) + ";' src='css/images/items/list/game.png' />";
|
||||
html += "<img class='posterDetailViewImage' style='background:" + defaultBackground + ";' src='css/images/items/list/game.png' />";
|
||||
}
|
||||
else {
|
||||
|
||||
html += "<img class='posterDetailViewImage' style='background:" + LibraryBrowser.getMetroColor(item.Id) + ";' src='css/images/items/list/collection.png' />";
|
||||
html += "<img class='posterDetailViewImage' style='background:" + defaultBackground + ";' src='css/images/items/list/collection.png' />";
|
||||
}
|
||||
|
||||
html += '<div class="posterDetailViewContentContainer">';
|
||||
|
@ -118,7 +119,13 @@
|
|||
|
||||
html += '<p class="itemMiscInfo">' + childText + '</p>';
|
||||
}
|
||||
else if (item.Type == "Genre" || item.Type == "Studio" || item.Type == "Person") {
|
||||
else if (item.Type == "MusicAlbum") {
|
||||
|
||||
childText = item.ChildCount == 1 ? "1 Song" : item.ChildCount + " Songs";
|
||||
|
||||
html += '<p class="itemMiscInfo">' + childText + '</p>';
|
||||
}
|
||||
else if (item.Type == "Genre" || item.Type == "Studio" || item.Type == "Person" || item.Type == "Artist") {
|
||||
|
||||
childText = item.ChildCount == 1 ? "1 " + options.countNameSingular : item.ChildCount + " " + options.countNamePlural;
|
||||
|
||||
|
@ -128,6 +135,11 @@
|
|||
html += '<p class="itemMiscInfo">' + LibraryBrowser.getMiscInfoHtml(item) + '</p>';
|
||||
}
|
||||
|
||||
if (item.Type == "MusicAlbum") {
|
||||
|
||||
html += '<p class="itemMiscInfo">' + LibraryBrowser.getMiscInfoHtml(item) + '</p>';
|
||||
}
|
||||
|
||||
html += '<p class="userDataIcons">' + LibraryBrowser.getUserDataIconsHtml(item) + '</p>';
|
||||
|
||||
html += '</div>';
|
||||
|
@ -164,16 +176,25 @@
|
|||
if (item.Type == "Person") {
|
||||
return "itembynamedetails.html?person=" + item.Name;
|
||||
}
|
||||
if (item.Type == "Artist") {
|
||||
return "itembynamedetails.html?artist=" + item.Name;
|
||||
}
|
||||
|
||||
return item.IsFolder ? (item.Id ? "itemList.html?parentId=" + item.Id : "#") : "itemdetails.html?id=" + item.Id;
|
||||
|
||||
},
|
||||
|
||||
getPrimaryImageUrl: function (item, options) {
|
||||
getImageUrl: function (item, type, index, options) {
|
||||
|
||||
options = options || {};
|
||||
options.type = "Primary";
|
||||
options.tag = item.ImageTags.Primary;
|
||||
options.type = type;
|
||||
options.index = index;
|
||||
|
||||
if (type == 'Backdrop') {
|
||||
options.tag = item.BackdropImageTags[index];
|
||||
} else {
|
||||
options.tag = item.ImageTags[type];
|
||||
}
|
||||
|
||||
if (item.Type == "Studio") {
|
||||
|
||||
|
@ -187,6 +208,10 @@
|
|||
|
||||
return ApiClient.getGenreImageUrl(item.Name, options);
|
||||
}
|
||||
if (item.Type == "Artist") {
|
||||
|
||||
return ApiClient.getArtistImageUrl(item.Name, options);
|
||||
}
|
||||
|
||||
return ApiClient.getImageUrl(item.Id, options);
|
||||
|
||||
|
@ -243,11 +268,11 @@
|
|||
}
|
||||
else if (item.MediaType == "Audio" || item.Type == "MusicAlbum" || item.Type == "MusicArtist") {
|
||||
|
||||
html += "<img style='background:" + LibraryBrowser.getMetroColor(item.Id) + ";' src='css/images/items/list/audio.png' />";
|
||||
html += "<img style='background:" + defaultBackground + ";' src='css/images/items/list/audio.png' />";
|
||||
}
|
||||
else if (item.MediaType == "Video" || item.Type == "Season" || item.Type == "Series") {
|
||||
|
||||
html += "<img style='background:" + LibraryBrowser.getMetroColor(item.Id) + ";' src='css/images/items/list/video.png' />";
|
||||
html += "<img style='background:" + defaultBackground + ";' src='css/images/items/list/video.png' />";
|
||||
}
|
||||
else {
|
||||
|
||||
|
@ -316,7 +341,7 @@
|
|||
tag: item.BackdropImageTags[0]
|
||||
}) + "' />";
|
||||
} else {
|
||||
html += "<img style='background:" + LibraryBrowser.getMetroColor(item.Id) + ";' src='css/images/items/list/collection.png' />";
|
||||
html += "<img style='background:" + defaultBackground + ";' src='css/images/items/list/collection.png' />";
|
||||
}
|
||||
|
||||
if (showText) {
|
||||
|
@ -353,7 +378,7 @@
|
|||
return '<div class="posterRibbon">' + item.RecentlyAddedItemCount + ' New</div>';
|
||||
}
|
||||
|
||||
if (!item.IsFolder && item.Type !== "Genre" && item.Type !== "Studio" && item.Type !== "Person") {
|
||||
if (!item.IsFolder && item.Type !== "Genre" && item.Type !== "Studio" && item.Type !== "Person" && item.Type !== "Artist") {
|
||||
|
||||
var date = item.DateCreated;
|
||||
|
||||
|
@ -597,6 +622,9 @@
|
|||
else if (type == "Genre") {
|
||||
itemId = item.Name;
|
||||
}
|
||||
else if (type == "Artist") {
|
||||
itemId = item.Name;
|
||||
}
|
||||
|
||||
if (item.MediaType || item.IsFolder) {
|
||||
if (userData.Played) {
|
||||
|
@ -656,8 +684,17 @@
|
|||
|
||||
var markAsFavorite = $link.hasClass('imgFavoriteOff');
|
||||
|
||||
if (type == "Person" || type == "Studio" || type == "Genre") {
|
||||
ApiClient.updateItemByNameFavoriteStatus(Dashboard.getCurrentUserId(), id, markAsFavorite);
|
||||
if (type == "Person") {
|
||||
ApiClient.updateFavoritePersonStatus(Dashboard.getCurrentUserId(), id, markAsFavorite);
|
||||
}
|
||||
else if (type == "Studio") {
|
||||
ApiClient.updateFavoriteStudioStatus(Dashboard.getCurrentUserId(), id, markAsFavorite);
|
||||
}
|
||||
else if (type == "Artist") {
|
||||
ApiClient.updateFavoriteArtistStatus(Dashboard.getCurrentUserId(), id, markAsFavorite);
|
||||
}
|
||||
else if (type == "Genre") {
|
||||
ApiClient.updateFavoriteGenreStatus(Dashboard.getCurrentUserId(), id, markAsFavorite);
|
||||
}
|
||||
else {
|
||||
ApiClient.updateFavoriteStatus(Dashboard.getCurrentUserId(), id, markAsFavorite);
|
||||
|
@ -681,24 +718,14 @@
|
|||
|
||||
if ($link.hasClass('imgLikeOff')) {
|
||||
|
||||
if (type == "Person" || type == "Studio" || type == "Genre") {
|
||||
ApiClient.updateItemByNameRating(Dashboard.getCurrentUserId(), id, true);
|
||||
}
|
||||
else {
|
||||
ApiClient.updateUserItemRating(Dashboard.getCurrentUserId(), id, true);
|
||||
}
|
||||
LibraryBrowser.updateUserItemRating(type, id, true);
|
||||
|
||||
link.src = "css/images/userdata/thumbs_up_on.png";
|
||||
$link.addClass('imgLike').removeClass('imgLikeOff');
|
||||
|
||||
} else {
|
||||
|
||||
if (type == "Person" || type == "Studio" || type == "Genre") {
|
||||
ApiClient.clearItemByNameRating(Dashboard.getCurrentUserId(), id);
|
||||
}
|
||||
else {
|
||||
ApiClient.clearUserItemRating(Dashboard.getCurrentUserId(), id);
|
||||
}
|
||||
LibraryBrowser.clearUserItemRating(type, id);
|
||||
|
||||
link.src = "css/images/userdata/thumbs_up_off.png";
|
||||
$link.addClass('imgLikeOff').removeClass('imgLike');
|
||||
|
@ -718,24 +745,14 @@
|
|||
|
||||
if ($link.hasClass('imgDislikeOff')) {
|
||||
|
||||
if (type == "Person" || type == "Studio" || type == "Genre") {
|
||||
ApiClient.updateItemByNameRating(Dashboard.getCurrentUserId(), id, false);
|
||||
}
|
||||
else {
|
||||
ApiClient.updateUserItemRating(Dashboard.getCurrentUserId(), id, false);
|
||||
}
|
||||
LibraryBrowser.updateUserItemRating(type, id, false);
|
||||
|
||||
link.src = "css/images/userdata/thumbs_down_on.png";
|
||||
$link.addClass('imgDislike').removeClass('imgDislikeOff');
|
||||
|
||||
} else {
|
||||
|
||||
if (type == "Person" || type == "Studio" || type == "Genre") {
|
||||
ApiClient.clearItemByNameRating(Dashboard.getCurrentUserId(), id);
|
||||
}
|
||||
else {
|
||||
ApiClient.clearUserItemRating(Dashboard.getCurrentUserId(), id);
|
||||
}
|
||||
LibraryBrowser.clearUserItemRating(type, id);
|
||||
|
||||
link.src = "css/images/userdata/thumbs_down_off.png";
|
||||
$link.addClass('imgDislikeOff').removeClass('imgDislike');
|
||||
|
@ -746,6 +763,44 @@
|
|||
});
|
||||
},
|
||||
|
||||
updateUserItemRating: function (type, id, likes) {
|
||||
|
||||
if (type == "Person") {
|
||||
ApiClient.updatePersonRating(Dashboard.getCurrentUserId(), id, likes);
|
||||
}
|
||||
else if (type == "Studio") {
|
||||
ApiClient.updateStudioRating(Dashboard.getCurrentUserId(), id, likes);
|
||||
}
|
||||
else if (type == "Artist") {
|
||||
ApiClient.updateArtistRating(Dashboard.getCurrentUserId(), id, likes);
|
||||
}
|
||||
else if (type == "Genre") {
|
||||
ApiClient.updateGenreRating(Dashboard.getCurrentUserId(), id, likes);
|
||||
}
|
||||
else {
|
||||
ApiClient.updateUserItemRating(Dashboard.getCurrentUserId(), id, likes);
|
||||
}
|
||||
},
|
||||
|
||||
clearUserItemRating: function (type, id) {
|
||||
|
||||
if (type == "Person") {
|
||||
ApiClient.clearPersonRating(Dashboard.getCurrentUserId(), id);
|
||||
}
|
||||
else if (type == "Studio") {
|
||||
ApiClient.clearStudioRating(Dashboard.getCurrentUserId(), id);
|
||||
}
|
||||
else if (type == "Artist") {
|
||||
ApiClient.clearArtistRating(Dashboard.getCurrentUserId(), id);
|
||||
}
|
||||
else if (type == "Genre") {
|
||||
ApiClient.clearGenreRating(Dashboard.getCurrentUserId(), id);
|
||||
}
|
||||
else {
|
||||
ApiClient.clearUserItemRating(Dashboard.getCurrentUserId(), id);
|
||||
}
|
||||
},
|
||||
|
||||
getDetailImageHtml: function (item) {
|
||||
|
||||
var imageTags = item.ImageTags || {};
|
||||
|
@ -762,21 +817,28 @@
|
|||
url = ApiClient.getPersonImageUrl(item.Name, {
|
||||
maxwidth: 800,
|
||||
tag: imageTags.Primary,
|
||||
type: "primary"
|
||||
type: "Primary"
|
||||
});
|
||||
}
|
||||
else if (item.Type == "Genre") {
|
||||
url = ApiClient.getGenreImageUrl(item.Name, {
|
||||
maxwidth: 800,
|
||||
tag: imageTags.Primary,
|
||||
type: "primary"
|
||||
type: "Primary"
|
||||
});
|
||||
}
|
||||
else if (item.Type == "Studio") {
|
||||
url = ApiClient.getStudioImageUrl(item.Name, {
|
||||
maxwidth: 800,
|
||||
tag: imageTags.Primary,
|
||||
type: "primary"
|
||||
type: "Primary"
|
||||
});
|
||||
}
|
||||
else if (item.Type == "Artist") {
|
||||
url = ApiClient.getArtistImageUrl(item.Name, {
|
||||
maxwidth: 800,
|
||||
tag: imageTags.Primary,
|
||||
type: "Primary"
|
||||
});
|
||||
}
|
||||
else {
|
||||
|
@ -789,19 +851,79 @@
|
|||
}
|
||||
else if (item.BackdropImageTags && item.BackdropImageTags.length) {
|
||||
|
||||
url = ApiClient.getImageUrl(item.Id, {
|
||||
type: "Backdrop",
|
||||
maxwidth: 800,
|
||||
tag: item.BackdropImageTags[0]
|
||||
});
|
||||
if (item.Type == "Person") {
|
||||
url = ApiClient.getPersonImageUrl(item.Name, {
|
||||
maxwidth: 800,
|
||||
tag: item.BackdropImageTags[0],
|
||||
type: "Backdrop"
|
||||
});
|
||||
}
|
||||
else if (item.Type == "Genre") {
|
||||
url = ApiClient.getGenreImageUrl(item.Name, {
|
||||
maxwidth: 800,
|
||||
tag: item.BackdropImageTags[0],
|
||||
type: "Backdrop"
|
||||
});
|
||||
}
|
||||
else if (item.Type == "Studio") {
|
||||
url = ApiClient.getStudioImageUrl(item.Name, {
|
||||
maxwidth: 800,
|
||||
tag: item.BackdropImageTags[0],
|
||||
type: "Backdrop"
|
||||
});
|
||||
}
|
||||
else if (item.Type == "Artist") {
|
||||
url = ApiClient.getArtistImageUrl(item.Name, {
|
||||
maxwidth: 800,
|
||||
tag: item.BackdropImageTags[0],
|
||||
type: "Backdrop"
|
||||
});
|
||||
}
|
||||
else {
|
||||
url = ApiClient.getImageUrl(item.Id, {
|
||||
type: "Backdrop",
|
||||
maxwidth: 800,
|
||||
tag: item.BackdropImageTags[0]
|
||||
});
|
||||
}
|
||||
}
|
||||
else if (imageTags.Thumb) {
|
||||
|
||||
url = ApiClient.getImageUrl(item.Id, {
|
||||
type: "Thumb",
|
||||
maxwidth: 800,
|
||||
tag: item.ImageTags.Thumb
|
||||
});
|
||||
if (item.Type == "Person") {
|
||||
url = ApiClient.getPersonImageUrl(item.Name, {
|
||||
maxwidth: 800,
|
||||
tag: imageTags.Thumb,
|
||||
type: "Thumb"
|
||||
});
|
||||
}
|
||||
else if (item.Type == "Genre") {
|
||||
url = ApiClient.getGenreImageUrl(item.Name, {
|
||||
maxwidth: 800,
|
||||
tag: imageTags.Thumb,
|
||||
type: "Thumb"
|
||||
});
|
||||
}
|
||||
else if (item.Type == "Studio") {
|
||||
url = ApiClient.getStudioImageUrl(item.Name, {
|
||||
maxwidth: 800,
|
||||
tag: imageTags.Thumb,
|
||||
type: "Thumb"
|
||||
});
|
||||
}
|
||||
else if (item.Type == "Artist") {
|
||||
url = ApiClient.getArtistImageUrl(item.Name, {
|
||||
maxwidth: 800,
|
||||
tag: imageTags.Thumb,
|
||||
type: "Thumb"
|
||||
});
|
||||
}
|
||||
else {
|
||||
url = ApiClient.getImageUrl(item.Id, {
|
||||
type: "Thumb",
|
||||
maxwidth: 800,
|
||||
tag: item.ImageTags.Thumb
|
||||
});
|
||||
}
|
||||
}
|
||||
else if (imageTags.Disc) {
|
||||
|
||||
|
@ -839,7 +961,7 @@
|
|||
|
||||
if (url) {
|
||||
|
||||
var style = useBackgroundColor ? "background-color:" + LibraryBrowser.getMetroColor(item.Id) + ";" : "";
|
||||
var style = useBackgroundColor ? "background-color:" + defaultBackground + ";" : "";
|
||||
|
||||
if (maxwidth) {
|
||||
style += "max-width:" + maxwidth + "px;";
|
||||
|
@ -888,6 +1010,22 @@
|
|||
return miscInfo.join(' ');
|
||||
},
|
||||
|
||||
renderOverview: function (elem, item) {
|
||||
|
||||
if (item.Overview || item.OverviewHtml) {
|
||||
var overview = item.OverviewHtml || item.Overview;
|
||||
|
||||
elem.html(overview).show().trigger('create');
|
||||
|
||||
$('a', elem).each(function () {
|
||||
$(this).attr("target", "_blank");
|
||||
});
|
||||
} else {
|
||||
elem.hide();
|
||||
}
|
||||
|
||||
},
|
||||
|
||||
renderStudios: function (elem, item) {
|
||||
|
||||
if (item.Studios && item.Studios.length) {
|
||||
|
@ -1011,7 +1149,7 @@
|
|||
}) + "' />";
|
||||
}
|
||||
else {
|
||||
html += "<img style='background:" + LibraryBrowser.getMetroColor(item.Id) + ";' src='css/images/items/list/game.png' />";
|
||||
html += "<img style='background:" + defaultBackground + ";' src='css/images/items/list/game.png' />";
|
||||
}
|
||||
|
||||
if (showText) {
|
||||
|
@ -1185,7 +1323,7 @@
|
|||
|
||||
html += '<img src="' + imgUrl + '" />';
|
||||
} else {
|
||||
var style = "background-color:" + LibraryBrowser.getMetroColor(cast.Name) + ";";
|
||||
var style = "background-color:" + defaultBackground + ";";
|
||||
|
||||
html += '<img src="css/images/items/list/person.png" style="max-width:185px; ' + style + '"/>';
|
||||
}
|
||||
|
|
106
dashboard-ui/scripts/musicalbums.js
Normal file
106
dashboard-ui/scripts/musicalbums.js
Normal file
|
@ -0,0 +1,106 @@
|
|||
(function ($, document) {
|
||||
|
||||
// The base query options
|
||||
var query = {
|
||||
|
||||
SortBy: "SortName",
|
||||
SortOrder: "Ascending",
|
||||
IncludeItemTypes: "MusicAlbum",
|
||||
Recursive: true,
|
||||
Fields: "PrimaryImageAspectRatio,ItemCounts,DateCreated,UserData",
|
||||
Limit: LibraryBrowser.getDetaultPageSize(),
|
||||
StartIndex: 0
|
||||
};
|
||||
|
||||
function reloadItems(page) {
|
||||
|
||||
Dashboard.showLoadingMsg();
|
||||
|
||||
ApiClient.getItems(Dashboard.getCurrentUserId(), query).done(function (result) {
|
||||
|
||||
var html = '';
|
||||
|
||||
$('.listTopPaging', page).html(LibraryBrowser.getPagingHtml(query, result.TotalRecordCount, true)).trigger('create');
|
||||
|
||||
html += LibraryBrowser.getPosterDetailViewHtml({
|
||||
items: result.Items,
|
||||
useAverageAspectRatio: true
|
||||
});
|
||||
|
||||
html += LibraryBrowser.getPagingHtml(query, result.TotalRecordCount);
|
||||
|
||||
$('#items', page).html(html).trigger('create');
|
||||
|
||||
$('.selectPage', page).on('change', function () {
|
||||
query.StartIndex = (parseInt(this.value) - 1) * query.Limit;
|
||||
reloadItems(page);
|
||||
});
|
||||
|
||||
$('.btnNextPage', page).on('click', function () {
|
||||
query.StartIndex += query.Limit;
|
||||
reloadItems(page);
|
||||
});
|
||||
|
||||
$('.btnPreviousPage', page).on('click', function () {
|
||||
query.StartIndex -= query.Limit;
|
||||
reloadItems(page);
|
||||
});
|
||||
|
||||
Dashboard.hideLoadingMsg();
|
||||
});
|
||||
}
|
||||
|
||||
$(document).on('pageinit', "#musicAlbumsPage", function () {
|
||||
|
||||
var page = this;
|
||||
|
||||
$('.radioSortBy', this).on('click', function () {
|
||||
query.SortBy = this.getAttribute('data-sortby');
|
||||
query.StartIndex = 0;
|
||||
reloadItems(page);
|
||||
});
|
||||
|
||||
$('.radioSortOrder', this).on('click', function () {
|
||||
query.SortOrder = this.getAttribute('data-sortorder');
|
||||
query.StartIndex = 0;
|
||||
reloadItems(page);
|
||||
});
|
||||
|
||||
$('.chkStandardFilter', this).on('change', function () {
|
||||
|
||||
var filterName = this.getAttribute('data-filter');
|
||||
var filters = query.Filters || "";
|
||||
|
||||
filters = (',' + filters).replace(',' + filterName, '').substring(1);
|
||||
|
||||
if (this.checked) {
|
||||
filters = filters ? (filters + ',' + filterName) : filterName;
|
||||
}
|
||||
|
||||
query.StartIndex = 0;
|
||||
query.Filters = filters;
|
||||
|
||||
reloadItems(page);
|
||||
});
|
||||
|
||||
}).on('pagebeforeshow', "#musicAlbumsPage", function () {
|
||||
|
||||
reloadItems(this);
|
||||
|
||||
}).on('pageshow', "#musicAlbumsPage", function () {
|
||||
|
||||
// Reset form values using the last used query
|
||||
$('.radioSortBy', this).each(function () {
|
||||
|
||||
this.checked = query.SortBy == this.getAttribute('data-sortby');
|
||||
|
||||
}).checkboxradio('refresh');
|
||||
|
||||
$('.radioSortOrder', this).each(function () {
|
||||
|
||||
this.checked = query.SortOrder == this.getAttribute('data-sortorder');
|
||||
|
||||
}).checkboxradio('refresh');
|
||||
});
|
||||
|
||||
})(jQuery, document);
|
109
dashboard-ui/scripts/musicartists.js
Normal file
109
dashboard-ui/scripts/musicartists.js
Normal file
|
@ -0,0 +1,109 @@
|
|||
(function ($, document) {
|
||||
|
||||
// The base query options
|
||||
var query = {
|
||||
|
||||
SortBy: "SortName",
|
||||
SortOrder: "Ascending",
|
||||
IncludeItemTypes: "Audio",
|
||||
Recursive: true,
|
||||
Fields: "PrimaryImageAspectRatio,ItemCounts,DateCreated,UserData",
|
||||
Limit: LibraryBrowser.getDetaultPageSize(),
|
||||
StartIndex: 0
|
||||
};
|
||||
|
||||
function reloadItems(page) {
|
||||
|
||||
Dashboard.showLoadingMsg();
|
||||
|
||||
ApiClient.getArtists(Dashboard.getCurrentUserId(), query).done(function (result) {
|
||||
|
||||
var html = '';
|
||||
|
||||
$('.listTopPaging', page).html(LibraryBrowser.getPagingHtml(query, result.TotalRecordCount, true)).trigger('create');
|
||||
|
||||
html += LibraryBrowser.getPosterDetailViewHtml({
|
||||
items: result.Items,
|
||||
useAverageAspectRatio: true,
|
||||
countNameSingular: "Song",
|
||||
countNamePlural: "Songs",
|
||||
preferBackdrop: true
|
||||
});
|
||||
|
||||
html += LibraryBrowser.getPagingHtml(query, result.TotalRecordCount);
|
||||
|
||||
$('#items', page).html(html).trigger('create');
|
||||
|
||||
$('.selectPage', page).on('change', function () {
|
||||
query.StartIndex = (parseInt(this.value) - 1) * query.Limit;
|
||||
reloadItems(page);
|
||||
});
|
||||
|
||||
$('.btnNextPage', page).on('click', function () {
|
||||
query.StartIndex += query.Limit;
|
||||
reloadItems(page);
|
||||
});
|
||||
|
||||
$('.btnPreviousPage', page).on('click', function () {
|
||||
query.StartIndex -= query.Limit;
|
||||
reloadItems(page);
|
||||
});
|
||||
|
||||
Dashboard.hideLoadingMsg();
|
||||
});
|
||||
}
|
||||
|
||||
$(document).on('pageinit', "#musicArtistsPage", function () {
|
||||
|
||||
var page = this;
|
||||
|
||||
$('.radioSortBy', this).on('click', function () {
|
||||
query.SortBy = this.getAttribute('data-sortby');
|
||||
query.StartIndex = 0;
|
||||
reloadItems(page);
|
||||
});
|
||||
|
||||
$('.radioSortOrder', this).on('click', function () {
|
||||
query.SortOrder = this.getAttribute('data-sortorder');
|
||||
query.StartIndex = 0;
|
||||
reloadItems(page);
|
||||
});
|
||||
|
||||
$('.chkStandardFilter', this).on('change', function () {
|
||||
|
||||
var filterName = this.getAttribute('data-filter');
|
||||
var filters = query.Filters || "";
|
||||
|
||||
filters = (',' + filters).replace(',' + filterName, '').substring(1);
|
||||
|
||||
if (this.checked) {
|
||||
filters = filters ? (filters + ',' + filterName) : filterName;
|
||||
}
|
||||
|
||||
query.StartIndex = 0;
|
||||
query.Filters = filters;
|
||||
|
||||
reloadItems(page);
|
||||
});
|
||||
|
||||
}).on('pagebeforeshow', "#musicArtistsPage", function () {
|
||||
|
||||
reloadItems(this);
|
||||
|
||||
}).on('pageshow', "#musicArtistsPage", function () {
|
||||
|
||||
// Reset form values using the last used query
|
||||
$('.radioSortBy', this).each(function () {
|
||||
|
||||
this.checked = query.SortBy == this.getAttribute('data-sortby');
|
||||
|
||||
}).checkboxradio('refresh');
|
||||
|
||||
$('.radioSortOrder', this).each(function () {
|
||||
|
||||
this.checked = query.SortOrder == this.getAttribute('data-sortorder');
|
||||
|
||||
}).checkboxradio('refresh');
|
||||
});
|
||||
|
||||
})(jQuery, document);
|
|
@ -53,16 +53,7 @@
|
|||
$('#itemTagline', page).hide();
|
||||
}
|
||||
|
||||
if (item.Overview || item.OverviewHtml) {
|
||||
var overview = item.OverviewHtml || item.Overview;
|
||||
|
||||
$('#itemOverview', page).html(overview).show();
|
||||
$('#itemOverview a').each(function () {
|
||||
$(this).attr("target", "_blank");
|
||||
});
|
||||
} else {
|
||||
$('#itemOverview', page).hide();
|
||||
}
|
||||
LibraryBrowser.renderOverview($('#itemOverview', page), item);
|
||||
|
||||
if (item.CommunityRating) {
|
||||
$('#itemCommunityRating', page).html(LibraryBrowser.getStarRatingHtml(item)).show().attr('title', item.CommunityRating);
|
||||
|
|
|
@ -50,16 +50,7 @@
|
|||
$('#itemTagline', page).hide();
|
||||
}
|
||||
|
||||
if (item.Overview || item.OverviewHtml) {
|
||||
var overview = item.OverviewHtml || item.Overview;
|
||||
|
||||
$('#itemOverview', page).html(overview).show();
|
||||
$('#itemOverview a').each(function () {
|
||||
$(this).attr("target", "_blank");
|
||||
});
|
||||
} else {
|
||||
$('#itemOverview', page).hide();
|
||||
}
|
||||
LibraryBrowser.renderOverview($('#itemOverview', page), item);
|
||||
|
||||
if (item.CommunityRating) {
|
||||
$('#itemCommunityRating', page).html(LibraryBrowser.getStarRatingHtml(item)).show().attr('title', item.CommunityRating);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue