Unminify using 1.5.323
Repo with tag: https://github.com/MediaBrowser/emby-webcomponents/tree/1.5.323
This commit is contained in:
parent
4678528d00
commit
de6ac33ec1
289 changed files with 78483 additions and 54701 deletions
|
@ -1,396 +1,646 @@
|
|||
define(["layoutManager", "globalize", "require", "events", "connectionManager", "cardBuilder", "appRouter", "emby-scroller", "emby-itemscontainer", "emby-linkbutton"], function(layoutManager, globalize, require, events, connectionManager, cardBuilder, appRouter) {
|
||||
"use strict";
|
||||
define(['layoutManager', 'globalize', 'require', 'events', 'connectionManager', 'cardBuilder', 'appRouter', 'emby-scroller', 'emby-itemscontainer', 'emby-linkbutton'], function (layoutManager, globalize, require, events, connectionManager, cardBuilder, appRouter) {
|
||||
'use strict';
|
||||
|
||||
function loadSuggestions(instance, context, apiClient) {
|
||||
|
||||
var options = {
|
||||
|
||||
SortBy: "IsFavoriteOrLiked,Random",
|
||||
IncludeItemTypes: "Movie,Series,MusicArtist",
|
||||
Limit: 20,
|
||||
Recursive: !0,
|
||||
Recursive: true,
|
||||
ImageTypeLimit: 0,
|
||||
EnableImages: !1,
|
||||
EnableImages: false,
|
||||
ParentId: instance.options.parentId,
|
||||
EnableTotalRecordCount: !1
|
||||
EnableTotalRecordCount: false
|
||||
};
|
||||
apiClient.getItems(apiClient.getCurrentUserId(), options).then(function(result) {
|
||||
"suggestions" !== instance.mode && (result.Items = []);
|
||||
var html = result.Items.map(function(i) {
|
||||
var href = appRouter.getRouteUrl(i),
|
||||
itemHtml = '<div><a is="emby-linkbutton" class="button-link" style="display:inline-block;padding:.5em 1em;" href="' + href + '">';
|
||||
return itemHtml += i.Name, itemHtml += "</a></div>"
|
||||
}).join(""),
|
||||
searchSuggestions = context.querySelector(".searchSuggestions");
|
||||
searchSuggestions.querySelector(".searchSuggestionsList").innerHTML = html, result.Items.length && searchSuggestions.classList.remove("hide")
|
||||
})
|
||||
|
||||
apiClient.getItems(apiClient.getCurrentUserId(), options).then(function (result) {
|
||||
|
||||
if (instance.mode !== 'suggestions') {
|
||||
result.Items = [];
|
||||
}
|
||||
|
||||
var html = result.Items.map(function (i) {
|
||||
|
||||
var href = appRouter.getRouteUrl(i);
|
||||
|
||||
var itemHtml = '<div><a is="emby-linkbutton" class="button-link" style="display:inline-block;padding:.5em 1em;" href="' + href + '">';
|
||||
itemHtml += i.Name;
|
||||
itemHtml += '</a></div>';
|
||||
return itemHtml;
|
||||
|
||||
}).join('');
|
||||
|
||||
var searchSuggestions = context.querySelector('.searchSuggestions');
|
||||
searchSuggestions.querySelector('.searchSuggestionsList').innerHTML = html;
|
||||
|
||||
if (result.Items.length) {
|
||||
searchSuggestions.classList.remove('hide');
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function getSearchHints(instance, apiClient, query) {
|
||||
if (!query.searchTerm) return Promise.resolve({
|
||||
SearchHints: []
|
||||
});
|
||||
var allowSearch = !0,
|
||||
queryIncludeItemTypes = query.IncludeItemTypes;
|
||||
if ("tvshows" === instance.options.collectionType ? query.IncludeArtists ? allowSearch = !1 : "Movie" !== queryIncludeItemTypes && "LiveTvProgram" !== queryIncludeItemTypes && "MusicAlbum" !== queryIncludeItemTypes && "Audio" !== queryIncludeItemTypes && "Book" !== queryIncludeItemTypes && "AudioBook" !== queryIncludeItemTypes && "Playlist" !== queryIncludeItemTypes && "PhotoAlbum" !== queryIncludeItemTypes && "Video" !== query.MediaTypes && "Photo" !== query.MediaTypes || (allowSearch = !1) : "movies" === instance.options.collectionType ? query.IncludeArtists ? allowSearch = !1 : "Series" !== queryIncludeItemTypes && "Episode" !== queryIncludeItemTypes && "LiveTvProgram" !== queryIncludeItemTypes && "MusicAlbum" !== queryIncludeItemTypes && "Audio" !== queryIncludeItemTypes && "Book" !== queryIncludeItemTypes && "AudioBook" !== queryIncludeItemTypes && "Playlist" !== queryIncludeItemTypes && "PhotoAlbum" !== queryIncludeItemTypes && "Video" !== query.MediaTypes && "Photo" !== query.MediaTypes || (allowSearch = !1) : "music" === instance.options.collectionType ? query.People ? allowSearch = !1 : "Series" !== queryIncludeItemTypes && "Episode" !== queryIncludeItemTypes && "LiveTvProgram" !== queryIncludeItemTypes && "Movie" !== queryIncludeItemTypes || (allowSearch = !1) : "livetv" === instance.options.collectionType && (query.IncludeArtists || query.IncludePeople ? allowSearch = !1 : "Series" !== queryIncludeItemTypes && "Episode" !== queryIncludeItemTypes && "MusicAlbum" !== queryIncludeItemTypes && "Audio" !== queryIncludeItemTypes && "Book" !== queryIncludeItemTypes && "AudioBook" !== queryIncludeItemTypes && "PhotoAlbum" !== queryIncludeItemTypes && "Movie" !== queryIncludeItemTypes && "Video" !== query.MediaTypes && "Photo" !== query.MediaTypes || (allowSearch = !1)), "NullType" === queryIncludeItemTypes && (allowSearch = !1), !allowSearch) return Promise.resolve({
|
||||
SearchHints: []
|
||||
});
|
||||
if (apiClient.isMinServerVersion("3.4.1.31")) {
|
||||
query.Fields = "PrimaryImageAspectRatio,CanDelete,BasicSyncInfo,MediaSourceCount", query.Recursive = !0, query.EnableTotalRecordCount = !1, query.ImageTypeLimit = 1;
|
||||
var methodName = "getItems";
|
||||
return query.IncludeMedia || (query.IncludePeople ? methodName = "getPeople" : query.IncludeArtists && (methodName = "getArtists")), apiClient[methodName](apiClient.getCurrentUserId(), query)
|
||||
|
||||
if (!query.searchTerm) {
|
||||
return Promise.resolve({
|
||||
SearchHints: []
|
||||
});
|
||||
}
|
||||
return query.UserId = apiClient.getCurrentUserId(), apiClient.getSearchHints(query)
|
||||
|
||||
var allowSearch = true;
|
||||
|
||||
var queryIncludeItemTypes = query.IncludeItemTypes;
|
||||
|
||||
if (instance.options.collectionType === 'tvshows') {
|
||||
if (query.IncludeArtists) {
|
||||
allowSearch = false;
|
||||
}
|
||||
else if (queryIncludeItemTypes === 'Movie' ||
|
||||
queryIncludeItemTypes === 'LiveTvProgram' ||
|
||||
queryIncludeItemTypes === 'MusicAlbum' ||
|
||||
queryIncludeItemTypes === 'Audio' ||
|
||||
queryIncludeItemTypes === 'Book' ||
|
||||
queryIncludeItemTypes === 'AudioBook' ||
|
||||
queryIncludeItemTypes === 'Playlist' ||
|
||||
queryIncludeItemTypes === 'PhotoAlbum' ||
|
||||
query.MediaTypes === 'Video' ||
|
||||
query.MediaTypes === 'Photo') {
|
||||
allowSearch = false;
|
||||
}
|
||||
}
|
||||
else if (instance.options.collectionType === 'movies') {
|
||||
if (query.IncludeArtists) {
|
||||
allowSearch = false;
|
||||
}
|
||||
else if (queryIncludeItemTypes === 'Series' ||
|
||||
queryIncludeItemTypes === 'Episode' ||
|
||||
queryIncludeItemTypes === 'LiveTvProgram' ||
|
||||
queryIncludeItemTypes === 'MusicAlbum' ||
|
||||
queryIncludeItemTypes === 'Audio' ||
|
||||
queryIncludeItemTypes === 'Book' ||
|
||||
queryIncludeItemTypes === 'AudioBook' ||
|
||||
queryIncludeItemTypes === 'Playlist' ||
|
||||
queryIncludeItemTypes === 'PhotoAlbum' ||
|
||||
query.MediaTypes === 'Video' ||
|
||||
query.MediaTypes === 'Photo') {
|
||||
allowSearch = false;
|
||||
}
|
||||
}
|
||||
else if (instance.options.collectionType === 'music') {
|
||||
if (query.People) {
|
||||
allowSearch = false;
|
||||
}
|
||||
else if (queryIncludeItemTypes === 'Series' ||
|
||||
queryIncludeItemTypes === 'Episode' ||
|
||||
queryIncludeItemTypes === 'LiveTvProgram' ||
|
||||
queryIncludeItemTypes === 'Movie') {
|
||||
allowSearch = false;
|
||||
}
|
||||
}
|
||||
else if (instance.options.collectionType === 'livetv') {
|
||||
if (query.IncludeArtists || query.IncludePeople) {
|
||||
allowSearch = false;
|
||||
}
|
||||
else if (queryIncludeItemTypes === 'Series' ||
|
||||
queryIncludeItemTypes === 'Episode' ||
|
||||
queryIncludeItemTypes === 'MusicAlbum' ||
|
||||
queryIncludeItemTypes === 'Audio' ||
|
||||
queryIncludeItemTypes === 'Book' ||
|
||||
queryIncludeItemTypes === 'AudioBook' ||
|
||||
queryIncludeItemTypes === 'PhotoAlbum' ||
|
||||
queryIncludeItemTypes === 'Movie' ||
|
||||
query.MediaTypes === 'Video' ||
|
||||
query.MediaTypes === 'Photo') {
|
||||
allowSearch = false;
|
||||
}
|
||||
}
|
||||
if (queryIncludeItemTypes === 'NullType') {
|
||||
allowSearch = false;
|
||||
}
|
||||
|
||||
if (!allowSearch) {
|
||||
return Promise.resolve({
|
||||
SearchHints: []
|
||||
});
|
||||
}
|
||||
|
||||
// Convert the search hint query to a regular item query
|
||||
if (apiClient.isMinServerVersion('3.4.1.31')) {
|
||||
|
||||
query.Fields = 'PrimaryImageAspectRatio,CanDelete,BasicSyncInfo,MediaSourceCount';
|
||||
query.Recursive = true;
|
||||
query.EnableTotalRecordCount = false;
|
||||
query.ImageTypeLimit = 1;
|
||||
|
||||
var methodName = 'getItems';
|
||||
|
||||
if (!query.IncludeMedia) {
|
||||
if (query.IncludePeople) {
|
||||
methodName = 'getPeople';
|
||||
|
||||
} else if (query.IncludeArtists) {
|
||||
methodName = 'getArtists';
|
||||
}
|
||||
}
|
||||
|
||||
return apiClient[methodName](apiClient.getCurrentUserId(), query);
|
||||
}
|
||||
|
||||
query.UserId = apiClient.getCurrentUserId();
|
||||
|
||||
return apiClient.getSearchHints(query);
|
||||
}
|
||||
|
||||
function search(instance, apiClient, context, value) {
|
||||
value || layoutManager.tv ? (instance.mode = "search", context.querySelector(".searchSuggestions").classList.add("hide")) : (instance.mode = "suggestions", loadSuggestions(instance, context, apiClient)), "livetv" === instance.options.collectionType ? searchType(instance, apiClient, {
|
||||
|
||||
if (value || layoutManager.tv) {
|
||||
instance.mode = 'search';
|
||||
context.querySelector('.searchSuggestions').classList.add('hide');
|
||||
} else {
|
||||
instance.mode = 'suggestions';
|
||||
loadSuggestions(instance, context, apiClient);
|
||||
}
|
||||
|
||||
if (instance.options.collectionType === 'livetv') {
|
||||
|
||||
searchType(instance, apiClient, {
|
||||
searchTerm: value,
|
||||
IncludePeople: false,
|
||||
IncludeMedia: true,
|
||||
IncludeGenres: false,
|
||||
IncludeStudios: false,
|
||||
IncludeArtists: false,
|
||||
IncludeItemTypes: "LiveTvProgram",
|
||||
IsMovie: true,
|
||||
IsKids: false,
|
||||
IsNews: false
|
||||
|
||||
}, context, '.movieResults', {
|
||||
|
||||
preferThumb: true,
|
||||
inheritThumb: false,
|
||||
shape: (enableScrollX() ? 'overflowPortrait' : 'portrait'),
|
||||
showParentTitleOrTitle: true,
|
||||
showTitle: false,
|
||||
centerText: true,
|
||||
coverImage: true,
|
||||
overlayText: false,
|
||||
overlayMoreButton: true,
|
||||
showAirTime: true,
|
||||
showAirDateTime: true,
|
||||
showChannelName: true
|
||||
});
|
||||
} else {
|
||||
|
||||
searchType(instance, apiClient, {
|
||||
searchTerm: value,
|
||||
IncludePeople: false,
|
||||
IncludeMedia: true,
|
||||
IncludeGenres: false,
|
||||
IncludeStudios: false,
|
||||
IncludeArtists: false,
|
||||
IncludeItemTypes: "Movie"
|
||||
|
||||
}, context, '.movieResults', {
|
||||
|
||||
showTitle: true,
|
||||
overlayText: false,
|
||||
centerText: true,
|
||||
showYear: true
|
||||
});
|
||||
}
|
||||
|
||||
searchType(instance, apiClient, {
|
||||
searchTerm: value,
|
||||
IncludePeople: !1,
|
||||
IncludeMedia: !0,
|
||||
IncludeGenres: !1,
|
||||
IncludeStudios: !1,
|
||||
IncludeArtists: !1,
|
||||
IncludeItemTypes: "LiveTvProgram",
|
||||
IsMovie: !0,
|
||||
IsKids: !1,
|
||||
IsNews: !1
|
||||
}, context, ".movieResults", {
|
||||
preferThumb: !0,
|
||||
inheritThumb: !1,
|
||||
shape: enableScrollX() ? "overflowPortrait" : "portrait",
|
||||
showParentTitleOrTitle: !0,
|
||||
showTitle: !1,
|
||||
centerText: !0,
|
||||
coverImage: !0,
|
||||
overlayText: !1,
|
||||
overlayMoreButton: !0,
|
||||
showAirTime: !0,
|
||||
showAirDateTime: !0,
|
||||
showChannelName: !0
|
||||
}) : searchType(instance, apiClient, {
|
||||
searchTerm: value,
|
||||
IncludePeople: !1,
|
||||
IncludeMedia: !0,
|
||||
IncludeGenres: !1,
|
||||
IncludeStudios: !1,
|
||||
IncludeArtists: !1,
|
||||
IncludeItemTypes: "Movie"
|
||||
}, context, ".movieResults", {
|
||||
showTitle: !0,
|
||||
overlayText: !1,
|
||||
centerText: !0,
|
||||
showYear: !0
|
||||
}), searchType(instance, apiClient, {
|
||||
searchTerm: value,
|
||||
IncludePeople: !1,
|
||||
IncludeMedia: !0,
|
||||
IncludeGenres: !1,
|
||||
IncludeStudios: !1,
|
||||
IncludeArtists: !1,
|
||||
IncludePeople: false,
|
||||
IncludeMedia: true,
|
||||
IncludeGenres: false,
|
||||
IncludeStudios: false,
|
||||
IncludeArtists: false,
|
||||
IncludeItemTypes: "Series"
|
||||
}, context, ".seriesResults", {
|
||||
showTitle: !0,
|
||||
overlayText: !1,
|
||||
centerText: !0,
|
||||
showYear: !0
|
||||
}), "livetv" === instance.options.collectionType ? searchType(instance, apiClient, {
|
||||
|
||||
}, context, '.seriesResults', {
|
||||
|
||||
showTitle: true,
|
||||
overlayText: false,
|
||||
centerText: true,
|
||||
showYear: true
|
||||
});
|
||||
|
||||
if (instance.options.collectionType === 'livetv') {
|
||||
|
||||
searchType(instance, apiClient, {
|
||||
searchTerm: value,
|
||||
IncludePeople: false,
|
||||
IncludeMedia: true,
|
||||
IncludeGenres: false,
|
||||
IncludeStudios: false,
|
||||
IncludeArtists: false,
|
||||
IncludeItemTypes: "LiveTvProgram",
|
||||
IsSeries: true,
|
||||
IsSports: false,
|
||||
IsKids: false,
|
||||
IsNews: false
|
||||
|
||||
}, context, '.episodeResults', {
|
||||
|
||||
preferThumb: true,
|
||||
inheritThumb: false,
|
||||
shape: (enableScrollX() ? 'overflowBackdrop' : 'backdrop'),
|
||||
showParentTitleOrTitle: true,
|
||||
showTitle: false,
|
||||
centerText: true,
|
||||
coverImage: true,
|
||||
overlayText: false,
|
||||
overlayMoreButton: true,
|
||||
showAirTime: true,
|
||||
showAirDateTime: true,
|
||||
showChannelName: true
|
||||
});
|
||||
|
||||
} else {
|
||||
|
||||
searchType(instance, apiClient, {
|
||||
searchTerm: value,
|
||||
IncludePeople: false,
|
||||
IncludeMedia: true,
|
||||
IncludeGenres: false,
|
||||
IncludeStudios: false,
|
||||
IncludeArtists: false,
|
||||
IncludeItemTypes: "Episode"
|
||||
|
||||
}, context, '.episodeResults', {
|
||||
|
||||
coverImage: true,
|
||||
showTitle: true,
|
||||
showParentTitle: true
|
||||
});
|
||||
}
|
||||
|
||||
searchType(instance, apiClient, {
|
||||
searchTerm: value,
|
||||
IncludePeople: !1,
|
||||
IncludeMedia: !0,
|
||||
IncludeGenres: !1,
|
||||
IncludeStudios: !1,
|
||||
IncludeArtists: !1,
|
||||
IncludePeople: false,
|
||||
IncludeMedia: true,
|
||||
IncludeGenres: false,
|
||||
IncludeStudios: false,
|
||||
IncludeArtists: false,
|
||||
// NullType to hide
|
||||
IncludeItemTypes: instance.options.collectionType === 'livetv' ? 'LiveTvProgram' : 'NullType',
|
||||
IsSports: true
|
||||
|
||||
}, context, '.sportsResults', {
|
||||
|
||||
preferThumb: true,
|
||||
inheritThumb: false,
|
||||
shape: (enableScrollX() ? 'overflowBackdrop' : 'backdrop'),
|
||||
showParentTitleOrTitle: true,
|
||||
showTitle: false,
|
||||
centerText: true,
|
||||
coverImage: true,
|
||||
overlayText: false,
|
||||
overlayMoreButton: true,
|
||||
showAirTime: true,
|
||||
showAirDateTime: true,
|
||||
showChannelName: true
|
||||
|
||||
});
|
||||
|
||||
searchType(instance, apiClient, {
|
||||
searchTerm: value,
|
||||
IncludePeople: false,
|
||||
IncludeMedia: true,
|
||||
IncludeGenres: false,
|
||||
IncludeStudios: false,
|
||||
IncludeArtists: false,
|
||||
// NullType to hide
|
||||
IncludeItemTypes: instance.options.collectionType === 'livetv' ? 'LiveTvProgram' : 'NullType',
|
||||
IsKids: true
|
||||
|
||||
}, context, '.kidsResults', {
|
||||
|
||||
preferThumb: true,
|
||||
inheritThumb: false,
|
||||
shape: (enableScrollX() ? 'overflowBackdrop' : 'backdrop'),
|
||||
showParentTitleOrTitle: true,
|
||||
showTitle: false,
|
||||
centerText: true,
|
||||
coverImage: true,
|
||||
overlayText: false,
|
||||
overlayMoreButton: true,
|
||||
showAirTime: true,
|
||||
showAirDateTime: true,
|
||||
showChannelName: true
|
||||
|
||||
});
|
||||
|
||||
searchType(instance, apiClient, {
|
||||
searchTerm: value,
|
||||
IncludePeople: false,
|
||||
IncludeMedia: true,
|
||||
IncludeGenres: false,
|
||||
IncludeStudios: false,
|
||||
IncludeArtists: false,
|
||||
// NullType to hide
|
||||
IncludeItemTypes: instance.options.collectionType === 'livetv' ? 'LiveTvProgram' : 'NullType',
|
||||
IsNews: true
|
||||
|
||||
}, context, '.newsResults', {
|
||||
|
||||
preferThumb: true,
|
||||
inheritThumb: false,
|
||||
shape: (enableScrollX() ? 'overflowBackdrop' : 'backdrop'),
|
||||
showParentTitleOrTitle: true,
|
||||
showTitle: false,
|
||||
centerText: true,
|
||||
coverImage: true,
|
||||
overlayText: false,
|
||||
overlayMoreButton: true,
|
||||
showAirTime: true,
|
||||
showAirDateTime: true,
|
||||
showChannelName: true
|
||||
|
||||
});
|
||||
|
||||
searchType(instance, apiClient, {
|
||||
searchTerm: value,
|
||||
IncludePeople: false,
|
||||
IncludeMedia: true,
|
||||
IncludeGenres: false,
|
||||
IncludeStudios: false,
|
||||
IncludeArtists: false,
|
||||
IncludeItemTypes: "LiveTvProgram",
|
||||
IsSeries: !0,
|
||||
IsSports: !1,
|
||||
IsKids: !1,
|
||||
IsNews: !1
|
||||
}, context, ".episodeResults", {
|
||||
preferThumb: !0,
|
||||
inheritThumb: !1,
|
||||
shape: enableScrollX() ? "overflowBackdrop" : "backdrop",
|
||||
showParentTitleOrTitle: !0,
|
||||
showTitle: !1,
|
||||
centerText: !0,
|
||||
coverImage: !0,
|
||||
overlayText: !1,
|
||||
overlayMoreButton: !0,
|
||||
showAirTime: !0,
|
||||
showAirDateTime: !0,
|
||||
showChannelName: !0
|
||||
}) : searchType(instance, apiClient, {
|
||||
IsMovie: instance.options.collectionType === 'livetv' ? false : null,
|
||||
IsSeries: instance.options.collectionType === 'livetv' ? false : null,
|
||||
IsSports: instance.options.collectionType === 'livetv' ? false : null,
|
||||
IsKids: instance.options.collectionType === 'livetv' ? false : null,
|
||||
IsNews: instance.options.collectionType === 'livetv' ? false : null
|
||||
|
||||
}, context, '.programResults', {
|
||||
|
||||
preferThumb: true,
|
||||
inheritThumb: false,
|
||||
shape: (enableScrollX() ? 'overflowBackdrop' : 'backdrop'),
|
||||
showParentTitleOrTitle: true,
|
||||
showTitle: false,
|
||||
centerText: true,
|
||||
coverImage: true,
|
||||
overlayText: false,
|
||||
overlayMoreButton: true,
|
||||
showAirTime: true,
|
||||
showAirDateTime: true,
|
||||
showChannelName: true
|
||||
|
||||
});
|
||||
|
||||
searchType(instance, apiClient, {
|
||||
searchTerm: value,
|
||||
IncludePeople: !1,
|
||||
IncludeMedia: !0,
|
||||
IncludeGenres: !1,
|
||||
IncludeStudios: !1,
|
||||
IncludeArtists: !1,
|
||||
IncludeItemTypes: "Episode"
|
||||
}, context, ".episodeResults", {
|
||||
coverImage: !0,
|
||||
showTitle: !0,
|
||||
showParentTitle: !0
|
||||
}), searchType(instance, apiClient, {
|
||||
searchTerm: value,
|
||||
IncludePeople: !1,
|
||||
IncludeMedia: !0,
|
||||
IncludeGenres: !1,
|
||||
IncludeStudios: !1,
|
||||
IncludeArtists: !1,
|
||||
IncludeItemTypes: "livetv" === instance.options.collectionType ? "LiveTvProgram" : "NullType",
|
||||
IsSports: !0
|
||||
}, context, ".sportsResults", {
|
||||
preferThumb: !0,
|
||||
inheritThumb: !1,
|
||||
shape: enableScrollX() ? "overflowBackdrop" : "backdrop",
|
||||
showParentTitleOrTitle: !0,
|
||||
showTitle: !1,
|
||||
centerText: !0,
|
||||
coverImage: !0,
|
||||
overlayText: !1,
|
||||
overlayMoreButton: !0,
|
||||
showAirTime: !0,
|
||||
showAirDateTime: !0,
|
||||
showChannelName: !0
|
||||
}), searchType(instance, apiClient, {
|
||||
searchTerm: value,
|
||||
IncludePeople: !1,
|
||||
IncludeMedia: !0,
|
||||
IncludeGenres: !1,
|
||||
IncludeStudios: !1,
|
||||
IncludeArtists: !1,
|
||||
IncludeItemTypes: "livetv" === instance.options.collectionType ? "LiveTvProgram" : "NullType",
|
||||
IsKids: !0
|
||||
}, context, ".kidsResults", {
|
||||
preferThumb: !0,
|
||||
inheritThumb: !1,
|
||||
shape: enableScrollX() ? "overflowBackdrop" : "backdrop",
|
||||
showParentTitleOrTitle: !0,
|
||||
showTitle: !1,
|
||||
centerText: !0,
|
||||
coverImage: !0,
|
||||
overlayText: !1,
|
||||
overlayMoreButton: !0,
|
||||
showAirTime: !0,
|
||||
showAirDateTime: !0,
|
||||
showChannelName: !0
|
||||
}), searchType(instance, apiClient, {
|
||||
searchTerm: value,
|
||||
IncludePeople: !1,
|
||||
IncludeMedia: !0,
|
||||
IncludeGenres: !1,
|
||||
IncludeStudios: !1,
|
||||
IncludeArtists: !1,
|
||||
IncludeItemTypes: "livetv" === instance.options.collectionType ? "LiveTvProgram" : "NullType",
|
||||
IsNews: !0
|
||||
}, context, ".newsResults", {
|
||||
preferThumb: !0,
|
||||
inheritThumb: !1,
|
||||
shape: enableScrollX() ? "overflowBackdrop" : "backdrop",
|
||||
showParentTitleOrTitle: !0,
|
||||
showTitle: !1,
|
||||
centerText: !0,
|
||||
coverImage: !0,
|
||||
overlayText: !1,
|
||||
overlayMoreButton: !0,
|
||||
showAirTime: !0,
|
||||
showAirDateTime: !0,
|
||||
showChannelName: !0
|
||||
}), searchType(instance, apiClient, {
|
||||
searchTerm: value,
|
||||
IncludePeople: !1,
|
||||
IncludeMedia: !0,
|
||||
IncludeGenres: !1,
|
||||
IncludeStudios: !1,
|
||||
IncludeArtists: !1,
|
||||
IncludeItemTypes: "LiveTvProgram",
|
||||
IsMovie: "livetv" !== instance.options.collectionType && null,
|
||||
IsSeries: "livetv" !== instance.options.collectionType && null,
|
||||
IsSports: "livetv" !== instance.options.collectionType && null,
|
||||
IsKids: "livetv" !== instance.options.collectionType && null,
|
||||
IsNews: "livetv" !== instance.options.collectionType && null
|
||||
}, context, ".programResults", {
|
||||
preferThumb: !0,
|
||||
inheritThumb: !1,
|
||||
shape: enableScrollX() ? "overflowBackdrop" : "backdrop",
|
||||
showParentTitleOrTitle: !0,
|
||||
showTitle: !1,
|
||||
centerText: !0,
|
||||
coverImage: !0,
|
||||
overlayText: !1,
|
||||
overlayMoreButton: !0,
|
||||
showAirTime: !0,
|
||||
showAirDateTime: !0,
|
||||
showChannelName: !0
|
||||
}), searchType(instance, apiClient, {
|
||||
searchTerm: value,
|
||||
IncludePeople: !1,
|
||||
IncludeMedia: !0,
|
||||
IncludeGenres: !1,
|
||||
IncludeStudios: !1,
|
||||
IncludeArtists: !1,
|
||||
IncludePeople: false,
|
||||
IncludeMedia: true,
|
||||
IncludeGenres: false,
|
||||
IncludeStudios: false,
|
||||
IncludeArtists: false,
|
||||
MediaTypes: "Video",
|
||||
ExcludeItemTypes: "Movie,Episode"
|
||||
}, context, ".videoResults", {
|
||||
showParentTitle: !0,
|
||||
showTitle: !0,
|
||||
overlayText: !1,
|
||||
centerText: !0
|
||||
}), searchType(instance, apiClient, {
|
||||
|
||||
}, context, '.videoResults', {
|
||||
|
||||
showParentTitle: true,
|
||||
showTitle: true,
|
||||
overlayText: false,
|
||||
centerText: true
|
||||
});
|
||||
|
||||
searchType(instance, apiClient, {
|
||||
searchTerm: value,
|
||||
IncludePeople: !0,
|
||||
IncludeMedia: !1,
|
||||
IncludeGenres: !1,
|
||||
IncludeStudios: !1,
|
||||
IncludeArtists: !1
|
||||
}, context, ".peopleResults", {
|
||||
coverImage: !0,
|
||||
showTitle: !0
|
||||
}), searchType(instance, apiClient, {
|
||||
IncludePeople: true,
|
||||
IncludeMedia: false,
|
||||
IncludeGenres: false,
|
||||
IncludeStudios: false,
|
||||
IncludeArtists: false
|
||||
|
||||
}, context, '.peopleResults', {
|
||||
|
||||
coverImage: true,
|
||||
showTitle: true
|
||||
});
|
||||
|
||||
searchType(instance, apiClient, {
|
||||
searchTerm: value,
|
||||
IncludePeople: !1,
|
||||
IncludeMedia: !1,
|
||||
IncludeGenres: !1,
|
||||
IncludeStudios: !1,
|
||||
IncludeArtists: !0
|
||||
}, context, ".artistResults", {
|
||||
coverImage: !0,
|
||||
showTitle: !0
|
||||
}), searchType(instance, apiClient, {
|
||||
IncludePeople: false,
|
||||
IncludeMedia: false,
|
||||
IncludeGenres: false,
|
||||
IncludeStudios: false,
|
||||
IncludeArtists: true
|
||||
|
||||
}, context, '.artistResults', {
|
||||
coverImage: true,
|
||||
showTitle: true
|
||||
});
|
||||
|
||||
searchType(instance, apiClient, {
|
||||
searchTerm: value,
|
||||
IncludePeople: !1,
|
||||
IncludeMedia: !0,
|
||||
IncludeGenres: !1,
|
||||
IncludeStudios: !1,
|
||||
IncludeArtists: !1,
|
||||
IncludePeople: false,
|
||||
IncludeMedia: true,
|
||||
IncludeGenres: false,
|
||||
IncludeStudios: false,
|
||||
IncludeArtists: false,
|
||||
IncludeItemTypes: "MusicAlbum"
|
||||
}, context, ".albumResults", {
|
||||
showParentTitle: !0,
|
||||
showTitle: !0,
|
||||
overlayText: !1,
|
||||
centerText: !0
|
||||
}), searchType(instance, apiClient, {
|
||||
|
||||
}, context, '.albumResults', {
|
||||
|
||||
showParentTitle: true,
|
||||
showTitle: true,
|
||||
overlayText: false,
|
||||
centerText: true
|
||||
});
|
||||
|
||||
searchType(instance, apiClient, {
|
||||
searchTerm: value,
|
||||
IncludePeople: !1,
|
||||
IncludeMedia: !0,
|
||||
IncludeGenres: !1,
|
||||
IncludeStudios: !1,
|
||||
IncludeArtists: !1,
|
||||
IncludePeople: false,
|
||||
IncludeMedia: true,
|
||||
IncludeGenres: false,
|
||||
IncludeStudios: false,
|
||||
IncludeArtists: false,
|
||||
IncludeItemTypes: "Audio"
|
||||
}, context, ".songResults", {
|
||||
showParentTitle: !0,
|
||||
showTitle: !0,
|
||||
overlayText: !1,
|
||||
centerText: !0,
|
||||
action: "play"
|
||||
}), searchType(instance, apiClient, {
|
||||
|
||||
}, context, '.songResults', {
|
||||
|
||||
showParentTitle: true,
|
||||
showTitle: true,
|
||||
overlayText: false,
|
||||
centerText: true,
|
||||
action: 'play'
|
||||
|
||||
});
|
||||
|
||||
searchType(instance, apiClient, {
|
||||
searchTerm: value,
|
||||
IncludePeople: !1,
|
||||
IncludeMedia: !0,
|
||||
IncludeGenres: !1,
|
||||
IncludeStudios: !1,
|
||||
IncludeArtists: !1,
|
||||
IncludePeople: false,
|
||||
IncludeMedia: true,
|
||||
IncludeGenres: false,
|
||||
IncludeStudios: false,
|
||||
IncludeArtists: false,
|
||||
MediaTypes: "Photo"
|
||||
}, context, ".photoResults", {
|
||||
showParentTitle: !1,
|
||||
showTitle: !0,
|
||||
overlayText: !1,
|
||||
centerText: !0
|
||||
}), searchType(instance, apiClient, {
|
||||
|
||||
}, context, '.photoResults', {
|
||||
|
||||
showParentTitle: false,
|
||||
showTitle: true,
|
||||
overlayText: false,
|
||||
centerText: true
|
||||
});
|
||||
|
||||
searchType(instance, apiClient, {
|
||||
searchTerm: value,
|
||||
IncludePeople: !1,
|
||||
IncludeMedia: !0,
|
||||
IncludeGenres: !1,
|
||||
IncludeStudios: !1,
|
||||
IncludeArtists: !1,
|
||||
IncludePeople: false,
|
||||
IncludeMedia: true,
|
||||
IncludeGenres: false,
|
||||
IncludeStudios: false,
|
||||
IncludeArtists: false,
|
||||
IncludeItemTypes: "PhotoAlbum"
|
||||
}, context, ".photoAlbumResults", {
|
||||
showTitle: !0,
|
||||
overlayText: !1,
|
||||
centerText: !0
|
||||
}), searchType(instance, apiClient, {
|
||||
|
||||
}, context, '.photoAlbumResults', {
|
||||
|
||||
showTitle: true,
|
||||
overlayText: false,
|
||||
centerText: true
|
||||
});
|
||||
|
||||
searchType(instance, apiClient, {
|
||||
searchTerm: value,
|
||||
IncludePeople: !1,
|
||||
IncludeMedia: !0,
|
||||
IncludeGenres: !1,
|
||||
IncludeStudios: !1,
|
||||
IncludeArtists: !1,
|
||||
IncludePeople: false,
|
||||
IncludeMedia: true,
|
||||
IncludeGenres: false,
|
||||
IncludeStudios: false,
|
||||
IncludeArtists: false,
|
||||
IncludeItemTypes: "Book"
|
||||
}, context, ".bookResults", {
|
||||
showTitle: !0,
|
||||
overlayText: !1,
|
||||
centerText: !0
|
||||
}), searchType(instance, apiClient, {
|
||||
|
||||
}, context, '.bookResults', {
|
||||
|
||||
showTitle: true,
|
||||
overlayText: false,
|
||||
centerText: true
|
||||
|
||||
});
|
||||
|
||||
searchType(instance, apiClient, {
|
||||
searchTerm: value,
|
||||
IncludePeople: !1,
|
||||
IncludeMedia: !0,
|
||||
IncludeGenres: !1,
|
||||
IncludeStudios: !1,
|
||||
IncludeArtists: !1,
|
||||
IncludePeople: false,
|
||||
IncludeMedia: true,
|
||||
IncludeGenres: false,
|
||||
IncludeStudios: false,
|
||||
IncludeArtists: false,
|
||||
IncludeItemTypes: "AudioBook"
|
||||
}, context, ".audioBookResults", {
|
||||
showTitle: !0,
|
||||
overlayText: !1,
|
||||
centerText: !0
|
||||
}), searchType(instance, apiClient, {
|
||||
|
||||
}, context, '.audioBookResults', {
|
||||
|
||||
showTitle: true,
|
||||
overlayText: false,
|
||||
centerText: true
|
||||
});
|
||||
|
||||
searchType(instance, apiClient, {
|
||||
searchTerm: value,
|
||||
IncludePeople: !1,
|
||||
IncludeMedia: !0,
|
||||
IncludeGenres: !1,
|
||||
IncludeStudios: !1,
|
||||
IncludeArtists: !1,
|
||||
IncludePeople: false,
|
||||
IncludeMedia: true,
|
||||
IncludeGenres: false,
|
||||
IncludeStudios: false,
|
||||
IncludeArtists: false,
|
||||
IncludeItemTypes: "Playlist"
|
||||
}, context, ".playlistResults", {
|
||||
showTitle: !0,
|
||||
overlayText: !1,
|
||||
centerText: !0
|
||||
})
|
||||
|
||||
}, context, '.playlistResults', {
|
||||
|
||||
showTitle: true,
|
||||
overlayText: false,
|
||||
centerText: true
|
||||
});
|
||||
}
|
||||
|
||||
function searchType(instance, apiClient, query, context, section, cardOptions) {
|
||||
query.Limit = enableScrollX() ? 24 : 16, query.ParentId = instance.options.parentId, getSearchHints(instance, apiClient, query).then(function(result) {
|
||||
populateResults(result, context, section, cardOptions)
|
||||
})
|
||||
|
||||
query.Limit = enableScrollX() ? 24 : 16;
|
||||
query.ParentId = instance.options.parentId;
|
||||
|
||||
getSearchHints(instance, apiClient, query).then(function (result) {
|
||||
|
||||
populateResults(result, context, section, cardOptions);
|
||||
});
|
||||
}
|
||||
|
||||
function populateResults(result, context, section, cardOptions) {
|
||||
|
||||
section = context.querySelector(section);
|
||||
var items = result.Items || result.SearchHints,
|
||||
itemsContainer = section.querySelector(".itemsContainer");
|
||||
|
||||
var items = result.Items || result.SearchHints;
|
||||
|
||||
var itemsContainer = section.querySelector('.itemsContainer');
|
||||
|
||||
cardBuilder.buildCards(items, Object.assign({
|
||||
|
||||
itemsContainer: itemsContainer,
|
||||
parentContainer: section,
|
||||
shape: enableScrollX() ? "autooverflow" : "auto",
|
||||
scalable: !0,
|
||||
overlayText: !1,
|
||||
centerText: !0,
|
||||
shape: enableScrollX() ? 'autooverflow' : 'auto',
|
||||
scalable: true,
|
||||
overlayText: false,
|
||||
centerText: true,
|
||||
allowBottomPadding: !enableScrollX()
|
||||
}, cardOptions || {})), section.querySelector(".emby-scroller").scrollToBeginning(!0)
|
||||
|
||||
}, cardOptions || {}));
|
||||
|
||||
section.querySelector('.emby-scroller').scrollToBeginning(true);
|
||||
}
|
||||
|
||||
function enableScrollX() {
|
||||
return !0
|
||||
return true;
|
||||
}
|
||||
|
||||
function replaceAll(originalString, strReplace, strWith) {
|
||||
var reg = new RegExp(strReplace, "ig");
|
||||
return originalString.replace(reg, strWith)
|
||||
var reg = new RegExp(strReplace, 'ig');
|
||||
return originalString.replace(reg, strWith);
|
||||
}
|
||||
|
||||
function embed(elem, instance, options) {
|
||||
require(["text!./searchresults.template.html"], function(template) {
|
||||
enableScrollX() || (template = replaceAll(template, 'data-horizontal="true"', 'data-horizontal="false"'), template = replaceAll(template, "itemsContainer scrollSlider", "itemsContainer scrollSlider vertical-wrap"));
|
||||
var html = globalize.translateDocument(template, "sharedcomponents");
|
||||
elem.innerHTML = html, elem.classList.add("searchResults"), instance.search("")
|
||||
})
|
||||
|
||||
require(['text!./searchresults.template.html'], function (template) {
|
||||
|
||||
if (!enableScrollX()) {
|
||||
template = replaceAll(template, 'data-horizontal="true"', 'data-horizontal="false"');
|
||||
template = replaceAll(template, 'itemsContainer scrollSlider', 'itemsContainer scrollSlider vertical-wrap');
|
||||
}
|
||||
|
||||
var html = globalize.translateDocument(template, 'sharedcomponents');
|
||||
|
||||
elem.innerHTML = html;
|
||||
|
||||
elem.classList.add('searchResults');
|
||||
instance.search('');
|
||||
});
|
||||
}
|
||||
|
||||
function SearchResults(options) {
|
||||
this.options = options, embed(options.element, this, options)
|
||||
|
||||
this.options = options;
|
||||
embed(options.element, this, options);
|
||||
}
|
||||
return SearchResults.prototype.search = function(value) {
|
||||
search(this, connectionManager.getApiClient(this.options.serverId), this.options.element, value)
|
||||
}, SearchResults.prototype.destroy = function() {
|
||||
|
||||
SearchResults.prototype.search = function (value) {
|
||||
|
||||
var apiClient = connectionManager.getApiClient(this.options.serverId);
|
||||
|
||||
search(this, apiClient, this.options.element, value);
|
||||
};
|
||||
|
||||
SearchResults.prototype.destroy = function () {
|
||||
|
||||
var options = this.options;
|
||||
options && options.element.classList.remove("searchFields"), this.options = null
|
||||
}, SearchResults
|
||||
if (options) {
|
||||
options.element.classList.remove('searchFields');
|
||||
}
|
||||
this.options = null;
|
||||
|
||||
};
|
||||
|
||||
return SearchResults;
|
||||
});
|
Loading…
Add table
Add a link
Reference in a new issue