2013-04-10 12:33:19 -07:00
|
|
|
|
var LibraryBrowser = (function (window, $) {
|
2013-04-08 22:06:13 -07:00
|
|
|
|
|
2013-04-23 19:50:43 -07:00
|
|
|
|
function encodeName(name) {
|
|
|
|
|
return name;
|
|
|
|
|
return encodeURIComponent(name).replace("'", '%27');
|
|
|
|
|
}
|
|
|
|
|
|
2013-04-21 21:38:03 -07:00
|
|
|
|
var defaultBackground = "#999;";
|
|
|
|
|
|
2013-04-10 12:33:19 -07:00
|
|
|
|
return {
|
2013-04-09 09:42:55 -07:00
|
|
|
|
|
2013-04-10 12:33:19 -07:00
|
|
|
|
getDetaultPageSize: function () {
|
2013-04-09 21:38:04 -07:00
|
|
|
|
|
2013-04-10 12:33:19 -07:00
|
|
|
|
if (window.location.toString().toLowerCase().indexOf('localhost') != -1) {
|
|
|
|
|
return 100;
|
|
|
|
|
}
|
2013-04-15 16:15:46 -07:00
|
|
|
|
return 20;
|
2013-04-10 12:33:19 -07:00
|
|
|
|
},
|
2013-04-01 22:14:37 -07:00
|
|
|
|
|
2013-04-10 22:27:27 -07:00
|
|
|
|
getPosterDetailViewHtml: function (options) {
|
2013-04-01 22:14:37 -07:00
|
|
|
|
|
2013-04-10 12:33:19 -07:00
|
|
|
|
var items = options.items;
|
2013-04-24 13:28:42 -07:00
|
|
|
|
|
2013-04-23 19:50:43 -07:00
|
|
|
|
if (!options.shape) {
|
|
|
|
|
options.shape = options.preferBackdrop ? "backdrop" : "poster";
|
|
|
|
|
}
|
2013-04-01 22:14:37 -07:00
|
|
|
|
|
2013-04-10 12:33:19 -07:00
|
|
|
|
var primaryImageAspectRatio = options.useAverageAspectRatio ? LibraryBrowser.getAveragePrimaryImageAspectRatio(items) : null;
|
2013-04-01 22:14:37 -07:00
|
|
|
|
|
2013-04-10 22:27:27 -07:00
|
|
|
|
var html = '';
|
2013-04-01 22:14:37 -07:00
|
|
|
|
|
2013-04-10 12:33:19 -07:00
|
|
|
|
for (var i = 0, length = items.length; i < length; i++) {
|
2013-04-10 22:27:27 -07:00
|
|
|
|
|
2013-04-10 12:33:19 -07:00
|
|
|
|
var item = items[i];
|
2013-04-01 22:14:37 -07:00
|
|
|
|
|
2013-04-22 13:06:43 -07:00
|
|
|
|
var imgUrl;
|
|
|
|
|
var isDefault = false;
|
|
|
|
|
|
2013-04-23 19:50:43 -07:00
|
|
|
|
var cssClass = "tileItem";
|
|
|
|
|
|
|
|
|
|
if (options.shape) {
|
|
|
|
|
cssClass += " " + options.shape + "TileItem";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
html += '<a class="' + cssClass + '" href="' + LibraryBrowser.getHref(item, options.context) + '">';
|
2013-04-01 22:14:37 -07:00
|
|
|
|
|
2013-04-10 22:27:27 -07:00
|
|
|
|
if (options.preferBackdrop && item.BackdropImageTags && item.BackdropImageTags.length) {
|
2013-04-01 22:14:37 -07:00
|
|
|
|
|
2013-04-22 13:06:43 -07:00
|
|
|
|
imgUrl = LibraryBrowser.getImageUrl(item, 'Backdrop', 0, {
|
2013-04-10 22:27:27 -07:00
|
|
|
|
height: 198,
|
2013-04-21 21:38:03 -07:00
|
|
|
|
width: 352
|
2013-04-22 13:06:43 -07:00
|
|
|
|
});
|
2013-04-01 22:14:37 -07:00
|
|
|
|
|
2013-04-10 22:27:27 -07:00
|
|
|
|
}
|
|
|
|
|
else if (options.preferBackdrop && item.ImageTags && item.ImageTags.Thumb) {
|
2013-04-09 21:38:04 -07:00
|
|
|
|
|
2013-04-22 13:06:43 -07:00
|
|
|
|
imgUrl = ApiClient.getImageUrl(item.Id, {
|
2013-04-10 22:27:27 -07:00
|
|
|
|
type: "Thumb",
|
2013-04-10 12:33:19 -07:00
|
|
|
|
height: 198,
|
|
|
|
|
width: 352,
|
2013-04-10 22:27:27 -07:00
|
|
|
|
tag: item.ImageTags.Thumb
|
2013-04-22 13:06:43 -07:00
|
|
|
|
});
|
2013-04-10 22:27:27 -07:00
|
|
|
|
}
|
|
|
|
|
else if (item.ImageTags && item.ImageTags.Primary) {
|
2013-04-01 22:14:37 -07:00
|
|
|
|
|
2013-04-10 12:33:19 -07:00
|
|
|
|
var height = 300;
|
|
|
|
|
var width = primaryImageAspectRatio ? parseInt(height * primaryImageAspectRatio) : null;
|
2013-04-09 21:38:04 -07:00
|
|
|
|
|
2013-04-22 13:06:43 -07:00
|
|
|
|
imgUrl = LibraryBrowser.getImageUrl(item, 'Primary', 0, {
|
2013-04-10 12:33:19 -07:00
|
|
|
|
height: height,
|
2013-04-11 20:50:47 -07:00
|
|
|
|
width: width
|
2013-04-22 13:06:43 -07:00
|
|
|
|
});
|
2013-04-09 21:38:04 -07:00
|
|
|
|
|
2013-04-10 22:27:27 -07:00
|
|
|
|
}
|
|
|
|
|
else if (item.BackdropImageTags && item.BackdropImageTags.length) {
|
2013-04-22 13:06:43 -07:00
|
|
|
|
|
|
|
|
|
imgUrl = LibraryBrowser.getImageUrl(item, 'Backdrop', 0, {
|
2013-04-10 12:33:19 -07:00
|
|
|
|
height: 198,
|
2013-04-21 21:38:03 -07:00
|
|
|
|
width: 352
|
2013-04-22 13:06:43 -07:00
|
|
|
|
});
|
2013-04-10 12:33:19 -07:00
|
|
|
|
}
|
|
|
|
|
else if (item.MediaType == "Audio" || item.Type == "MusicAlbum" || item.Type == "MusicArtist") {
|
2013-04-04 10:27:36 -07:00
|
|
|
|
|
2013-04-22 13:06:43 -07:00
|
|
|
|
imgUrl = "css/images/items/list/audio.png";
|
|
|
|
|
isDefault = true;
|
2013-04-10 12:33:19 -07:00
|
|
|
|
}
|
|
|
|
|
else if (item.MediaType == "Video" || item.Type == "Season" || item.Type == "Series") {
|
2013-04-01 22:14:37 -07:00
|
|
|
|
|
2013-04-22 13:06:43 -07:00
|
|
|
|
imgUrl = "css/images/items/list/video.png";
|
|
|
|
|
isDefault = true;
|
2013-04-10 12:33:19 -07:00
|
|
|
|
}
|
2013-04-11 20:50:47 -07:00
|
|
|
|
else if (item.Type == "Person") {
|
|
|
|
|
|
2013-04-22 13:06:43 -07:00
|
|
|
|
imgUrl = "css/images/items/list/person.png";
|
|
|
|
|
isDefault = true;
|
2013-04-21 21:38:03 -07:00
|
|
|
|
}
|
|
|
|
|
else if (item.Type == "Artist") {
|
|
|
|
|
|
2013-04-22 13:06:43 -07:00
|
|
|
|
imgUrl = "css/images/items/list/audiocollection.png";
|
|
|
|
|
isDefault = true;
|
2013-04-11 20:50:47 -07:00
|
|
|
|
}
|
2013-04-14 20:37:07 -07:00
|
|
|
|
else if (item.MediaType == "Game") {
|
|
|
|
|
|
2013-04-22 13:06:43 -07:00
|
|
|
|
imgUrl = "css/images/items/list/game.png";
|
|
|
|
|
isDefault = true;
|
2013-04-14 20:37:07 -07:00
|
|
|
|
}
|
2013-04-23 16:21:49 -07:00
|
|
|
|
else if (item.Type == "Studio" || item.Type == "Genre") {
|
|
|
|
|
|
|
|
|
|
if (options.context == "games") {
|
|
|
|
|
|
|
|
|
|
imgUrl = "css/images/items/list/game.png";
|
|
|
|
|
}
|
|
|
|
|
else if (options.context == "music") {
|
|
|
|
|
|
|
|
|
|
imgUrl = "css/images/items/list/audio.png";
|
|
|
|
|
}
|
|
|
|
|
else if (options.context == "movies") {
|
|
|
|
|
|
|
|
|
|
imgUrl = "css/images/items/list/chapter.png";
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
imgUrl = "css/images/items/list/collection.png";
|
|
|
|
|
}
|
|
|
|
|
isDefault = true;
|
|
|
|
|
}
|
2013-04-10 12:33:19 -07:00
|
|
|
|
else {
|
2013-04-01 22:14:37 -07:00
|
|
|
|
|
2013-04-22 13:06:43 -07:00
|
|
|
|
imgUrl = "css/images/items/list/collection.png";
|
|
|
|
|
isDefault = true;
|
2013-04-10 12:33:19 -07:00
|
|
|
|
}
|
2013-04-01 22:14:37 -07:00
|
|
|
|
|
2013-04-23 19:50:43 -07:00
|
|
|
|
cssClass = isDefault ? "tileImage defaultTileImage" : "tileImage";
|
2013-04-22 13:06:43 -07:00
|
|
|
|
|
|
|
|
|
html += '<div class="' + cssClass + '" style="background-image: url(\'' + imgUrl + '\');"></div>';
|
|
|
|
|
|
|
|
|
|
html += '<div class="tileContent">';
|
2013-04-10 22:27:27 -07:00
|
|
|
|
|
|
|
|
|
if (item.SeriesName || item.Album) {
|
|
|
|
|
var seriesName = item.SeriesName || item.Album;
|
2013-04-22 13:06:43 -07:00
|
|
|
|
html += '<div class="tileName">' + seriesName + '</div>';
|
2013-04-10 12:33:19 -07:00
|
|
|
|
}
|
2013-04-09 21:38:04 -07:00
|
|
|
|
|
2013-04-10 22:27:27 -07:00
|
|
|
|
var name = item.Name;
|
|
|
|
|
|
|
|
|
|
if (item.IndexNumber != null) {
|
|
|
|
|
name = item.IndexNumber + " - " + name;
|
|
|
|
|
}
|
|
|
|
|
if (item.ParentIndexNumber != null) {
|
|
|
|
|
name = item.ParentIndexNumber + "." + name;
|
2013-04-10 12:33:19 -07:00
|
|
|
|
}
|
2013-04-10 06:53:44 -07:00
|
|
|
|
|
2013-04-22 13:06:43 -07:00
|
|
|
|
html += '<div class="tileName">' + name + '</div>';
|
2013-04-01 22:14:37 -07:00
|
|
|
|
|
2013-04-10 22:27:27 -07:00
|
|
|
|
if (item.CommunityRating) {
|
|
|
|
|
html += '<p>' + LibraryBrowser.getFiveStarRatingHtml(item) + '</p>';
|
|
|
|
|
}
|
2013-04-11 12:36:50 -07:00
|
|
|
|
|
|
|
|
|
var childText;
|
2013-04-12 07:13:47 -07:00
|
|
|
|
|
2013-04-11 08:43:57 -07:00
|
|
|
|
if (item.Type == "BoxSet") {
|
2013-04-10 22:27:27 -07:00
|
|
|
|
|
2013-04-11 12:36:50 -07:00
|
|
|
|
childText = item.ChildCount == 1 ? "1 Movie" : item.ChildCount + " Movies";
|
2013-04-12 07:13:47 -07:00
|
|
|
|
|
2013-04-11 12:36:50 -07:00
|
|
|
|
html += '<p class="itemMiscInfo">' + childText + '</p>';
|
|
|
|
|
}
|
2013-04-28 11:30:58 -07:00
|
|
|
|
else if (item.Type == "GamePlatform") {
|
|
|
|
|
|
|
|
|
|
childText = item.ChildCount == 1 ? "1 Game" : item.ChildCount + " Games";
|
|
|
|
|
|
|
|
|
|
html += '<p class="itemMiscInfo">' + childText + '</p>';
|
|
|
|
|
}
|
2013-04-21 21:38:03 -07:00
|
|
|
|
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") {
|
2013-04-11 12:36:50 -07:00
|
|
|
|
|
|
|
|
|
childText = item.ChildCount == 1 ? "1 " + options.countNameSingular : item.ChildCount + " " + options.countNamePlural;
|
|
|
|
|
|
|
|
|
|
html += '<p class="itemMiscInfo">' + childText + '</p>';
|
|
|
|
|
}
|
|
|
|
|
else {
|
2013-04-18 19:52:22 -07:00
|
|
|
|
html += '<p class="itemMiscInfo">' + LibraryBrowser.getMiscInfoHtml(item) + '</p>';
|
2013-04-11 08:43:57 -07:00
|
|
|
|
}
|
2013-04-10 22:27:27 -07:00
|
|
|
|
|
2013-04-21 21:38:03 -07:00
|
|
|
|
if (item.Type == "MusicAlbum") {
|
|
|
|
|
|
|
|
|
|
html += '<p class="itemMiscInfo">' + LibraryBrowser.getMiscInfoHtml(item) + '</p>';
|
|
|
|
|
}
|
|
|
|
|
|
2013-04-10 22:27:27 -07:00
|
|
|
|
html += '<p class="userDataIcons">' + LibraryBrowser.getUserDataIconsHtml(item) + '</p>';
|
|
|
|
|
|
|
|
|
|
html += '</div>';
|
|
|
|
|
|
|
|
|
|
html += LibraryBrowser.getNewIndicatorHtml(item);
|
|
|
|
|
|
|
|
|
|
html += "</a>";
|
2013-04-10 12:33:19 -07:00
|
|
|
|
}
|
2013-04-01 22:14:37 -07:00
|
|
|
|
|
2013-04-10 12:33:19 -07:00
|
|
|
|
return html;
|
|
|
|
|
},
|
2013-04-01 22:14:37 -07:00
|
|
|
|
|
2013-04-22 20:56:11 -07:00
|
|
|
|
getSongTableHtml: function (items, options) {
|
|
|
|
|
|
|
|
|
|
options = options || {};
|
2013-04-22 13:06:43 -07:00
|
|
|
|
|
|
|
|
|
var html = '';
|
|
|
|
|
|
2013-04-25 20:31:10 -07:00
|
|
|
|
var cssClass = "detailTable";
|
2013-04-22 20:56:11 -07:00
|
|
|
|
|
2013-04-25 20:31:10 -07:00
|
|
|
|
html += '<div class="detailTableContainer"><table class="' + cssClass + '">';
|
2013-04-22 13:06:43 -07:00
|
|
|
|
|
|
|
|
|
html += '<tr>';
|
|
|
|
|
|
|
|
|
|
html += '<th></th>';
|
2013-04-22 20:56:11 -07:00
|
|
|
|
|
2013-04-27 15:04:14 -07:00
|
|
|
|
html += '<th class="tabletColumn">Track</th>';
|
2013-04-22 20:56:11 -07:00
|
|
|
|
|
|
|
|
|
if (options.showAlbum) {
|
|
|
|
|
html += '<th>Album</th>';
|
|
|
|
|
}
|
|
|
|
|
if (options.showArtist) {
|
2013-04-25 20:31:10 -07:00
|
|
|
|
html += '<th>Artist</th>';
|
2013-04-22 20:56:11 -07:00
|
|
|
|
}
|
|
|
|
|
|
2013-04-27 15:04:14 -07:00
|
|
|
|
html += '<th class="tabletColumn">Duration</th>';
|
|
|
|
|
html += '<th class="tabletColumn">Play Count</th>';
|
|
|
|
|
html += '<th class="tabletColumn userDataCell"></th>';
|
2013-04-22 13:06:43 -07:00
|
|
|
|
|
|
|
|
|
html += '</tr>';
|
|
|
|
|
|
|
|
|
|
for (var i = 0, length = items.length; i < length; i++) {
|
|
|
|
|
|
|
|
|
|
var item = items[i];
|
|
|
|
|
|
|
|
|
|
html += '<tr>';
|
|
|
|
|
|
|
|
|
|
var num = item.IndexNumber;
|
|
|
|
|
|
|
|
|
|
if (num && item.ParentIndexNumber) {
|
|
|
|
|
num = item.ParentIndexNumber + "." + num;
|
|
|
|
|
}
|
2013-04-27 15:04:14 -07:00
|
|
|
|
html += '<td class="tabletColumn">' + (num || "") + '</td>';
|
2013-04-22 13:06:43 -07:00
|
|
|
|
|
2013-04-23 07:46:27 -07:00
|
|
|
|
html += '<td><a href="' + LibraryBrowser.getHref(item, "music") + '">' + (item.Name || "") + '</a></td>';
|
2013-04-22 13:06:43 -07:00
|
|
|
|
|
2013-04-22 20:56:11 -07:00
|
|
|
|
if (options.showAlbum) {
|
2013-04-24 09:03:10 -07:00
|
|
|
|
if (item.Album && item.ParentId) {
|
2013-04-24 07:05:47 -07:00
|
|
|
|
html += '<td><a href="itemdetails.html?id=' + item.ParentId + '">' + item.Album + '</a></td>';
|
|
|
|
|
} else {
|
|
|
|
|
html += '<td></td>';
|
|
|
|
|
}
|
2013-04-22 20:56:11 -07:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (options.showArtist) {
|
2013-04-24 13:28:42 -07:00
|
|
|
|
|
2013-04-25 20:31:10 -07:00
|
|
|
|
if (item.Artists && item.Artists.length) {
|
|
|
|
|
|
|
|
|
|
var artist = item.Artists[0];
|
2013-04-27 15:52:41 -07:00
|
|
|
|
|
2013-04-25 20:31:10 -07:00
|
|
|
|
html += '<td><a href="itembynamedetails.html?context=music&artist=' + artist + '">' + artist + '</a></td>';
|
2013-04-24 07:05:47 -07:00
|
|
|
|
} else {
|
|
|
|
|
html += '<td></td>';
|
|
|
|
|
}
|
2013-04-22 20:56:11 -07:00
|
|
|
|
}
|
|
|
|
|
|
2013-04-22 13:06:43 -07:00
|
|
|
|
var time = DashboardPage.getDisplayText(item.RunTimeTicks || 0);
|
|
|
|
|
|
2013-04-27 15:04:14 -07:00
|
|
|
|
html += '<td class="tabletColumn">' + time + '</td>';
|
2013-04-22 13:06:43 -07:00
|
|
|
|
|
2013-04-27 15:04:14 -07:00
|
|
|
|
html += '<td class="tabletColumn">' + (item.UserData ? item.UserData.PlayCount : 0) + '</td>';
|
2013-04-22 13:17:08 -07:00
|
|
|
|
|
2013-04-27 15:04:14 -07:00
|
|
|
|
html += '<td class="tabletColumn userDataCell">' + LibraryBrowser.getUserDataIconsHtml(item) + '</td>';
|
2013-04-22 13:06:43 -07:00
|
|
|
|
|
|
|
|
|
html += '</tr>';
|
|
|
|
|
}
|
|
|
|
|
|
2013-04-25 20:31:10 -07:00
|
|
|
|
html += '</table></div>';
|
2013-04-22 13:06:43 -07:00
|
|
|
|
|
|
|
|
|
return html;
|
|
|
|
|
},
|
|
|
|
|
|
2013-04-23 07:46:27 -07:00
|
|
|
|
getHref: function (item, itemByNameContext) {
|
2013-04-10 22:27:27 -07:00
|
|
|
|
|
|
|
|
|
if (item.url) {
|
|
|
|
|
return item.url;
|
|
|
|
|
}
|
|
|
|
|
|
2013-04-27 06:05:33 -07:00
|
|
|
|
itemByNameContext = itemByNameContext || "";
|
2013-04-27 15:52:41 -07:00
|
|
|
|
|
2013-04-27 06:05:33 -07:00
|
|
|
|
// Handle search hints
|
|
|
|
|
var id = item.Id || item.ItemId;
|
|
|
|
|
|
2013-04-10 22:27:27 -07:00
|
|
|
|
if (item.Type == "Series") {
|
2013-04-27 06:05:33 -07:00
|
|
|
|
return "itemdetails.html?id=" + id;
|
2013-04-10 22:27:27 -07:00
|
|
|
|
}
|
2013-04-16 21:21:24 -07:00
|
|
|
|
if (item.Type == "Season") {
|
2013-04-27 06:05:33 -07:00
|
|
|
|
return "itemdetails.html?id=" + id;
|
2013-04-16 21:21:24 -07:00
|
|
|
|
}
|
2013-04-10 22:27:27 -07:00
|
|
|
|
if (item.Type == "BoxSet") {
|
2013-04-27 06:05:33 -07:00
|
|
|
|
return "itemdetails.html?id=" + id;
|
2013-04-10 22:27:27 -07:00
|
|
|
|
}
|
2013-04-22 08:10:54 -07:00
|
|
|
|
if (item.Type == "MusicAlbum") {
|
2013-04-27 06:05:33 -07:00
|
|
|
|
return "itemdetails.html?id=" + id;
|
2013-04-22 08:10:54 -07:00
|
|
|
|
}
|
2013-04-11 15:09:08 -07:00
|
|
|
|
if (item.Type == "Genre") {
|
2013-04-23 19:50:43 -07:00
|
|
|
|
return "itembynamedetails.html?genre=" + encodeName(item.Name) + "&context=" + itemByNameContext;
|
2013-04-11 15:09:08 -07:00
|
|
|
|
}
|
|
|
|
|
if (item.Type == "Studio") {
|
2013-04-23 19:50:43 -07:00
|
|
|
|
return "itembynamedetails.html?studio=" + encodeName(item.Name) + "&context=" + itemByNameContext;
|
2013-04-11 15:09:08 -07:00
|
|
|
|
}
|
|
|
|
|
if (item.Type == "Person") {
|
2013-04-23 19:50:43 -07:00
|
|
|
|
return "itembynamedetails.html?person=" + encodeName(item.Name) + "&context=" + itemByNameContext;
|
2013-04-11 15:09:08 -07:00
|
|
|
|
}
|
2013-04-21 21:38:03 -07:00
|
|
|
|
if (item.Type == "Artist") {
|
2013-04-27 06:05:33 -07:00
|
|
|
|
return "itembynamedetails.html?artist=" + encodeName(item.Name) + "&context=" + (itemByNameContext || "music");
|
2013-04-21 21:38:03 -07:00
|
|
|
|
}
|
2013-04-28 11:39:38 -07:00
|
|
|
|
if (item.Type == "GamePlatform") {
|
|
|
|
|
return "gamesystem.html?id=" + id;
|
|
|
|
|
}
|
2013-04-10 22:27:27 -07:00
|
|
|
|
|
2013-04-27 06:05:33 -07:00
|
|
|
|
return item.IsFolder ? (id ? "itemList.html?parentId=" + id : "#") : "itemdetails.html?id=" + id;
|
2013-04-10 22:27:27 -07:00
|
|
|
|
|
|
|
|
|
},
|
2013-04-12 07:13:47 -07:00
|
|
|
|
|
2013-04-21 21:38:03 -07:00
|
|
|
|
getImageUrl: function (item, type, index, options) {
|
2013-04-11 20:50:47 -07:00
|
|
|
|
|
|
|
|
|
options = options || {};
|
2013-04-21 21:38:03 -07:00
|
|
|
|
options.type = type;
|
|
|
|
|
options.index = index;
|
|
|
|
|
|
|
|
|
|
if (type == 'Backdrop') {
|
|
|
|
|
options.tag = item.BackdropImageTags[index];
|
|
|
|
|
} else {
|
|
|
|
|
options.tag = item.ImageTags[type];
|
|
|
|
|
}
|
2013-04-12 07:13:47 -07:00
|
|
|
|
|
2013-04-11 20:50:47 -07:00
|
|
|
|
if (item.Type == "Studio") {
|
|
|
|
|
|
|
|
|
|
return ApiClient.getStudioImageUrl(item.Name, options);
|
|
|
|
|
}
|
|
|
|
|
if (item.Type == "Person") {
|
|
|
|
|
|
|
|
|
|
return ApiClient.getPersonImageUrl(item.Name, options);
|
|
|
|
|
}
|
|
|
|
|
if (item.Type == "Genre") {
|
|
|
|
|
|
|
|
|
|
return ApiClient.getGenreImageUrl(item.Name, options);
|
|
|
|
|
}
|
2013-04-21 21:38:03 -07:00
|
|
|
|
if (item.Type == "Artist") {
|
|
|
|
|
|
|
|
|
|
return ApiClient.getArtistImageUrl(item.Name, options);
|
|
|
|
|
}
|
2013-04-11 20:50:47 -07:00
|
|
|
|
|
2013-04-27 06:05:33 -07:00
|
|
|
|
// For search hints
|
|
|
|
|
return ApiClient.getImageUrl(item.Id || item.ItemId, options);
|
2013-04-11 20:50:47 -07:00
|
|
|
|
|
|
|
|
|
},
|
2013-04-10 22:27:27 -07:00
|
|
|
|
|
|
|
|
|
getPosterViewHtml: function (options) {
|
2013-04-02 15:53:31 -07:00
|
|
|
|
|
2013-04-10 12:33:19 -07:00
|
|
|
|
var items = options.items;
|
2013-04-02 15:53:31 -07:00
|
|
|
|
|
2013-04-25 17:52:55 -07:00
|
|
|
|
options.shape = options.shape || "portrait";
|
|
|
|
|
|
2013-04-10 12:33:19 -07:00
|
|
|
|
var primaryImageAspectRatio = options.useAverageAspectRatio ? LibraryBrowser.getAveragePrimaryImageAspectRatio(items) : null;
|
2013-04-02 15:53:31 -07:00
|
|
|
|
|
2013-04-10 12:33:19 -07:00
|
|
|
|
var html = "";
|
2013-04-02 15:53:31 -07:00
|
|
|
|
|
2013-04-10 12:33:19 -07:00
|
|
|
|
for (var i = 0, length = items.length; i < length; i++) {
|
2013-04-02 15:53:31 -07:00
|
|
|
|
|
2013-04-25 17:52:55 -07:00
|
|
|
|
var item = items[i];
|
2013-04-02 15:53:31 -07:00
|
|
|
|
|
2013-04-25 17:52:55 -07:00
|
|
|
|
var imgUrl = null;
|
|
|
|
|
var background;
|
2013-04-02 15:53:31 -07:00
|
|
|
|
|
2013-04-10 12:33:19 -07:00
|
|
|
|
if (options.preferBackdrop && item.BackdropImageTags && item.BackdropImageTags.length) {
|
2013-04-25 17:52:55 -07:00
|
|
|
|
|
|
|
|
|
imgUrl = ApiClient.getImageUrl(item.Id, {
|
2013-04-10 12:33:19 -07:00
|
|
|
|
type: "Backdrop",
|
|
|
|
|
height: 198,
|
|
|
|
|
width: 352,
|
|
|
|
|
tag: item.BackdropImageTags[0]
|
2013-04-25 17:52:55 -07:00
|
|
|
|
});
|
2013-04-10 22:27:27 -07:00
|
|
|
|
|
2013-04-25 17:52:55 -07:00
|
|
|
|
} else if (item.ImageTags && item.ImageTags.Primary) {
|
2013-04-02 15:53:31 -07:00
|
|
|
|
|
2013-04-10 12:33:19 -07:00
|
|
|
|
var height = 300;
|
|
|
|
|
var width = primaryImageAspectRatio ? parseInt(height * primaryImageAspectRatio) : null;
|
2013-04-02 15:53:31 -07:00
|
|
|
|
|
2013-04-25 17:52:55 -07:00
|
|
|
|
imgUrl = ApiClient.getImageUrl(item.Id, {
|
2013-04-10 12:33:19 -07:00
|
|
|
|
type: "Primary",
|
|
|
|
|
height: height,
|
|
|
|
|
width: width,
|
|
|
|
|
tag: item.ImageTags.Primary
|
2013-04-25 17:52:55 -07:00
|
|
|
|
});
|
2013-04-02 15:53:31 -07:00
|
|
|
|
|
2013-04-10 12:33:19 -07:00
|
|
|
|
} else if (item.BackdropImageTags && item.BackdropImageTags.length) {
|
2013-04-25 17:52:55 -07:00
|
|
|
|
|
|
|
|
|
imgUrl = ApiClient.getImageUrl(item.Id, {
|
2013-04-10 12:33:19 -07:00
|
|
|
|
type: "Backdrop",
|
|
|
|
|
height: 198,
|
|
|
|
|
width: 352,
|
|
|
|
|
tag: item.BackdropImageTags[0]
|
2013-04-25 17:52:55 -07:00
|
|
|
|
});
|
2013-04-10 22:27:27 -07:00
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
else if (item.MediaType == "Audio" || item.Type == "MusicAlbum" || item.Type == "MusicArtist") {
|
|
|
|
|
|
2013-04-25 17:52:55 -07:00
|
|
|
|
if (item.Name && options.showTitle) {
|
|
|
|
|
imgUrl = 'css/images/items/list/audio.png';
|
|
|
|
|
background = defaultBackground;
|
|
|
|
|
} else {
|
|
|
|
|
background = '#555';
|
|
|
|
|
}
|
2013-04-10 22:27:27 -07:00
|
|
|
|
}
|
|
|
|
|
else if (item.MediaType == "Video" || item.Type == "Season" || item.Type == "Series") {
|
|
|
|
|
|
2013-04-25 17:52:55 -07:00
|
|
|
|
if (item.Name && options.showTitle) {
|
|
|
|
|
imgUrl = 'css/images/items/list/video.png';
|
|
|
|
|
background = defaultBackground;
|
|
|
|
|
} else {
|
|
|
|
|
background = '#555';
|
|
|
|
|
}
|
2013-04-10 22:27:27 -07:00
|
|
|
|
}
|
|
|
|
|
else {
|
2013-04-25 17:52:55 -07:00
|
|
|
|
if (item.Name && options.showTitle) {
|
|
|
|
|
imgUrl = 'css/images/items/list/collection.png';
|
|
|
|
|
background = LibraryBrowser.getMetroColor(item.Id);
|
|
|
|
|
} else {
|
|
|
|
|
background = '#555';
|
|
|
|
|
}
|
2013-04-03 05:03:13 -07:00
|
|
|
|
}
|
2013-04-10 12:33:19 -07:00
|
|
|
|
|
2013-04-28 11:30:58 -07:00
|
|
|
|
|
|
|
|
|
var cssClass = "posterItem";
|
|
|
|
|
|
|
|
|
|
if (options.transparent) {
|
|
|
|
|
cssClass += " transparentPosterItem";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
cssClass += ' ' + options.shape + 'PosterItem';
|
|
|
|
|
|
|
|
|
|
html += '<a class="' + cssClass + '" href="' + LibraryBrowser.getHref(item, options.context) + '">';
|
2013-04-02 15:53:31 -07:00
|
|
|
|
|
2013-04-25 17:52:55 -07:00
|
|
|
|
var style = "";
|
2013-04-09 21:38:04 -07:00
|
|
|
|
|
2013-04-25 17:52:55 -07:00
|
|
|
|
if (imgUrl) {
|
|
|
|
|
style += 'background-image:url(\'' + imgUrl + '\');';
|
|
|
|
|
}
|
2013-04-03 21:21:46 -07:00
|
|
|
|
|
2013-04-25 17:52:55 -07:00
|
|
|
|
if (background) {
|
|
|
|
|
style += "background-color:" + background + ";";
|
|
|
|
|
}
|
2013-04-03 21:21:46 -07:00
|
|
|
|
|
2013-04-25 17:52:55 -07:00
|
|
|
|
html += '<div class="posterItemImage" style="' + style + '"></div>';
|
2013-04-03 21:21:46 -07:00
|
|
|
|
|
2013-04-25 20:33:54 -07:00
|
|
|
|
var name = item.Name;
|
|
|
|
|
|
|
|
|
|
if (item.IndexNumber != null) {
|
|
|
|
|
name = item.IndexNumber + " - " + name;
|
|
|
|
|
}
|
|
|
|
|
if (item.ParentIndexNumber != null) {
|
|
|
|
|
name = item.ParentIndexNumber + "." + name;
|
|
|
|
|
}
|
|
|
|
|
|
2013-04-25 17:52:55 -07:00
|
|
|
|
if (!imgUrl && !options.showTitle) {
|
|
|
|
|
html += "<div class='posterItemDefaultText'>";
|
2013-04-25 20:33:54 -07:00
|
|
|
|
html += name;
|
2013-04-25 17:52:55 -07:00
|
|
|
|
html += "</div>";
|
|
|
|
|
}
|
2013-04-03 21:21:46 -07:00
|
|
|
|
|
2013-04-25 17:52:55 -07:00
|
|
|
|
var cssclass = options.centerText ? "posterItemText posterItemTextCentered" : "posterItemText";
|
2013-04-03 21:21:46 -07:00
|
|
|
|
|
2013-04-25 17:52:55 -07:00
|
|
|
|
if (options.showParentTitle) {
|
2013-04-03 21:21:46 -07:00
|
|
|
|
|
2013-04-25 17:52:55 -07:00
|
|
|
|
html += "<div class='" + cssclass + "'>";
|
2013-04-25 20:31:10 -07:00
|
|
|
|
html += item.SeriesName || item.Album || " ";
|
2013-04-25 17:52:55 -07:00
|
|
|
|
html += "</div>";
|
2013-04-10 12:33:19 -07:00
|
|
|
|
}
|
2013-04-03 21:21:46 -07:00
|
|
|
|
|
2013-04-25 17:52:55 -07:00
|
|
|
|
if (options.showTitle) {
|
2013-04-10 22:27:27 -07:00
|
|
|
|
|
2013-04-25 17:52:55 -07:00
|
|
|
|
html += "<div class='" + cssclass + "'>";
|
2013-04-25 20:33:54 -07:00
|
|
|
|
html += name;
|
2013-04-10 12:33:19 -07:00
|
|
|
|
html += "</div>";
|
|
|
|
|
}
|
2013-04-03 21:21:46 -07:00
|
|
|
|
|
2013-04-10 12:33:19 -07:00
|
|
|
|
if (options.showNewIndicator !== false) {
|
|
|
|
|
html += LibraryBrowser.getNewIndicatorHtml(item);
|
|
|
|
|
}
|
2013-04-03 21:21:46 -07:00
|
|
|
|
|
2013-04-25 17:52:55 -07:00
|
|
|
|
html += "</a>";
|
|
|
|
|
|
2013-04-08 22:06:13 -07:00
|
|
|
|
}
|
2013-04-03 21:21:46 -07:00
|
|
|
|
|
2013-04-10 12:33:19 -07:00
|
|
|
|
return html;
|
|
|
|
|
},
|
2013-04-09 21:38:04 -07:00
|
|
|
|
|
2013-04-10 12:33:19 -07:00
|
|
|
|
getNewIndicatorHtml: function (item) {
|
2013-04-09 21:38:04 -07:00
|
|
|
|
|
2013-04-10 12:33:19 -07:00
|
|
|
|
if (item.RecentlyAddedItemCount) {
|
|
|
|
|
return '<div class="posterRibbon">' + item.RecentlyAddedItemCount + ' New</div>';
|
|
|
|
|
}
|
2013-04-10 06:53:44 -07:00
|
|
|
|
|
2013-04-21 21:38:03 -07:00
|
|
|
|
if (!item.IsFolder && item.Type !== "Genre" && item.Type !== "Studio" && item.Type !== "Person" && item.Type !== "Artist") {
|
2013-04-09 21:38:04 -07:00
|
|
|
|
|
2013-04-10 12:33:19 -07:00
|
|
|
|
var date = item.DateCreated;
|
2013-04-10 06:53:44 -07:00
|
|
|
|
|
2013-04-18 22:08:18 -07:00
|
|
|
|
try {
|
|
|
|
|
if (date && (new Date().getTime() - parseISO8601Date(date).getTime()) < 1209600000) {
|
|
|
|
|
return "<div class='posterRibbon'>New</div>";
|
|
|
|
|
}
|
|
|
|
|
} catch (err) {
|
2013-04-19 09:28:06 -07:00
|
|
|
|
|
2013-04-10 12:33:19 -07:00
|
|
|
|
}
|
2013-04-09 21:38:04 -07:00
|
|
|
|
}
|
2013-04-10 06:53:44 -07:00
|
|
|
|
|
2013-04-10 12:33:19 -07:00
|
|
|
|
return '';
|
|
|
|
|
},
|
2013-04-09 21:38:04 -07:00
|
|
|
|
|
2013-04-10 12:33:19 -07:00
|
|
|
|
getAveragePrimaryImageAspectRatio: function (items) {
|
2013-04-10 06:53:44 -07:00
|
|
|
|
|
2013-04-10 12:33:19 -07:00
|
|
|
|
var values = [];
|
2013-04-02 15:53:31 -07:00
|
|
|
|
|
2013-04-10 12:33:19 -07:00
|
|
|
|
for (var i = 0, length = items.length; i < length; i++) {
|
2013-04-01 22:14:37 -07:00
|
|
|
|
|
2013-04-10 12:33:19 -07:00
|
|
|
|
var ratio = items[i].PrimaryImageAspectRatio || 0;
|
2013-04-01 22:14:37 -07:00
|
|
|
|
|
2013-04-10 12:33:19 -07:00
|
|
|
|
if (!ratio) {
|
|
|
|
|
continue;
|
|
|
|
|
}
|
2013-04-01 22:14:37 -07:00
|
|
|
|
|
2013-04-10 12:33:19 -07:00
|
|
|
|
values[values.length] = ratio;
|
2013-04-03 05:03:13 -07:00
|
|
|
|
}
|
2013-04-01 22:14:37 -07:00
|
|
|
|
|
2013-04-10 12:33:19 -07:00
|
|
|
|
if (!values.length) {
|
|
|
|
|
return null;
|
|
|
|
|
}
|
2013-04-01 22:14:37 -07:00
|
|
|
|
|
2013-04-10 12:33:19 -07:00
|
|
|
|
// Use the median
|
|
|
|
|
values.sort(function (a, b) { return a - b; });
|
2013-04-01 22:14:37 -07:00
|
|
|
|
|
2013-04-10 12:33:19 -07:00
|
|
|
|
var half = Math.floor(values.length / 2);
|
2013-04-01 22:14:37 -07:00
|
|
|
|
|
2013-04-10 12:33:19 -07:00
|
|
|
|
if (values.length % 2)
|
|
|
|
|
return values[half];
|
|
|
|
|
else
|
|
|
|
|
return (values[half - 1] + values[half]) / 2.0;
|
|
|
|
|
},
|
2013-04-01 22:14:37 -07:00
|
|
|
|
|
2013-04-10 12:33:19 -07:00
|
|
|
|
metroColors: ["#6FBD45", "#4BB3DD", "#4164A5", "#E12026", "#800080", "#E1B222", "#008040", "#0094FF", "#FF00C7", "#FF870F", "#7F0037"],
|
2013-04-01 22:14:37 -07:00
|
|
|
|
|
2013-04-10 12:33:19 -07:00
|
|
|
|
getRandomMetroColor: function () {
|
2013-04-01 22:14:37 -07:00
|
|
|
|
|
2013-04-10 12:33:19 -07:00
|
|
|
|
var index = Math.floor(Math.random() * (LibraryBrowser.metroColors.length - 1));
|
2013-04-01 22:14:37 -07:00
|
|
|
|
|
2013-04-10 12:33:19 -07:00
|
|
|
|
return LibraryBrowser.metroColors[index];
|
|
|
|
|
},
|
2013-04-01 22:14:37 -07:00
|
|
|
|
|
2013-04-10 12:33:19 -07:00
|
|
|
|
getMetroColor: function (str) {
|
2013-04-01 22:14:37 -07:00
|
|
|
|
|
2013-04-10 12:33:19 -07:00
|
|
|
|
if (str) {
|
|
|
|
|
var char = String(str.substr(0, 1).charCodeAt());
|
|
|
|
|
var sum = 0;
|
|
|
|
|
for (var i = 0; i < char.length; i++) {
|
|
|
|
|
sum += parseInt(char.charAt(i));
|
|
|
|
|
}
|
|
|
|
|
var index = String(sum).substr(-1);
|
2013-04-01 22:14:37 -07:00
|
|
|
|
|
2013-04-10 12:33:19 -07:00
|
|
|
|
return LibraryBrowser.metroColors[index];
|
|
|
|
|
} else {
|
|
|
|
|
return LibraryBrowser.getRandomMetroColor();
|
2013-04-08 22:06:13 -07:00
|
|
|
|
}
|
2013-04-01 22:14:37 -07:00
|
|
|
|
|
2013-04-10 12:33:19 -07:00
|
|
|
|
},
|
2013-04-05 11:35:37 -07:00
|
|
|
|
|
2013-04-14 08:14:10 -07:00
|
|
|
|
renderLinks: function (linksElem, item) {
|
2013-04-08 22:06:13 -07:00
|
|
|
|
|
2013-04-10 12:33:19 -07:00
|
|
|
|
var links = [];
|
2013-04-08 22:06:13 -07:00
|
|
|
|
|
2013-04-12 07:13:47 -07:00
|
|
|
|
if (item.HomePageUrl) {
|
|
|
|
|
links.push('<a class="ui-link" href="' + item.HomePageUrl + '" target="_blank">Website</a>');
|
|
|
|
|
}
|
|
|
|
|
|
2013-04-14 08:14:10 -07:00
|
|
|
|
var providerIds = item.ProviderIds || {};
|
|
|
|
|
|
|
|
|
|
if (providerIds.Imdb) {
|
2013-04-10 12:33:19 -07:00
|
|
|
|
if (item.Type == "Movie" || item.Type == "Episode")
|
2013-04-14 08:14:10 -07:00
|
|
|
|
links.push('<a class="ui-link" href="http://www.imdb.com/title/' + providerIds.Imdb + '" target="_blank">IMDb</a>');
|
2013-04-10 12:33:19 -07:00
|
|
|
|
else if (item.Type == "Person")
|
2013-04-14 08:14:10 -07:00
|
|
|
|
links.push('<a class="ui-link" href="http://www.imdb.com/name/' + providerIds.Imdb + '" target="_blank">IMDb</a>');
|
2013-04-10 12:33:19 -07:00
|
|
|
|
}
|
2013-04-14 08:14:10 -07:00
|
|
|
|
if (providerIds.Tmdb) {
|
2013-04-10 12:33:19 -07:00
|
|
|
|
if (item.Type == "Movie")
|
2013-04-14 08:14:10 -07:00
|
|
|
|
links.push('<a class="ui-link" href="http://www.themoviedb.org/movie/' + providerIds.Tmdb + '" target="_blank">TMDB</a>');
|
2013-04-10 12:33:19 -07:00
|
|
|
|
else if (item.Type == "Person")
|
2013-04-14 08:14:10 -07:00
|
|
|
|
links.push('<a class="ui-link" href="http://www.themoviedb.org/person/' + providerIds.Tmdb + '" target="_blank">TMDB</a>');
|
2013-04-10 12:33:19 -07:00
|
|
|
|
}
|
2013-04-14 08:14:10 -07:00
|
|
|
|
if (providerIds.Tvdb)
|
|
|
|
|
links.push('<a class="ui-link" href="http://thetvdb.com/index.php?tab=series&id=' + providerIds.Tvdb + '" target="_blank">TVDB</a>');
|
|
|
|
|
if (providerIds.Tvcom) {
|
2013-04-10 12:33:19 -07:00
|
|
|
|
if (item.Type == "Episode")
|
2013-04-14 08:14:10 -07:00
|
|
|
|
links.push('<a class="ui-link" href="http://www.tv.com/shows/' + providerIds.Tvcom + '" target="_blank">TV.com</a>');
|
2013-04-10 12:33:19 -07:00
|
|
|
|
else if (item.Type == "Person")
|
2013-04-14 08:14:10 -07:00
|
|
|
|
links.push('<a class="ui-link" href="http://www.tv.com/people/' + providerIds.Tvcom + '" target="_blank">TV.com</a>');
|
2013-04-10 12:33:19 -07:00
|
|
|
|
}
|
2013-04-22 20:56:11 -07:00
|
|
|
|
if (providerIds.Musicbrainz) {
|
|
|
|
|
|
|
|
|
|
if (item.Type == "MusicArtist" || item.Type == "Artist") {
|
|
|
|
|
links.push('<a class="ui-link" href="http://musicbrainz.org/artist/' + providerIds.Musicbrainz + '" target="_blank">MusicBrainz</a>');
|
|
|
|
|
} else {
|
|
|
|
|
links.push('<a class="ui-link" href="http://musicbrainz.org/release/' + providerIds.Musicbrainz + '" target="_blank">MusicBrainz</a>');
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
2013-04-14 08:14:10 -07:00
|
|
|
|
if (providerIds.Gamesdb)
|
|
|
|
|
links.push('<a class="ui-link" href="http://www.games-db.com/Game/' + providerIds.Gamesdb + '" target="_blank">GamesDB</a>');
|
2013-04-08 22:06:13 -07:00
|
|
|
|
|
|
|
|
|
|
2013-04-14 08:14:10 -07:00
|
|
|
|
if (links.length) {
|
2013-04-10 10:11:23 -07:00
|
|
|
|
|
2013-04-14 08:14:10 -07:00
|
|
|
|
var html = 'Links: ' + links.join(' / ');
|
2013-04-10 10:11:23 -07:00
|
|
|
|
|
2013-04-14 08:14:10 -07:00
|
|
|
|
$(linksElem).html(html);
|
2013-04-08 22:06:13 -07:00
|
|
|
|
|
2013-04-10 12:33:19 -07:00
|
|
|
|
} else {
|
2013-04-14 08:14:10 -07:00
|
|
|
|
$(linksElem).hide();
|
2013-04-10 12:33:19 -07:00
|
|
|
|
}
|
|
|
|
|
},
|
2013-04-08 22:06:13 -07:00
|
|
|
|
|
2013-04-18 22:08:18 -07:00
|
|
|
|
getPagingHtml: function (query, totalRecordCount) {
|
2013-04-08 22:06:13 -07:00
|
|
|
|
|
2013-04-10 12:33:19 -07:00
|
|
|
|
var html = '';
|
2013-04-08 22:06:13 -07:00
|
|
|
|
|
2013-04-10 12:33:19 -07:00
|
|
|
|
var pageCount = Math.ceil(totalRecordCount / query.Limit);
|
|
|
|
|
var pageNumber = (query.StartIndex / query.Limit) + 1;
|
2013-04-08 22:06:13 -07:00
|
|
|
|
|
2013-04-18 22:08:18 -07:00
|
|
|
|
var dropdownHtml = '<select class="selectPage" data-enhance="false" data-role="none">';
|
2013-04-10 12:33:19 -07:00
|
|
|
|
for (var i = 1; i <= pageCount; i++) {
|
2013-04-08 22:06:13 -07:00
|
|
|
|
|
2013-04-10 12:33:19 -07:00
|
|
|
|
if (i == pageNumber) {
|
|
|
|
|
dropdownHtml += '<option value="' + i + '" selected="selected">' + i + '</option>';
|
|
|
|
|
} else {
|
|
|
|
|
dropdownHtml += '<option value="' + i + '">' + i + '</option>';
|
|
|
|
|
}
|
2013-04-08 22:06:13 -07:00
|
|
|
|
}
|
2013-04-10 12:33:19 -07:00
|
|
|
|
dropdownHtml += '</select>';
|
2013-04-08 22:06:13 -07:00
|
|
|
|
|
2013-04-10 12:33:19 -07:00
|
|
|
|
var recordsEnd = Math.min(query.StartIndex + query.Limit, totalRecordCount);
|
2013-04-08 22:06:13 -07:00
|
|
|
|
|
2013-04-19 09:28:06 -07:00
|
|
|
|
var showControls = totalRecordCount > query.Limit;
|
|
|
|
|
|
2013-04-18 22:08:18 -07:00
|
|
|
|
html += '<div class="listPaging">';
|
2013-04-15 15:03:05 -07:00
|
|
|
|
|
|
|
|
|
html += '<span style="margin-right: 10px;">';
|
2013-04-19 16:45:27 -07:00
|
|
|
|
|
|
|
|
|
var startAtDisplay = totalRecordCount ? query.StartIndex + 1 : 0;
|
|
|
|
|
html += startAtDisplay + '-' + recordsEnd + ' of ' + totalRecordCount;
|
2013-04-19 09:28:06 -07:00
|
|
|
|
|
|
|
|
|
if (showControls) {
|
|
|
|
|
html += ', page ' + dropdownHtml + ' of ' + pageCount;
|
|
|
|
|
}
|
|
|
|
|
|
2013-04-15 15:03:05 -07:00
|
|
|
|
html += '</span>';
|
|
|
|
|
|
2013-04-19 09:28:06 -07:00
|
|
|
|
if (showControls) {
|
|
|
|
|
html += '<button data-icon="arrow-left" data-iconpos="notext" data-inline="true" data-mini="true" class="btnPreviousPage" ' + (query.StartIndex ? '' : 'disabled') + '>Previous Page</button>';
|
2013-04-15 15:03:05 -07:00
|
|
|
|
|
2013-04-19 09:28:06 -07:00
|
|
|
|
html += '<button data-icon="arrow-right" data-iconpos="notext" data-inline="true" data-mini="true" class="btnNextPage" ' + (query.StartIndex + query.Limit > totalRecordCount ? 'disabled' : '') + '>Next Page</button>';
|
2013-04-27 15:52:41 -07:00
|
|
|
|
|
|
|
|
|
var id = "selectPageSize" + new Date().getTime();
|
|
|
|
|
|
|
|
|
|
var options = '';
|
|
|
|
|
|
|
|
|
|
function getOption(val) {
|
|
|
|
|
|
|
|
|
|
if (query.Limit == val) {
|
|
|
|
|
|
|
|
|
|
return '<option value="' + val + '" selected="selected">' + val + '</option>';
|
|
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
return '<option value="' + val + '">' + val + '</option>';
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
options += getOption(20);
|
|
|
|
|
options += getOption(50);
|
|
|
|
|
options += getOption(100);
|
|
|
|
|
options += getOption(200);
|
|
|
|
|
options += getOption(300);
|
|
|
|
|
|
|
|
|
|
html += '<label class="labelPageSize" for="' + id + '">Limit: </label><select class="selectPageSize" id="' + id + '" data-enhance="false" data-role="none">' + options + '</select>';
|
2013-04-19 09:28:06 -07:00
|
|
|
|
}
|
2013-04-15 15:03:05 -07:00
|
|
|
|
|
2013-04-10 12:33:19 -07:00
|
|
|
|
html += '</div>';
|
2013-04-08 22:06:13 -07:00
|
|
|
|
|
2013-04-10 12:33:19 -07:00
|
|
|
|
return html;
|
|
|
|
|
},
|
2013-04-10 06:53:44 -07:00
|
|
|
|
|
2013-04-10 12:33:19 -07:00
|
|
|
|
getStarRatingHtml: function (item) {
|
|
|
|
|
var rating = item.CommunityRating;
|
2013-04-10 06:53:44 -07:00
|
|
|
|
|
2013-04-10 12:33:19 -07:00
|
|
|
|
var html = "";
|
|
|
|
|
for (var i = 1; i <= 10; i++) {
|
|
|
|
|
if (rating < i - 1) {
|
|
|
|
|
html += "<div class='starRating emptyStarRating'></div>";
|
|
|
|
|
}
|
|
|
|
|
else if (rating < i) {
|
|
|
|
|
html += "<div class='starRating halfStarRating'></div>";
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
html += "<div class='starRating'></div>";
|
|
|
|
|
}
|
2013-04-10 06:53:44 -07:00
|
|
|
|
}
|
|
|
|
|
|
2013-04-10 12:33:19 -07:00
|
|
|
|
return html;
|
|
|
|
|
},
|
2013-04-10 06:53:44 -07:00
|
|
|
|
|
2013-04-10 22:27:27 -07:00
|
|
|
|
getFiveStarRatingHtml: function (item) {
|
|
|
|
|
|
|
|
|
|
var rating = item.CommunityRating / 2;
|
|
|
|
|
|
|
|
|
|
var html = "";
|
|
|
|
|
for (var i = 1; i <= 5; i++) {
|
|
|
|
|
if (rating < i - 1) {
|
|
|
|
|
html += "<div class='starRating emptyStarRating'></div>";
|
|
|
|
|
}
|
|
|
|
|
else if (rating < i) {
|
|
|
|
|
html += "<div class='starRating halfStarRating'></div>";
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
html += "<div class='starRating'></div>";
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return html;
|
|
|
|
|
},
|
|
|
|
|
|
2013-04-10 12:33:19 -07:00
|
|
|
|
getUserDataIconsHtml: function (item) {
|
2013-04-10 10:11:23 -07:00
|
|
|
|
|
2013-04-10 12:33:19 -07:00
|
|
|
|
var html = '';
|
2013-04-10 06:53:44 -07:00
|
|
|
|
|
2013-04-15 19:36:12 -07:00
|
|
|
|
var tooltip;
|
|
|
|
|
var pct;
|
|
|
|
|
|
|
|
|
|
if (item.PlayedPercentage) {
|
|
|
|
|
|
|
|
|
|
tooltip = '';
|
|
|
|
|
pct = item.PlayedPercentage;
|
|
|
|
|
}
|
|
|
|
|
else if (item.UserData && item.UserData.PlaybackPositionTicks && item.RunTimeTicks) {
|
|
|
|
|
|
|
|
|
|
tooltip = DashboardPage.getDisplayText(item.UserData.PlaybackPositionTicks) + " / " + DashboardPage.getDisplayText(item.RunTimeTicks);
|
|
|
|
|
|
|
|
|
|
pct = (item.UserData.PlaybackPositionTicks / item.RunTimeTicks) * 100;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (pct) {
|
|
|
|
|
|
|
|
|
|
pct = parseInt(pct);
|
|
|
|
|
|
|
|
|
|
html += '<span title="' + tooltip + '" class="itemProgress">' + pct + '%</span>';
|
|
|
|
|
}
|
|
|
|
|
|
2013-04-10 12:33:19 -07:00
|
|
|
|
var userData = item.UserData || {};
|
2013-04-10 06:53:44 -07:00
|
|
|
|
|
2013-04-10 12:33:19 -07:00
|
|
|
|
var itemId = item.Id;
|
|
|
|
|
var type = item.Type;
|
2013-04-14 08:14:10 -07:00
|
|
|
|
|
2013-04-12 17:42:51 -07:00
|
|
|
|
if (type == "Person") {
|
|
|
|
|
itemId = item.Name;
|
|
|
|
|
}
|
|
|
|
|
else if (type == "Studio") {
|
|
|
|
|
itemId = item.Name;
|
|
|
|
|
}
|
|
|
|
|
else if (type == "Genre") {
|
|
|
|
|
itemId = item.Name;
|
|
|
|
|
}
|
2013-04-21 21:38:03 -07:00
|
|
|
|
else if (type == "Artist") {
|
|
|
|
|
itemId = item.Name;
|
|
|
|
|
}
|
2013-04-10 10:11:23 -07:00
|
|
|
|
|
2013-04-16 05:30:50 -07:00
|
|
|
|
if (item.MediaType || item.IsFolder) {
|
2013-04-10 12:33:19 -07:00
|
|
|
|
if (userData.Played) {
|
2013-04-10 22:27:27 -07:00
|
|
|
|
html += '<img data-type="' + type + '" data-itemid="' + itemId + '" class="imgUserItemRating imgPlayed" src="css/images/userdata/played.png" alt="Played" title="Played" onclick="LibraryBrowser.markPlayed(this);return false;" />';
|
2013-04-10 12:33:19 -07:00
|
|
|
|
} else {
|
2013-04-10 22:27:27 -07:00
|
|
|
|
html += '<img data-type="' + type + '" data-itemid="' + itemId + '" class="imgUserItemRating imgPlayedOff" src="css/images/userdata/unplayed.png" alt="Played" title="Played" onclick="LibraryBrowser.markPlayed(this);return false;" />';
|
2013-04-10 12:33:19 -07:00
|
|
|
|
}
|
2013-04-10 10:11:23 -07:00
|
|
|
|
}
|
|
|
|
|
|
2013-04-10 12:33:19 -07:00
|
|
|
|
if (typeof userData.Likes == "undefined") {
|
2013-04-10 22:27:27 -07:00
|
|
|
|
html += '<img onclick="LibraryBrowser.markDislike(this);return false;" data-type="' + type + '" data-itemid="' + itemId + '" class="imgUserItemRating imgDislikeOff" src="css/images/userdata/thumbs_down_off.png" alt="Dislike" title="Dislike" />';
|
|
|
|
|
html += '<img onclick="LibraryBrowser.markLike(this);return false;" data-type="' + type + '" data-itemid="' + itemId + '" class="imgUserItemRating imgLikeOff" src="css/images/userdata/thumbs_up_off.png" alt="Like" title="Like" />';
|
2013-04-10 12:33:19 -07:00
|
|
|
|
}
|
|
|
|
|
else if (userData.Likes) {
|
2013-04-10 22:27:27 -07:00
|
|
|
|
html += '<img onclick="LibraryBrowser.markDislike(this);return false;" data-type="' + type + '" data-itemid="' + itemId + '" class="imgUserItemRating imgDislikeOff" src="css/images/userdata/thumbs_down_off.png" alt="Dislike" title="Dislike" />';
|
|
|
|
|
html += '<img onclick="LibraryBrowser.markLike(this);return false;" data-type="' + type + '" data-itemid="' + itemId + '" class="imgUserItemRating imgLike" src="css/images/userdata/thumbs_up_on.png" alt="Like" title="Like" />';
|
2013-04-10 12:33:19 -07:00
|
|
|
|
}
|
|
|
|
|
else {
|
2013-04-10 22:27:27 -07:00
|
|
|
|
html += '<img onclick="LibraryBrowser.markDislike(this);return false;" data-type="' + type + '" data-itemid="' + itemId + '" class="imgUserItemRating imgDislike" src="css/images/userdata/thumbs_down_on.png" alt="Dislike" title="Dislike" />';
|
|
|
|
|
html += '<img onclick="LibraryBrowser.markLike(this);return false;" data-type="' + type + '" data-itemid="' + itemId + '" class="imgUserItemRating imgLikeOff" src="css/images/userdata/thumbs_up_off.png" alt="Like" title="Like" />';
|
2013-04-10 12:33:19 -07:00
|
|
|
|
}
|
2013-04-10 06:53:44 -07:00
|
|
|
|
|
2013-04-10 12:33:19 -07:00
|
|
|
|
if (userData.IsFavorite) {
|
2013-04-10 22:27:27 -07:00
|
|
|
|
html += '<img onclick="LibraryBrowser.markFavorite(this);return false;" data-type="' + type + '" data-itemid="' + itemId + '" class="imgUserItemRating imgFavorite" src="css/images/userdata/heart_on.png" alt="Favorite" title="Favorite" />';
|
2013-04-10 12:33:19 -07:00
|
|
|
|
} else {
|
2013-04-10 22:27:27 -07:00
|
|
|
|
html += '<img onclick="LibraryBrowser.markFavorite(this);return false;" data-type="' + type + '" data-itemid="' + itemId + '" class="imgUserItemRating imgFavoriteOff" src="css/images/userdata/heart_off.png" alt="Favorite" title="Favorite" />';
|
2013-04-10 12:33:19 -07:00
|
|
|
|
}
|
2013-04-10 06:53:44 -07:00
|
|
|
|
|
2013-04-10 12:33:19 -07:00
|
|
|
|
return html;
|
|
|
|
|
},
|
2013-04-10 12:25:34 -07:00
|
|
|
|
|
2013-04-10 12:33:19 -07:00
|
|
|
|
markPlayed: function (link) {
|
2013-04-10 10:11:23 -07:00
|
|
|
|
|
2013-04-10 12:33:19 -07:00
|
|
|
|
var id = link.getAttribute('data-itemid');
|
2013-04-10 10:11:23 -07:00
|
|
|
|
|
2013-04-10 12:33:19 -07:00
|
|
|
|
var $link = $(link);
|
2013-04-10 10:11:23 -07:00
|
|
|
|
|
2013-04-10 12:33:19 -07:00
|
|
|
|
var markAsPlayed = $link.hasClass('imgPlayedOff');
|
2013-04-10 10:11:23 -07:00
|
|
|
|
|
2013-04-10 12:33:19 -07:00
|
|
|
|
ApiClient.updatePlayedStatus(Dashboard.getCurrentUserId(), id, markAsPlayed);
|
2013-04-10 10:11:23 -07:00
|
|
|
|
|
2013-04-10 12:33:19 -07:00
|
|
|
|
if (markAsPlayed) {
|
|
|
|
|
link.src = "css/images/userdata/played.png";
|
|
|
|
|
$link.addClass('imgPlayed').removeClass('imgPlayedOff');
|
|
|
|
|
} else {
|
|
|
|
|
link.src = "css/images/userdata/unplayed.png";
|
|
|
|
|
$link.addClass('imgPlayedOff').removeClass('imgPlayed');
|
|
|
|
|
}
|
|
|
|
|
},
|
2013-04-10 10:11:23 -07:00
|
|
|
|
|
2013-04-10 12:33:19 -07:00
|
|
|
|
markFavorite: function (link) {
|
2013-04-10 10:11:23 -07:00
|
|
|
|
|
2013-04-10 12:33:19 -07:00
|
|
|
|
var id = link.getAttribute('data-itemid');
|
2013-04-12 17:42:51 -07:00
|
|
|
|
var type = link.getAttribute('data-type');
|
2013-04-10 12:25:34 -07:00
|
|
|
|
|
2013-04-10 12:33:19 -07:00
|
|
|
|
var $link = $(link);
|
2013-04-10 12:25:34 -07:00
|
|
|
|
|
2013-04-10 12:33:19 -07:00
|
|
|
|
var markAsFavorite = $link.hasClass('imgFavoriteOff');
|
2013-04-10 10:11:23 -07:00
|
|
|
|
|
2013-04-21 21:38:03 -07:00
|
|
|
|
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);
|
2013-04-12 17:42:51 -07:00
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
ApiClient.updateFavoriteStatus(Dashboard.getCurrentUserId(), id, markAsFavorite);
|
|
|
|
|
}
|
2013-04-10 10:11:23 -07:00
|
|
|
|
|
2013-04-10 12:33:19 -07:00
|
|
|
|
if (markAsFavorite) {
|
|
|
|
|
link.src = "css/images/userdata/heart_on.png";
|
|
|
|
|
$link.addClass('imgFavorite').removeClass('imgFavoriteOff');
|
|
|
|
|
} else {
|
|
|
|
|
link.src = "css/images/userdata/heart_off.png";
|
|
|
|
|
$link.addClass('imgFavoriteOff').removeClass('imgFavorite');
|
|
|
|
|
}
|
|
|
|
|
},
|
2013-04-10 12:25:34 -07:00
|
|
|
|
|
2013-04-10 12:33:19 -07:00
|
|
|
|
markLike: function (link) {
|
2013-04-10 12:25:34 -07:00
|
|
|
|
|
2013-04-10 12:33:19 -07:00
|
|
|
|
var id = link.getAttribute('data-itemid');
|
2013-04-13 12:24:34 -07:00
|
|
|
|
var type = link.getAttribute('data-type');
|
2013-04-10 10:11:23 -07:00
|
|
|
|
|
2013-04-10 12:33:19 -07:00
|
|
|
|
var $link = $(link);
|
2013-04-10 10:11:23 -07:00
|
|
|
|
|
2013-04-10 12:33:19 -07:00
|
|
|
|
if ($link.hasClass('imgLikeOff')) {
|
2013-04-10 12:25:34 -07:00
|
|
|
|
|
2013-04-21 21:38:03 -07:00
|
|
|
|
LibraryBrowser.updateUserItemRating(type, id, true);
|
2013-04-10 10:11:23 -07:00
|
|
|
|
|
2013-04-10 12:33:19 -07:00
|
|
|
|
link.src = "css/images/userdata/thumbs_up_on.png";
|
|
|
|
|
$link.addClass('imgLike').removeClass('imgLikeOff');
|
2013-04-10 10:11:23 -07:00
|
|
|
|
|
2013-04-10 12:33:19 -07:00
|
|
|
|
} else {
|
2013-04-10 12:25:34 -07:00
|
|
|
|
|
2013-04-21 21:38:03 -07:00
|
|
|
|
LibraryBrowser.clearUserItemRating(type, id);
|
2013-04-10 10:11:23 -07:00
|
|
|
|
|
2013-04-10 12:33:19 -07:00
|
|
|
|
link.src = "css/images/userdata/thumbs_up_off.png";
|
|
|
|
|
$link.addClass('imgLikeOff').removeClass('imgLike');
|
|
|
|
|
}
|
2013-04-10 10:11:23 -07:00
|
|
|
|
|
2013-04-10 12:33:19 -07:00
|
|
|
|
$link.prev().removeClass('imgDislike').addClass('imgDislikeOff').each(function () {
|
|
|
|
|
this.src = "css/images/userdata/thumbs_down_off.png";
|
|
|
|
|
});
|
|
|
|
|
},
|
2013-04-10 10:11:23 -07:00
|
|
|
|
|
2013-04-10 12:33:19 -07:00
|
|
|
|
markDislike: function (link) {
|
2013-04-10 10:11:23 -07:00
|
|
|
|
|
2013-04-10 12:33:19 -07:00
|
|
|
|
var id = link.getAttribute('data-itemid');
|
2013-04-13 12:24:34 -07:00
|
|
|
|
var type = link.getAttribute('data-type');
|
2013-04-10 10:11:23 -07:00
|
|
|
|
|
2013-04-10 12:33:19 -07:00
|
|
|
|
var $link = $(link);
|
2013-04-10 10:11:23 -07:00
|
|
|
|
|
2013-04-10 12:33:19 -07:00
|
|
|
|
if ($link.hasClass('imgDislikeOff')) {
|
2013-04-10 10:11:23 -07:00
|
|
|
|
|
2013-04-21 21:38:03 -07:00
|
|
|
|
LibraryBrowser.updateUserItemRating(type, id, false);
|
2013-04-10 10:11:23 -07:00
|
|
|
|
|
2013-04-10 12:33:19 -07:00
|
|
|
|
link.src = "css/images/userdata/thumbs_down_on.png";
|
|
|
|
|
$link.addClass('imgDislike').removeClass('imgDislikeOff');
|
2013-04-10 10:11:23 -07:00
|
|
|
|
|
2013-04-10 12:33:19 -07:00
|
|
|
|
} else {
|
2013-04-10 10:11:23 -07:00
|
|
|
|
|
2013-04-21 21:38:03 -07:00
|
|
|
|
LibraryBrowser.clearUserItemRating(type, id);
|
2013-04-10 10:11:23 -07:00
|
|
|
|
|
2013-04-10 12:33:19 -07:00
|
|
|
|
link.src = "css/images/userdata/thumbs_down_off.png";
|
|
|
|
|
$link.addClass('imgDislikeOff').removeClass('imgDislike');
|
|
|
|
|
}
|
2013-04-10 10:11:23 -07:00
|
|
|
|
|
2013-04-10 12:33:19 -07:00
|
|
|
|
$link.next().removeClass('imgLike').addClass('imgLikeOff').each(function () {
|
|
|
|
|
this.src = "css/images/userdata/thumbs_up_off.png";
|
|
|
|
|
});
|
|
|
|
|
},
|
2013-04-10 10:11:23 -07:00
|
|
|
|
|
2013-04-21 21:38:03 -07:00
|
|
|
|
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);
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
|
2013-04-10 12:33:19 -07:00
|
|
|
|
getDetailImageHtml: function (item) {
|
2013-04-10 12:25:34 -07:00
|
|
|
|
|
2013-04-10 12:33:19 -07:00
|
|
|
|
var imageTags = item.ImageTags || {};
|
2013-04-10 06:53:44 -07:00
|
|
|
|
|
2013-04-10 12:33:19 -07:00
|
|
|
|
var html = '';
|
2013-04-10 06:53:44 -07:00
|
|
|
|
|
2013-04-10 12:33:19 -07:00
|
|
|
|
var url;
|
|
|
|
|
var useBackgroundColor;
|
2013-04-17 20:53:19 -07:00
|
|
|
|
var maxwidth;
|
2013-04-10 06:53:44 -07:00
|
|
|
|
|
2013-04-10 12:33:19 -07:00
|
|
|
|
if (imageTags.Primary) {
|
2013-04-10 06:53:44 -07:00
|
|
|
|
|
2013-04-10 12:33:19 -07:00
|
|
|
|
if (item.Type == "Person") {
|
|
|
|
|
url = ApiClient.getPersonImageUrl(item.Name, {
|
2013-04-12 17:42:51 -07:00
|
|
|
|
maxwidth: 800,
|
2013-04-10 12:33:19 -07:00
|
|
|
|
tag: imageTags.Primary,
|
2013-04-21 21:38:03 -07:00
|
|
|
|
type: "Primary"
|
2013-04-10 12:33:19 -07:00
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
else if (item.Type == "Genre") {
|
|
|
|
|
url = ApiClient.getGenreImageUrl(item.Name, {
|
2013-04-12 17:42:51 -07:00
|
|
|
|
maxwidth: 800,
|
2013-04-10 12:33:19 -07:00
|
|
|
|
tag: imageTags.Primary,
|
2013-04-21 21:38:03 -07:00
|
|
|
|
type: "Primary"
|
2013-04-10 12:33:19 -07:00
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
else if (item.Type == "Studio") {
|
|
|
|
|
url = ApiClient.getStudioImageUrl(item.Name, {
|
2013-04-12 17:42:51 -07:00
|
|
|
|
maxwidth: 800,
|
2013-04-10 12:33:19 -07:00
|
|
|
|
tag: imageTags.Primary,
|
2013-04-21 21:38:03 -07:00
|
|
|
|
type: "Primary"
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
else if (item.Type == "Artist") {
|
|
|
|
|
url = ApiClient.getArtistImageUrl(item.Name, {
|
|
|
|
|
maxwidth: 800,
|
|
|
|
|
tag: imageTags.Primary,
|
|
|
|
|
type: "Primary"
|
2013-04-10 12:33:19 -07:00
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
url = ApiClient.getImageUrl(item.Id, {
|
|
|
|
|
type: "Primary",
|
2013-04-12 17:42:51 -07:00
|
|
|
|
maxwidth: 800,
|
2013-04-10 12:33:19 -07:00
|
|
|
|
tag: item.ImageTags.Primary
|
|
|
|
|
});
|
|
|
|
|
}
|
2013-04-10 10:36:34 -07:00
|
|
|
|
}
|
2013-04-10 12:33:19 -07:00
|
|
|
|
else if (item.BackdropImageTags && item.BackdropImageTags.length) {
|
|
|
|
|
|
2013-04-21 21:38:03 -07:00
|
|
|
|
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]
|
|
|
|
|
});
|
|
|
|
|
}
|
2013-04-10 10:36:34 -07:00
|
|
|
|
}
|
2013-04-10 12:33:19 -07:00
|
|
|
|
else if (imageTags.Thumb) {
|
|
|
|
|
|
2013-04-21 21:38:03 -07:00
|
|
|
|
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
|
|
|
|
|
});
|
|
|
|
|
}
|
2013-04-10 10:36:34 -07:00
|
|
|
|
}
|
2013-04-10 12:33:19 -07:00
|
|
|
|
else if (imageTags.Disc) {
|
|
|
|
|
|
2013-04-10 10:36:34 -07:00
|
|
|
|
url = ApiClient.getImageUrl(item.Id, {
|
2013-04-10 12:33:19 -07:00
|
|
|
|
type: "Disc",
|
2013-04-12 17:42:51 -07:00
|
|
|
|
maxwidth: 800,
|
2013-04-10 12:33:19 -07:00
|
|
|
|
tag: item.ImageTags.Disc
|
2013-04-10 10:36:34 -07:00
|
|
|
|
});
|
|
|
|
|
}
|
2013-04-22 08:38:38 -07:00
|
|
|
|
else if (item.MediaType == "Audio" || item.Type == "MusicAlbum") {
|
2013-04-10 12:33:19 -07:00
|
|
|
|
url = "css/images/items/detail/audio.png";
|
|
|
|
|
useBackgroundColor = true;
|
|
|
|
|
}
|
|
|
|
|
else if (item.MediaType == "Game") {
|
|
|
|
|
url = "css/images/items/detail/game.png";
|
|
|
|
|
useBackgroundColor = true;
|
|
|
|
|
}
|
2013-04-13 20:33:43 -07:00
|
|
|
|
else if (item.Type == "Person") {
|
|
|
|
|
url = "css/images/items/detail/person.png";
|
|
|
|
|
useBackgroundColor = true;
|
2013-04-17 21:45:00 -07:00
|
|
|
|
maxwidth = 125;
|
2013-04-17 20:53:19 -07:00
|
|
|
|
}
|
|
|
|
|
else if (item.Type == "Genre" || item.Type == "Studio") {
|
|
|
|
|
url = "css/images/items/detail/video.png";
|
|
|
|
|
useBackgroundColor = true;
|
2013-04-17 21:45:00 -07:00
|
|
|
|
maxwidth = 125;
|
2013-04-13 20:33:43 -07:00
|
|
|
|
}
|
2013-04-10 12:33:19 -07:00
|
|
|
|
else {
|
|
|
|
|
url = "css/images/items/detail/video.png";
|
|
|
|
|
useBackgroundColor = true;
|
2013-04-28 11:30:58 -07:00
|
|
|
|
maxwidth = 150;p
|
2013-04-10 12:33:19 -07:00
|
|
|
|
}
|
2013-04-10 06:53:44 -07:00
|
|
|
|
|
2013-04-10 12:33:19 -07:00
|
|
|
|
if (url) {
|
2013-04-10 06:53:44 -07:00
|
|
|
|
|
2013-04-21 21:38:03 -07:00
|
|
|
|
var style = useBackgroundColor ? "background-color:" + defaultBackground + ";" : "";
|
2013-04-10 06:53:44 -07:00
|
|
|
|
|
2013-04-17 20:53:19 -07:00
|
|
|
|
if (maxwidth) {
|
|
|
|
|
style += "max-width:" + maxwidth + "px;";
|
|
|
|
|
}
|
|
|
|
|
|
2013-04-10 12:33:19 -07:00
|
|
|
|
html += "<img class='itemDetailImage' src='" + url + "' style='" + style + "' />";
|
|
|
|
|
}
|
2013-04-10 06:53:44 -07:00
|
|
|
|
|
2013-04-10 12:33:19 -07:00
|
|
|
|
return html;
|
|
|
|
|
},
|
2013-04-10 06:53:44 -07:00
|
|
|
|
|
2013-04-18 19:52:22 -07:00
|
|
|
|
getMiscInfoHtml: function (item) {
|
2013-04-10 10:11:23 -07:00
|
|
|
|
|
2013-04-10 12:33:19 -07:00
|
|
|
|
var miscInfo = [];
|
2013-04-24 13:28:42 -07:00
|
|
|
|
var text;
|
2013-04-25 17:52:55 -07:00
|
|
|
|
|
2013-04-24 13:28:42 -07:00
|
|
|
|
if (item.ProductionYear && item.Type == "Series") {
|
2013-04-18 19:52:22 -07:00
|
|
|
|
|
|
|
|
|
if (item.Status == "Continuing") {
|
|
|
|
|
miscInfo.push(item.ProductionYear + "-Present");
|
2013-04-24 13:28:42 -07:00
|
|
|
|
|
|
|
|
|
} else if (item.ProductionYear) {
|
|
|
|
|
|
|
|
|
|
text = item.ProductionYear;
|
|
|
|
|
|
|
|
|
|
if (item.EndDate) {
|
|
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
text += "-" + parseISO8601Date(item.EndDate, { toLocal: true }).getFullYear();
|
|
|
|
|
}
|
|
|
|
|
catch (e) {
|
|
|
|
|
console.log("Error parsing date: " + item.EndDate);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
miscInfo.push(text);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (item.Type != "Series" && item.Type != "Episode") {
|
2013-04-25 17:52:55 -07:00
|
|
|
|
|
2013-04-24 13:28:42 -07:00
|
|
|
|
if (item.ProductionYear) {
|
|
|
|
|
|
2013-04-18 19:52:22 -07:00
|
|
|
|
miscInfo.push(item.ProductionYear);
|
|
|
|
|
}
|
2013-04-24 13:28:42 -07:00
|
|
|
|
else if (item.PremiereDate) {
|
2013-04-25 17:52:55 -07:00
|
|
|
|
|
2013-04-24 13:28:42 -07:00
|
|
|
|
try {
|
|
|
|
|
text = "-" + parseISO8601Date(item.PremiereDate, { toLocal: true }).getFullYear();
|
|
|
|
|
miscInfo.push(text);
|
|
|
|
|
}
|
|
|
|
|
catch (e) {
|
|
|
|
|
console.log("Error parsing date: " + item.PremiereDate);
|
|
|
|
|
}
|
|
|
|
|
}
|
2013-04-10 12:33:19 -07:00
|
|
|
|
}
|
2013-04-10 10:11:23 -07:00
|
|
|
|
|
2013-04-10 12:33:19 -07:00
|
|
|
|
if (item.OfficialRating) {
|
|
|
|
|
miscInfo.push(item.OfficialRating);
|
|
|
|
|
}
|
2013-04-10 10:11:23 -07:00
|
|
|
|
|
2013-04-10 12:33:19 -07:00
|
|
|
|
if (item.RunTimeTicks) {
|
2013-04-10 10:11:23 -07:00
|
|
|
|
|
2013-04-22 13:06:43 -07:00
|
|
|
|
if (item.Type == "Audio") {
|
2013-04-10 10:11:23 -07:00
|
|
|
|
|
2013-04-22 13:06:43 -07:00
|
|
|
|
miscInfo.push(DashboardPage.getDisplayText(item.RunTimeTicks));
|
|
|
|
|
} else {
|
|
|
|
|
var minutes = item.RunTimeTicks / 600000000;
|
2013-04-10 10:11:23 -07:00
|
|
|
|
|
2013-04-22 13:06:43 -07:00
|
|
|
|
minutes = minutes || 1;
|
|
|
|
|
|
|
|
|
|
miscInfo.push(parseInt(minutes) + "min");
|
|
|
|
|
}
|
2013-04-10 12:33:19 -07:00
|
|
|
|
}
|
2013-04-10 10:11:23 -07:00
|
|
|
|
|
2013-04-19 16:45:27 -07:00
|
|
|
|
if (item.MediaType && item.DisplayMediaType && item.DisplayMediaType != item.Type) {
|
2013-04-18 19:52:22 -07:00
|
|
|
|
miscInfo.push(item.DisplayMediaType);
|
2013-04-10 12:33:19 -07:00
|
|
|
|
}
|
2013-04-10 10:11:23 -07:00
|
|
|
|
|
2013-04-18 19:52:22 -07:00
|
|
|
|
if (item.VideoFormat && item.VideoFormat !== 'Standard') {
|
|
|
|
|
miscInfo.push(item.VideoFormat);
|
|
|
|
|
}
|
2013-04-10 22:27:27 -07:00
|
|
|
|
|
2013-04-10 12:33:19 -07:00
|
|
|
|
return miscInfo.join(' ');
|
|
|
|
|
},
|
2013-04-10 10:11:23 -07:00
|
|
|
|
|
2013-04-21 21:38:03 -07:00
|
|
|
|
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();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
2013-04-23 07:46:27 -07:00
|
|
|
|
renderStudios: function (elem, item, context) {
|
2013-04-10 12:25:34 -07:00
|
|
|
|
|
2013-04-10 12:33:19 -07:00
|
|
|
|
if (item.Studios && item.Studios.length) {
|
2013-04-10 12:25:34 -07:00
|
|
|
|
|
2013-04-10 12:33:19 -07:00
|
|
|
|
var html = 'Studios: ';
|
2013-04-10 12:25:34 -07:00
|
|
|
|
|
2013-04-10 12:33:19 -07:00
|
|
|
|
for (var i = 0, length = item.Studios.length; i < length; i++) {
|
2013-04-10 12:25:34 -07:00
|
|
|
|
|
2013-04-10 12:33:19 -07:00
|
|
|
|
if (i > 0) {
|
|
|
|
|
html += ' / ';
|
|
|
|
|
}
|
2013-04-10 12:25:34 -07:00
|
|
|
|
|
2013-04-23 19:50:43 -07:00
|
|
|
|
html += '<a href="itembynamedetails.html?context=' + context + '&studio=' + encodeName(item.Studios[i]) + '">' + item.Studios[i] + '</a>';
|
2013-04-10 12:25:34 -07:00
|
|
|
|
}
|
|
|
|
|
|
2013-04-10 12:33:19 -07:00
|
|
|
|
elem.show().html(html).trigger('create');
|
2013-04-10 12:25:34 -07:00
|
|
|
|
|
|
|
|
|
|
2013-04-10 12:33:19 -07:00
|
|
|
|
} else {
|
|
|
|
|
elem.hide();
|
|
|
|
|
}
|
|
|
|
|
},
|
2013-04-10 12:25:34 -07:00
|
|
|
|
|
2013-04-23 07:46:27 -07:00
|
|
|
|
renderGenres: function (elem, item, context) {
|
2013-04-10 12:25:34 -07:00
|
|
|
|
|
2013-04-10 12:33:19 -07:00
|
|
|
|
if (item.Genres && item.Genres.length) {
|
|
|
|
|
var html = 'Genres: ';
|
2013-04-10 12:25:34 -07:00
|
|
|
|
|
2013-04-10 12:33:19 -07:00
|
|
|
|
for (var i = 0, length = item.Genres.length; i < length; i++) {
|
2013-04-10 12:25:34 -07:00
|
|
|
|
|
2013-04-10 12:33:19 -07:00
|
|
|
|
if (i > 0) {
|
|
|
|
|
html += ' / ';
|
|
|
|
|
}
|
2013-04-10 12:25:34 -07:00
|
|
|
|
|
2013-04-23 19:50:43 -07:00
|
|
|
|
html += '<a href="itembynamedetails.html?context=' + context + '&genre=' + encodeName(item.Genres[i]) + '">' + item.Genres[i] + '</a>';
|
2013-04-10 12:25:34 -07:00
|
|
|
|
}
|
|
|
|
|
|
2013-04-10 12:33:19 -07:00
|
|
|
|
elem.show().html(html).trigger('create');
|
2013-04-10 12:25:34 -07:00
|
|
|
|
|
|
|
|
|
|
2013-04-12 08:25:00 -07:00
|
|
|
|
} else {
|
|
|
|
|
elem.hide();
|
2013-04-18 07:27:21 -07:00
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
renderPremiereDate: function (elem, item) {
|
|
|
|
|
if (item.PremiereDate) {
|
2013-04-18 22:08:18 -07:00
|
|
|
|
try {
|
2013-04-24 13:28:42 -07:00
|
|
|
|
|
|
|
|
|
var date = parseISO8601Date(item.PremiereDate, { toLocal: true });
|
|
|
|
|
|
|
|
|
|
var text = new Date().getTime() > date.getTime() ? "Premiered" : "Premieres";
|
|
|
|
|
|
|
|
|
|
elem.show().html(text + ' ' + date.toDateString());
|
2013-04-18 22:08:18 -07:00
|
|
|
|
} catch (err) {
|
|
|
|
|
elem.hide();
|
|
|
|
|
}
|
2013-04-18 07:27:21 -07:00
|
|
|
|
} else {
|
|
|
|
|
elem.hide();
|
2013-04-12 08:25:00 -07:00
|
|
|
|
}
|
|
|
|
|
},
|
2013-04-12 17:42:51 -07:00
|
|
|
|
|
2013-04-12 08:25:00 -07:00
|
|
|
|
renderBudget: function (elem, item) {
|
|
|
|
|
if (item.Budget) {
|
|
|
|
|
elem.show().html('Budget: $' + item.Budget);
|
2013-04-10 12:33:19 -07:00
|
|
|
|
} else {
|
|
|
|
|
elem.hide();
|
|
|
|
|
}
|
2013-04-14 20:37:07 -07:00
|
|
|
|
},
|
|
|
|
|
|
2013-04-18 07:05:38 -07:00
|
|
|
|
renderRevenue: function (elem, item) {
|
|
|
|
|
if (item.Revenue) {
|
|
|
|
|
elem.show().html('Revenue: $' + item.Revenue);
|
|
|
|
|
} else {
|
|
|
|
|
elem.hide();
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
|
2013-04-16 20:10:05 -07:00
|
|
|
|
shouldDisplayGallery: function (item) {
|
|
|
|
|
|
|
|
|
|
var imageTags = item.ImageTags || {};
|
|
|
|
|
|
|
|
|
|
if (imageTags.Banner) {
|
|
|
|
|
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (imageTags.Logo) {
|
|
|
|
|
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
if (imageTags.Thumb) {
|
|
|
|
|
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
if (imageTags.Art) {
|
|
|
|
|
|
|
|
|
|
return true;
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
if (imageTags.Menu) {
|
|
|
|
|
|
|
|
|
|
return true;
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
if (imageTags.Disc) {
|
|
|
|
|
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
if (imageTags.Box) {
|
|
|
|
|
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (item.BackdropImageTags && item.BackdropImageTags.length) {
|
|
|
|
|
return true;
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (item.ScreenshotImageTags && item.ScreenshotImageTags.length) {
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return false;
|
|
|
|
|
},
|
|
|
|
|
|
2013-04-15 18:09:27 -07:00
|
|
|
|
getGalleryHtml: function (item) {
|
2013-04-15 19:36:12 -07:00
|
|
|
|
|
|
|
|
|
var html = '';
|
|
|
|
|
var i, length;
|
2013-04-15 17:45:08 -07:00
|
|
|
|
|
2013-04-15 18:09:27 -07:00
|
|
|
|
var imageTags = item.ImageTags || {};
|
|
|
|
|
|
2013-04-15 18:15:34 -07:00
|
|
|
|
if (imageTags.Banner) {
|
|
|
|
|
|
2013-04-25 20:31:10 -07:00
|
|
|
|
html += LibraryBrowser.createGalleryImage(item, "Banner", imageTags.Banner);
|
2013-04-15 18:15:34 -07:00
|
|
|
|
}
|
|
|
|
|
|
2013-04-15 18:09:27 -07:00
|
|
|
|
if (imageTags.Logo) {
|
2013-04-15 17:45:08 -07:00
|
|
|
|
|
2013-04-25 20:31:10 -07:00
|
|
|
|
html += LibraryBrowser.createGalleryImage(item, "Logo", imageTags.Logo);
|
2013-04-15 19:36:12 -07:00
|
|
|
|
}
|
|
|
|
|
if (imageTags.Thumb) {
|
2013-04-15 17:45:08 -07:00
|
|
|
|
|
2013-04-25 20:31:10 -07:00
|
|
|
|
html += LibraryBrowser.createGalleryImage(item, "Thumb", imageTags.Thumb);
|
2013-04-15 19:36:12 -07:00
|
|
|
|
}
|
|
|
|
|
if (imageTags.Art) {
|
2013-04-15 17:45:08 -07:00
|
|
|
|
|
2013-04-25 20:31:10 -07:00
|
|
|
|
html += LibraryBrowser.createGalleryImage(item, "Art", imageTags.Art);
|
2013-04-15 17:45:08 -07:00
|
|
|
|
|
2013-04-15 19:36:12 -07:00
|
|
|
|
}
|
|
|
|
|
if (imageTags.Menu) {
|
2013-04-15 17:45:08 -07:00
|
|
|
|
|
2013-04-25 20:31:10 -07:00
|
|
|
|
html += LibraryBrowser.createGalleryImage(item, "Menu", imageTags.Menu);
|
2013-04-15 17:45:08 -07:00
|
|
|
|
|
2013-04-15 19:36:12 -07:00
|
|
|
|
}
|
|
|
|
|
if (imageTags.Box) {
|
2013-04-15 17:45:08 -07:00
|
|
|
|
|
2013-04-25 20:31:10 -07:00
|
|
|
|
html += LibraryBrowser.createGalleryImage(item, "Box", imageTags.Box);
|
2013-04-15 19:36:12 -07:00
|
|
|
|
}
|
2013-04-15 17:45:08 -07:00
|
|
|
|
|
2013-04-15 19:36:12 -07:00
|
|
|
|
if (item.BackdropImageTags) {
|
2013-04-15 17:45:08 -07:00
|
|
|
|
|
2013-04-15 19:36:12 -07:00
|
|
|
|
for (i = 0, length = item.BackdropImageTags.length; i < length; i++) {
|
2013-04-25 20:31:10 -07:00
|
|
|
|
html += LibraryBrowser.createGalleryImage(item, "Backdrop", item.BackdropImageTags[i], i);
|
2013-04-15 19:36:12 -07:00
|
|
|
|
}
|
2013-04-15 17:45:08 -07:00
|
|
|
|
|
2013-04-15 19:36:12 -07:00
|
|
|
|
}
|
2013-04-15 17:45:08 -07:00
|
|
|
|
|
2013-04-15 19:36:12 -07:00
|
|
|
|
if (item.ScreenshotImageTags) {
|
2013-04-15 17:45:08 -07:00
|
|
|
|
|
2013-04-15 19:36:12 -07:00
|
|
|
|
for (i = 0, length = item.ScreenshotImageTags.length; i < length; i++) {
|
2013-04-25 20:31:10 -07:00
|
|
|
|
html += LibraryBrowser.createGalleryImage(item, "Screenshot", item.ScreenshotImageTags[i], i);
|
2013-04-15 19:36:12 -07:00
|
|
|
|
}
|
|
|
|
|
}
|
2013-04-22 07:44:11 -07:00
|
|
|
|
if (imageTags.Disc) {
|
|
|
|
|
|
2013-04-25 20:31:10 -07:00
|
|
|
|
html += LibraryBrowser.createGalleryImage(item, "Disc", imageTags.Disc);
|
2013-04-22 07:44:11 -07:00
|
|
|
|
}
|
2013-04-15 17:45:08 -07:00
|
|
|
|
|
2013-04-15 19:36:12 -07:00
|
|
|
|
return html;
|
|
|
|
|
},
|
2013-04-15 17:45:08 -07:00
|
|
|
|
|
2013-04-25 20:31:10 -07:00
|
|
|
|
createGalleryImage: function (item, type, tag, index) {
|
2013-04-15 16:32:41 -07:00
|
|
|
|
|
2013-04-15 19:36:12 -07:00
|
|
|
|
var downloadWidth = 400;
|
|
|
|
|
var lightboxWidth = 800;
|
|
|
|
|
var html = '';
|
2013-04-15 16:32:41 -07:00
|
|
|
|
|
2013-04-15 19:36:12 -07:00
|
|
|
|
if (typeof (index) == "undefined") index = 0;
|
2013-04-15 16:32:41 -07:00
|
|
|
|
|
2013-04-15 19:36:12 -07:00
|
|
|
|
html += '<div class="posterViewItem" style="padding-bottom:0px;">';
|
|
|
|
|
html += '<a href="#pop_' + index + '_' + tag + '" data-transition="fade" data-rel="popup" data-position-to="window">';
|
2013-04-25 20:31:10 -07:00
|
|
|
|
html += '<img class="galleryImage" src="' + LibraryBrowser.getImageUrl(item, type, index, {
|
2013-04-27 15:52:41 -07:00
|
|
|
|
maxwidth: downloadWidth,
|
2013-04-25 20:31:10 -07:00
|
|
|
|
tag: tag
|
2013-04-15 19:36:12 -07:00
|
|
|
|
}) + '" />';
|
|
|
|
|
html += '</div>';
|
2013-04-15 16:32:41 -07:00
|
|
|
|
|
2013-04-15 19:36:12 -07:00
|
|
|
|
html += '<div class="galleryPopup" id="pop_' + index + '_' + tag + '" data-role="popup" data-theme="d" data-corners="false" data-overlay-theme="a">';
|
|
|
|
|
html += '<a href="#" data-rel="back" data-role="button" data-theme="a" data-icon="delete" data-iconpos="notext" class="ui-btn-right">Close</a>';
|
2013-04-25 20:31:10 -07:00
|
|
|
|
html += '<img class="" src="' + LibraryBrowser.getImageUrl(item, type, index, {
|
|
|
|
|
|
2013-04-15 19:36:12 -07:00
|
|
|
|
maxwidth: lightboxWidth,
|
2013-04-25 20:31:10 -07:00
|
|
|
|
tag: tag
|
2013-04-27 15:52:41 -07:00
|
|
|
|
|
2013-04-15 19:36:12 -07:00
|
|
|
|
}) + '" />';
|
|
|
|
|
html += '</div>';
|
2013-04-15 16:32:41 -07:00
|
|
|
|
|
2013-04-15 19:36:12 -07:00
|
|
|
|
return html;
|
|
|
|
|
},
|
2013-04-15 16:32:41 -07:00
|
|
|
|
|
2013-04-23 07:46:27 -07:00
|
|
|
|
createCastImage: function (cast, context) {
|
2013-04-15 16:32:41 -07:00
|
|
|
|
|
2013-04-15 19:36:12 -07:00
|
|
|
|
var html = '';
|
2013-04-15 16:32:41 -07:00
|
|
|
|
|
2013-04-15 19:36:12 -07:00
|
|
|
|
var role = cast.Role || cast.Type;
|
2013-04-15 16:32:41 -07:00
|
|
|
|
|
2013-04-23 19:50:43 -07:00
|
|
|
|
html += '<a href="itembynamedetails.html?context=' + context + '&person=' + encodeName(cast.Name) + '">';
|
2013-04-15 19:36:12 -07:00
|
|
|
|
html += '<div class="posterViewItem posterViewItemWithDualText">';
|
2013-04-15 16:32:41 -07:00
|
|
|
|
|
2013-04-15 19:36:12 -07:00
|
|
|
|
if (cast.PrimaryImageTag) {
|
2013-04-15 16:32:41 -07:00
|
|
|
|
|
2013-04-15 19:36:12 -07:00
|
|
|
|
var imgUrl = ApiClient.getPersonImageUrl(cast.Name, {
|
|
|
|
|
width: 185,
|
|
|
|
|
tag: cast.PrimaryImageTag,
|
|
|
|
|
type: "primary"
|
|
|
|
|
});
|
2013-04-15 16:32:41 -07:00
|
|
|
|
|
2013-04-15 19:36:12 -07:00
|
|
|
|
html += '<img src="' + imgUrl + '" />';
|
|
|
|
|
} else {
|
2013-04-21 21:38:03 -07:00
|
|
|
|
var style = "background-color:" + defaultBackground + ";";
|
2013-04-15 16:32:41 -07:00
|
|
|
|
|
2013-04-15 19:36:12 -07:00
|
|
|
|
html += '<img src="css/images/items/list/person.png" style="max-width:185px; ' + style + '"/>';
|
|
|
|
|
}
|
2013-04-15 16:32:41 -07:00
|
|
|
|
|
2013-04-15 19:36:12 -07:00
|
|
|
|
html += '<div class="posterViewItemText posterViewItemPrimaryText">' + cast.Name + '</div>';
|
|
|
|
|
html += '<div class="posterViewItemText">' + role + '</div>';
|
2013-04-15 16:32:41 -07:00
|
|
|
|
|
2013-04-15 19:36:12 -07:00
|
|
|
|
html += '</div></a>';
|
2013-04-15 16:32:41 -07:00
|
|
|
|
|
2013-04-15 19:36:12 -07:00
|
|
|
|
return html;
|
|
|
|
|
}
|
2013-04-10 06:53:44 -07:00
|
|
|
|
|
2013-04-10 12:33:19 -07:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
})(window, jQuery);
|