define(["loading", "libraryBrowser", "cardBuilder", "dom", "apphost", "imageLoader", "globalize", "layoutManager", "scrollStyles", "emby-itemscontainer"], function (loading, libraryBrowser, cardBuilder, dom, appHost, imageLoader, globalize, layoutManager) { "use strict"; function enableScrollX() { return !layoutManager.desktop; } function getThumbShape() { return enableScrollX() ? "overflowBackdrop" : "backdrop"; } function getPosterShape() { return enableScrollX() ? "overflowPortrait" : "portrait"; } function getSquareShape() { return enableScrollX() ? "overflowSquare" : "square"; } function getSections() { return [{ name: "HeaderFavoriteMovies", types: "Movie", id: "favoriteMovies", shape: getPosterShape(), showTitle: false, overlayPlayButton: true }, { name: "HeaderFavoriteShows", types: "Series", id: "favoriteShows", shape: getPosterShape(), showTitle: false, overlayPlayButton: true }, { name: "HeaderFavoriteEpisodes", types: "Episode", id: "favoriteEpisode", shape: getThumbShape(), preferThumb: false, showTitle: true, showParentTitle: true, overlayPlayButton: true, overlayText: false, centerText: true }, { name: "HeaderFavoriteVideos", types: "Video,MusicVideo", id: "favoriteVideos", shape: getThumbShape(), preferThumb: true, showTitle: true, overlayPlayButton: true, overlayText: false, centerText: true }, { name: "HeaderFavoriteArtists", types: "MusicArtist", id: "favoriteArtists", shape: getSquareShape(), preferThumb: false, showTitle: true, overlayText: false, showParentTitle: false, centerText: true, overlayPlayButton: true, coverImage: true }, { name: "HeaderFavoriteAlbums", types: "MusicAlbum", id: "favoriteAlbums", shape: getSquareShape(), preferThumb: false, showTitle: true, overlayText: false, showParentTitle: true, centerText: true, overlayPlayButton: true, coverImage: true }, { name: "HeaderFavoriteSongs", types: "Audio", id: "favoriteSongs", shape: getSquareShape(), preferThumb: false, showTitle: true, overlayText: false, showParentTitle: true, centerText: true, overlayMoreButton: true, action: "instantmix", coverImage: true }]; } function loadSection(elem, userId, topParentId, section, isSingleSection) { var screenWidth = dom.getWindowSize().innerWidth; var options = { SortBy: "SortName", SortOrder: "Ascending", Filters: "IsFavorite", Recursive: true, Fields: "PrimaryImageAspectRatio,BasicSyncInfo", CollapseBoxSetItems: false, ExcludeLocationTypes: "Virtual", EnableTotalRecordCount: false }; if (topParentId) { options.ParentId = topParentId; } if (!isSingleSection) { options.Limit = screenWidth >= 1920 ? 10 : screenWidth >= 1440 ? 8 : 6; if (enableScrollX()) { options.Limit = 20; } } var promise; if ("MusicArtist" === section.types) { promise = ApiClient.getArtists(userId, options); } else { options.IncludeItemTypes = section.types; promise = ApiClient.getItems(userId, options); } return promise.then(function (result) { var html = ""; if (result.Items.length) { if (html += '