var LibraryBrowser = (function (window, document, $) {
var defaultBackground = "#999;";
return {
getDetaultPageSize: function () {
if (window.location.toString().toLowerCase().indexOf('localhost') != -1) {
return 100;
}
return 20;
},
getPosterDetailViewHtml: function (options) {
var items = options.items;
if (!options.shape) {
options.shape = options.preferBackdrop ? "backdrop" : "poster";
}
var primaryImageAspectRatio = options.useAverageAspectRatio ? LibraryBrowser.getAveragePrimaryImageAspectRatio(items) : null;
var html = '';
for (var i = 0, length = items.length; i < length; i++) {
var item = items[i];
var imgUrl;
var isDefault = false;
var cssClass = "tileItem";
if (options.shape) {
cssClass += " " + options.shape + "TileItem";
}
html += '';
if (options.preferBackdrop && item.BackdropImageTags && item.BackdropImageTags.length) {
imgUrl = LibraryBrowser.getImageUrl(item, 'Backdrop', 0, {
height: 198,
width: 352
});
}
else if (options.preferBackdrop && item.ImageTags && item.ImageTags.Thumb) {
imgUrl = ApiClient.getImageUrl(item.Id, {
type: "Thumb",
height: 198,
width: 352,
tag: item.ImageTags.Thumb
});
}
else if (item.ImageTags && item.ImageTags.Primary) {
var height = 300;
var width = primaryImageAspectRatio ? parseInt(height * primaryImageAspectRatio) : null;
imgUrl = LibraryBrowser.getImageUrl(item, 'Primary', 0, {
height: height,
width: width
});
}
else if (item.BackdropImageTags && item.BackdropImageTags.length) {
imgUrl = LibraryBrowser.getImageUrl(item, 'Backdrop', 0, {
height: 198,
width: 352
});
}
else if (item.MediaType == "Audio" || item.Type == "MusicAlbum" || item.Type == "MusicArtist") {
imgUrl = "css/images/items/list/audio.png";
isDefault = true;
}
else if (item.MediaType == "Video" || item.Type == "Season" || item.Type == "Series") {
imgUrl = "css/images/items/list/video.png";
isDefault = true;
}
else if (item.Type == "Person") {
imgUrl = "css/images/items/list/person.png";
isDefault = true;
}
else if (item.Type == "Artist") {
imgUrl = "css/images/items/list/audiocollection.png";
isDefault = true;
}
else if (item.MediaType == "Game") {
imgUrl = "css/images/items/list/game.png";
isDefault = true;
}
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;
}
else {
imgUrl = "css/images/items/list/collection.png";
isDefault = true;
}
cssClass = isDefault ? "tileImage defaultTileImage" : "tileImage";
html += '';
html += ' ' + LibraryBrowser.getFiveStarRatingHtml(item) + ' ' + childText + ' ' + childText + ' ' + childText + ' ' + childText + ' ' + item.GameSystem + ' ' + LibraryBrowser.getMiscInfoHtml(item) + ' ' + LibraryBrowser.getMiscInfoHtml(item) + ' ' + LibraryBrowser.getUserDataIconsHtml(item) + '
'; html += ' | '; html += ' | Track | '; if (options.showAlbum) { html += 'Album | '; } if (options.showArtist) { html += 'Artist | '; } html += 'Duration | '; html += 'Play Count | '; html += ''; html += ' | ||
---|---|---|---|---|---|---|---|---|---|
'; var num = item.IndexNumber; if (num && item.ParentIndexNumber) { num = item.ParentIndexNumber + "." + num; } html += ' | ' + (num || "") + ' | '; html += '' + (item.Name || "") + ' | '; if (options.showAlbum) { if (item.Album && item.ParentId) { html += '' + item.Album + ' | '; } else { html += ''; } } if (options.showArtist) { if (item.Artists && item.Artists.length) { var artist = item.Artists[0]; html += ' | ' + artist + ' | '; } else { html += ''; } } var time = DashboardPage.getDisplayText(item.RunTimeTicks || 0); html += ' | ' + time + ' | '; html += '' + (item.UserData ? item.UserData.PlayCount : 0) + ' | '; html += '' + LibraryBrowser.getUserDataIconsHtml(item) + ' | '; html += '