var LibraryBrowser = (function (window, $) {
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;
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;
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 {
imgUrl = "css/images/items/list/collection.png";
isDefault = true;
}
var cssClass = isDefault ? "tileImage defaultTileImage" : "tileImage";
html += '';
html += ' ' + LibraryBrowser.getFiveStarRatingHtml(item) + ' ' + childText + ' ' + childText + ' ' + childText + ' ' + LibraryBrowser.getMiscInfoHtml(item) + ' ' + LibraryBrowser.getMiscInfoHtml(item) + ' ' + LibraryBrowser.getUserDataIconsHtml(item) + '
'; html += ' | Track | '; html += 'Duration | '; html += 'Play Count | '; html += ''; html += ' |
---|---|---|---|---|
' + (num || "") + ' | '; html += '' + (item.Name || "") + ' | '; var time = DashboardPage.getDisplayText(item.RunTimeTicks || 0); html += '' + time + ' | '; html += '' + (item.UserData ? item.UserData.PlayCount : 0) + ' | '; html += '' + LibraryBrowser.getUserDataIconsHtml(item) + ' | '; html += '