var LibraryBrowser = (function (window, document, $, screen, localStorage) { var defaultBackground = "#999;"; return { getDefaultPageSize: function () { var saved = localStorage.getItem('pagesize'); if (saved) { return parseInt(saved); } if (window.location.toString().toLowerCase().indexOf('localhost') != -1) { return 100; } return 20; }, getPosterDetailViewHtml: function (options) { var items = options.items; var currentYear; 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]; if (options.timeline) { var year = item.ProductionYear || "Unknown Year"; if (year != currentYear) { html += '
' + LibraryBrowser.getRatingHtml(item) + '
'; } var childText; if (item.Type == "BoxSet") { childText = item.ChildCount == 1 ? "1 Movie" : item.ChildCount + " Movies"; html += '' + childText + '
'; } else if (item.Type == "GamePlatform") { childText = item.ChildCount == 1 ? "1 Game" : item.ChildCount + " Games"; html += '' + childText + '
'; } else if (item.Type == "MusicAlbum") { childText = item.ChildCount == 1 ? "1 Song" : item.ChildCount + " Songs"; html += '' + childText + '
'; } 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; html += '' + childText + '
'; } else if (item.Type == "Game") { html += '' + item.GameSystem + '
'; } else { html += '' + LibraryBrowser.getMiscInfoHtml(item) + '
'; } if (item.Type == "MusicAlbum") { html += '' + LibraryBrowser.getMiscInfoHtml(item) + '
'; } html += '' + LibraryBrowser.getUserDataIconsHtml(item) + '
'; html += ''; 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 += '' + (item.Album || '') + ' | '; } } if (options.showArtist) { if (item.Artists && item.Artists.length && item.Artists[0]) { var artist = item.Artists[0]; html += '' + artist + ' | '; } else { html += '' + (artist || '') + ' | '; } } var time = DashboardPage.getDisplayText(item.RunTimeTicks || 0); html += '' + time + ' | '; html += '' + (item.UserData ? item.UserData.PlayCount : 0) + ' | '; html += '' + LibraryBrowser.getUserDataIconsHtml(item) + ' | '; html += '