mirror of
https://github.com/jellyfin/jellyfin-web
synced 2025-03-30 19:56:21 +00:00
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,92 +1,366 @@
|
|||
define(["apphost", "globalize"], function(appHost, globalize) {
|
||||
"use strict";
|
||||
define(['apphost', 'globalize'], function (appHost, globalize) {
|
||||
'use strict';
|
||||
|
||||
function getDisplayName(item, options) {
|
||||
if (!item) throw new Error("null item passed into getDisplayName");
|
||||
options = options || {}, "Timer" === item.Type && (item = item.ProgramInfo || item);
|
||||
var name = ("Program" !== item.Type && "Recording" !== item.Type || !item.IsSeries && !item.EpisodeTitle ? item.Name : item.EpisodeTitle) || "";
|
||||
if ("TvChannel" === item.Type) return item.ChannelNumber ? item.ChannelNumber + " " + name : name;
|
||||
if ("Episode" === item.Type && 0 === item.ParentIndexNumber) name = globalize.translate("sharedcomponents#ValueSpecialEpisodeName", name);
|
||||
else if (("Episode" === item.Type || "Program" === item.Type) && null != item.IndexNumber && null != item.ParentIndexNumber && !1 !== options.includeIndexNumber) {
|
||||
var displayIndexNumber = item.IndexNumber,
|
||||
number = displayIndexNumber,
|
||||
nameSeparator = " - ";
|
||||
!1 !== options.includeParentInfo ? number = "S" + item.ParentIndexNumber + ":E" + number : nameSeparator = ". ", item.IndexNumberEnd && (displayIndexNumber = item.IndexNumberEnd, number += "-" + displayIndexNumber), number && (name = name ? number + nameSeparator + name : number)
|
||||
|
||||
if (!item) {
|
||||
throw new Error("null item passed into getDisplayName");
|
||||
}
|
||||
return name
|
||||
|
||||
options = options || {};
|
||||
|
||||
if (item.Type === 'Timer') {
|
||||
item = item.ProgramInfo || item;
|
||||
}
|
||||
|
||||
var name = ((item.Type === 'Program' || item.Type === 'Recording') && (item.IsSeries || item.EpisodeTitle) ? item.EpisodeTitle : item.Name) || '';
|
||||
|
||||
if (item.Type === "TvChannel") {
|
||||
|
||||
if (item.ChannelNumber) {
|
||||
return item.ChannelNumber + ' ' + name;
|
||||
}
|
||||
return name;
|
||||
}
|
||||
if (/*options.isInlineSpecial &&*/ item.Type === "Episode" && item.ParentIndexNumber === 0) {
|
||||
|
||||
name = globalize.translate('sharedcomponents#ValueSpecialEpisodeName', name);
|
||||
|
||||
} else if ((item.Type === "Episode" || item.Type === 'Program') && item.IndexNumber != null && item.ParentIndexNumber != null && options.includeIndexNumber !== false) {
|
||||
|
||||
var displayIndexNumber = item.IndexNumber;
|
||||
|
||||
var number = displayIndexNumber;
|
||||
var nameSeparator = " - ";
|
||||
|
||||
if (options.includeParentInfo !== false) {
|
||||
number = "S" + item.ParentIndexNumber + ":E" + number;
|
||||
} else {
|
||||
nameSeparator = ". ";
|
||||
}
|
||||
|
||||
if (item.IndexNumberEnd) {
|
||||
|
||||
displayIndexNumber = item.IndexNumberEnd;
|
||||
number += "-" + displayIndexNumber;
|
||||
}
|
||||
|
||||
if (number) {
|
||||
name = name ? (number + nameSeparator + name) : number;
|
||||
}
|
||||
}
|
||||
|
||||
return name;
|
||||
}
|
||||
|
||||
function supportsAddingToCollection(item) {
|
||||
var invalidTypes = ["Genre", "MusicGenre", "Studio", "GameGenre", "UserView", "CollectionFolder", "Audio", "Program", "Timer", "SeriesTimer"];
|
||||
return ("Recording" !== item.Type || "Completed" === item.Status) && (!item.CollectionType && -1 === invalidTypes.indexOf(item.Type) && "Photo" !== item.MediaType && !isLocalItem(item))
|
||||
|
||||
var invalidTypes = ['Genre', 'MusicGenre', 'Studio', 'GameGenre', 'UserView', 'CollectionFolder', 'Audio', 'Program', 'Timer', 'SeriesTimer'];
|
||||
|
||||
if (item.Type === 'Recording') {
|
||||
if (item.Status !== 'Completed') {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return !item.CollectionType && invalidTypes.indexOf(item.Type) === -1 && item.MediaType !== 'Photo' && !isLocalItem(item);
|
||||
}
|
||||
|
||||
function supportsAddingToPlaylist(item) {
|
||||
return "Program" !== item.Type && ("TvChannel" !== item.Type && ("Timer" !== item.Type && ("SeriesTimer" !== item.Type && ("Photo" !== item.MediaType && (("Recording" !== item.Type || "Completed" === item.Status) && (!isLocalItem(item) && ("livetv" !== item.CollectionType && (item.MediaType || item.IsFolder || "Genre" === item.Type || "MusicGenre" === item.Type || "MusicArtist" === item.Type))))))))
|
||||
|
||||
if (item.Type === 'Program') {
|
||||
return false;
|
||||
}
|
||||
if (item.Type === 'TvChannel') {
|
||||
return false;
|
||||
}
|
||||
if (item.Type === 'Timer') {
|
||||
return false;
|
||||
}
|
||||
if (item.Type === 'SeriesTimer') {
|
||||
return false;
|
||||
}
|
||||
if (item.MediaType === 'Photo') {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (item.Type === 'Recording') {
|
||||
if (item.Status !== 'Completed') {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if (isLocalItem(item)) {
|
||||
return false;
|
||||
}
|
||||
if (item.CollectionType === 'livetv') {
|
||||
return false;
|
||||
}
|
||||
|
||||
return item.MediaType || item.IsFolder || item.Type === "Genre" || item.Type === "MusicGenre" || item.Type === "MusicArtist";
|
||||
}
|
||||
|
||||
function canEdit(user, item) {
|
||||
|
||||
var itemType = item.Type;
|
||||
return "UserRootFolder" !== itemType && "UserView" !== itemType && ("Program" !== itemType && ("Timer" !== itemType && ("SeriesTimer" !== itemType && (("Recording" !== item.Type || "Completed" === item.Status) && (!isLocalItem(item) && user.Policy.IsAdministrator)))))
|
||||
|
||||
if (itemType === "UserRootFolder" || /*itemType == "CollectionFolder" ||*/ itemType === "UserView") {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (itemType === 'Program') {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (itemType === 'Timer') {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (itemType === 'SeriesTimer') {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (item.Type === 'Recording') {
|
||||
if (item.Status !== 'Completed') {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if (isLocalItem(item)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return user.Policy.IsAdministrator;
|
||||
}
|
||||
|
||||
function isLocalItem(item) {
|
||||
return !(!item || !item.Id || 0 !== item.Id.indexOf("local"))
|
||||
|
||||
if (item && item.Id && item.Id.indexOf('local') === 0) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
return {
|
||||
getDisplayName: getDisplayName,
|
||||
supportsAddingToCollection: supportsAddingToCollection,
|
||||
supportsAddingToPlaylist: supportsAddingToPlaylist,
|
||||
isLocalItem: isLocalItem,
|
||||
canIdentify: function(user, item) {
|
||||
|
||||
canIdentify: function (user, item) {
|
||||
|
||||
var itemType = item.Type;
|
||||
return !("Movie" !== itemType && "Trailer" !== itemType && "Series" !== itemType && "Game" !== itemType && "BoxSet" !== itemType && "Person" !== itemType && "Book" !== itemType && "MusicAlbum" !== itemType && "MusicArtist" !== itemType && "MusicVideo" !== itemType || !user.Policy.IsAdministrator || isLocalItem(item))
|
||||
|
||||
if (itemType === "Movie" ||
|
||||
itemType === "Trailer" ||
|
||||
itemType === "Series" ||
|
||||
itemType === "Game" ||
|
||||
itemType === "BoxSet" ||
|
||||
itemType === "Person" ||
|
||||
itemType === "Book" ||
|
||||
itemType === "MusicAlbum" ||
|
||||
itemType === "MusicArtist" ||
|
||||
itemType === "MusicVideo") {
|
||||
|
||||
if (user.Policy.IsAdministrator) {
|
||||
|
||||
if (!isLocalItem(item)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
},
|
||||
|
||||
canEdit: canEdit,
|
||||
canEditImages: function(user, item) {
|
||||
|
||||
canEditImages: function (user, item) {
|
||||
|
||||
var itemType = item.Type;
|
||||
return "Photo" !== item.MediaType && ("UserView" === itemType ? !!user.Policy.IsAdministrator : ("Recording" !== item.Type || "Completed" === item.Status) && ("Timer" !== itemType && "SeriesTimer" !== itemType && canEdit(user, item) && !isLocalItem(item)))
|
||||
},
|
||||
canSync: function(user, item) {
|
||||
return !(user && !user.Policy.EnableContentDownloading) && (!isLocalItem(item) && item.SupportsSync)
|
||||
},
|
||||
canShare: function(item, user) {
|
||||
return "Program" !== item.Type && ("TvChannel" !== item.Type && ("Timer" !== item.Type && ("SeriesTimer" !== item.Type && (("Recording" !== item.Type || "Completed" === item.Status) && (!isLocalItem(item) && (user.Policy.EnablePublicSharing && appHost.supports("sharing")))))))
|
||||
},
|
||||
enableDateAddedDisplay: function(item) {
|
||||
return !item.IsFolder && item.MediaType && "Program" !== item.Type && "TvChannel" !== item.Type && "Trailer" !== item.Type
|
||||
},
|
||||
canMarkPlayed: function(item) {
|
||||
if ("Program" === item.Type) return !1;
|
||||
if ("Video" === item.MediaType) {
|
||||
if ("TvChannel" !== item.Type) return !0
|
||||
} else if ("Audio" === item.MediaType) {
|
||||
if ("AudioPodcast" === item.Type) return !0;
|
||||
if ("AudioBook" === item.Type) return !0
|
||||
|
||||
if (item.MediaType === 'Photo') {
|
||||
return false;
|
||||
}
|
||||
return "Series" === item.Type || "Season" === item.Type || "BoxSet" === item.Type || "Game" === item.MediaType || "Book" === item.MediaType || "Recording" === item.MediaType
|
||||
|
||||
if (itemType === 'UserView') {
|
||||
if (user.Policy.IsAdministrator) {
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
if (item.Type === 'Recording') {
|
||||
if (item.Status !== 'Completed') {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return itemType !== 'Timer' && itemType !== 'SeriesTimer' && canEdit(user, item) && !isLocalItem(item);
|
||||
},
|
||||
canRate: function(item) {
|
||||
return "Program" !== item.Type && "Timer" !== item.Type && "SeriesTimer" !== item.Type && "CollectionFolder" !== item.Type && "UserView" !== item.Type && "Channel" !== item.Type && "Season" !== item.Type && "Studio" !== item.Type && !!item.UserData
|
||||
|
||||
canSync: function (user, item) {
|
||||
|
||||
if (user && !user.Policy.EnableContentDownloading) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (isLocalItem(item)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return item.SupportsSync;
|
||||
},
|
||||
canConvert: function(item, user) {
|
||||
if (!user.Policy.EnableMediaConversion) return !1;
|
||||
if (isLocalItem(item)) return !1;
|
||||
|
||||
canShare: function (item, user) {
|
||||
|
||||
if (item.Type === 'Program') {
|
||||
return false;
|
||||
}
|
||||
if (item.Type === 'TvChannel') {
|
||||
return false;
|
||||
}
|
||||
if (item.Type === 'Timer') {
|
||||
return false;
|
||||
}
|
||||
if (item.Type === 'SeriesTimer') {
|
||||
return false;
|
||||
}
|
||||
if (item.Type === 'Recording') {
|
||||
if (item.Status !== 'Completed') {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
if (isLocalItem(item)) {
|
||||
return false;
|
||||
}
|
||||
return user.Policy.EnablePublicSharing && appHost.supports('sharing');
|
||||
},
|
||||
|
||||
enableDateAddedDisplay: function (item) {
|
||||
return !item.IsFolder && item.MediaType && item.Type !== 'Program' && item.Type !== 'TvChannel' && item.Type !== 'Trailer';
|
||||
},
|
||||
|
||||
canMarkPlayed: function (item) {
|
||||
|
||||
if (item.Type === 'Program') {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (item.MediaType === 'Video') {
|
||||
if (item.Type !== 'TvChannel') {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
else if (item.MediaType === 'Audio') {
|
||||
if (item.Type === 'AudioPodcast') {
|
||||
return true;
|
||||
}
|
||||
if (item.Type === 'AudioBook') {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
if (item.Type === "Series" ||
|
||||
item.Type === "Season" ||
|
||||
item.Type === "BoxSet" ||
|
||||
item.MediaType === "Game" ||
|
||||
item.MediaType === "Book" ||
|
||||
item.MediaType === "Recording") {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
},
|
||||
|
||||
canRate: function (item) {
|
||||
|
||||
if (item.Type === 'Program' || item.Type === 'Timer' || item.Type === 'SeriesTimer' || item.Type === 'CollectionFolder' || item.Type === 'UserView' || item.Type === 'Channel') {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
},
|
||||
|
||||
canConvert: function (item, user) {
|
||||
|
||||
if (!user.Policy.EnableMediaConversion) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (isLocalItem(item)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
var mediaType = item.MediaType;
|
||||
if ("Book" === mediaType || "Photo" === mediaType || "Game" === mediaType || "Audio" === mediaType) return !1;
|
||||
if ("livetv" === item.CollectionType) return !1;
|
||||
var type = item.Type;
|
||||
return "Channel" !== type && "Person" !== type && "Year" !== type && "Program" !== type && "Timer" !== type && "SeriesTimer" !== type && (!("Virtual" === item.LocationType && !item.IsFolder) && !item.IsPlaceHolder)
|
||||
},
|
||||
canRefreshMetadata: function(item, user) {
|
||||
if (user.Policy.IsAdministrator) {
|
||||
if ("livetv" === item.CollectionType) return !1;
|
||||
if ("Timer" !== item.Type && "SeriesTimer" !== item.Type && "Program" !== item.Type && "TvChannel" !== item.Type && ("Recording" !== item.Type || "Completed" === item.Status) && !isLocalItem(item)) return !0
|
||||
if (mediaType === 'Book' || mediaType === 'Photo' || mediaType === 'Game' || mediaType === 'Audio') {
|
||||
return false;
|
||||
}
|
||||
return !1
|
||||
|
||||
var collectionType = item.CollectionType;
|
||||
if (collectionType === 'livetv') {
|
||||
return false;
|
||||
}
|
||||
|
||||
var type = item.Type;
|
||||
if (type === 'Channel' || type === 'Person' || type === 'Year' || type === 'Program' || type === 'Timer' || type === 'SeriesTimer') {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (item.LocationType === 'Virtual' && !item.IsFolder) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (item.IsPlaceHolder) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
},
|
||||
supportsMediaSourceSelection: function(item) {
|
||||
return "Video" === item.MediaType && ("TvChannel" !== item.Type && (!(!item.MediaSources || 1 === item.MediaSources.length && "Placeholder" === item.MediaSources[0].Type) && (!1 !== item.EnableMediaSourceDisplay && (null != item.EnableMediaSourceDisplay || !item.SourceType || "Library" === item.SourceType))))
|
||||
|
||||
canRefreshMetadata: function (item, user) {
|
||||
|
||||
if (user.Policy.IsAdministrator) {
|
||||
|
||||
var collectionType = item.CollectionType;
|
||||
if (collectionType === 'livetv') {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (item.Type !== 'Timer' && item.Type !== 'SeriesTimer' && item.Type !== 'Program' && item.Type !== 'TvChannel' && !(item.Type === 'Recording' && item.Status !== 'Completed')) {
|
||||
|
||||
if (!isLocalItem(item)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
},
|
||||
|
||||
supportsMediaSourceSelection: function (item) {
|
||||
|
||||
if (item.MediaType !== 'Video') {
|
||||
return false;
|
||||
}
|
||||
if (item.Type === 'TvChannel') {
|
||||
return false;
|
||||
}
|
||||
if (!item.MediaSources || (item.MediaSources.length === 1 && item.MediaSources[0].Type === 'Placeholder')) {
|
||||
return false;
|
||||
}
|
||||
if (item.EnableMediaSourceDisplay === false) {
|
||||
return false;
|
||||
}
|
||||
if (item.EnableMediaSourceDisplay == null && item.SourceType && item.SourceType !== 'Library') {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
};
|
||||
});
|
Loading…
Add table
Add a link
Reference in a new issue