1
0
Fork 0
mirror of https://github.com/jellyfin/jellyfin-web synced 2025-03-30 19:56:21 +00:00

Fix undefined item when casting to other device

Fix undefined item when changing cast to other device.
Removed NowPlayingAlbum because on smaller device we need more height
This commit is contained in:
Samuel 2020-04-12 10:55:52 -04:00 committed by GitHub
parent 8651b8c177
commit 3ab01d471f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -114,6 +114,7 @@ define(["browser", "datetime", "backdrop", "libraryBrowser", "listView", "imageL
var item = state.NowPlayingItem; var item = state.NowPlayingItem;
var displayName = item ? getNowPlayingNameHtml(item).replace("<br/>", " - ") : ""; var displayName = item ? getNowPlayingNameHtml(item).replace("<br/>", " - ") : "";
console.debug(JSON.stringify(item, null, 4)); console.debug(JSON.stringify(item, null, 4));
if (typeof item != 'undefined') {
if (item.Type == "Audio" || item.MediaStreams[0].Type == "Audio") { if (item.Type == "Audio" || item.MediaStreams[0].Type == "Audio") {
var songName = item.Name; var songName = item.Name;
if (item.Album != null && item.Artists != null) { if (item.Album != null && item.Artists != null) {
@ -121,13 +122,13 @@ define(["browser", "datetime", "backdrop", "libraryBrowser", "listView", "imageL
var artistName; var artistName;
if (item.ArtistItems != null) { if (item.ArtistItems != null) {
artistName = item.ArtistItems[0].Name; artistName = item.ArtistItems[0].Name;
context.querySelector(".nowPlayingAlbum").innerHTML = '<a style="color:inherit;" class="button-link emby-button" is="emby-linkbutton" href="itemdetails.html?id=' + item.AlbumId + '&amp;serverId=' + (item.ServerId || serverId) + '">' + albumName + '</a>'; // context.querySelector(".nowPlayingAlbum").innerHTML = '<a style="color:inherit;" class="button-link emby-button" is="emby-linkbutton" href="itemdetails.html?id=' + item.AlbumId + '&amp;serverId=' + (item.ServerId || serverId) + '">' + albumName + '</a>';
context.querySelector(".nowPlayingArtist").innerHTML = '<a style="color:inherit;" class="button-link emby-button" is="emby-linkbutton" href="itemdetails.html?id=' + item.ArtistItems[0].Id + '&amp;serverId=' + (item.ServerId || serverId) + '">' + artistName + '</a>'; context.querySelector(".nowPlayingArtist").innerHTML = '<a style="color:inherit;" class="button-link emby-button" is="emby-linkbutton" href="itemdetails.html?id=' + item.ArtistItems[0].Id + '&amp;serverId=' + (item.ServerId || serverId) + '">' + artistName + '</a>';
context.querySelector(".contextMenuAlbum").innerHTML = '<a style="color:inherit;" class="button-link emby-button" is="emby-linkbutton" href="itemdetails.html?id=' + item.AlbumId + '&amp;serverId=' + (item.ServerId || serverId) + '"><i class="actionsheetMenuItemIcon listItemIcon listItemIcon-transparent material-icons">album</i> ' + globalize.translate("ViewAlbum") + '</a>'; context.querySelector(".contextMenuAlbum").innerHTML = '<a style="color:inherit;" class="button-link emby-button" is="emby-linkbutton" href="itemdetails.html?id=' + item.AlbumId + '&amp;serverId=' + (item.ServerId || serverId) + '"><i class="actionsheetMenuItemIcon listItemIcon listItemIcon-transparent material-icons">album</i> ' + globalize.translate("ViewAlbum") + '</a>';
context.querySelector(".contextMenuArtist").innerHTML = '<a style="color:inherit;" class="button-link emby-button" is="emby-linkbutton" href="itemdetails.html?id=' + item.ArtistItems[0].Id + '&amp;serverId=' + (item.ServerId || serverId) + '"><i class="actionsheetMenuItemIcon listItemIcon listItemIcon-transparent material-icons">person</i> ' + globalize.translate("ViewArtist") + '</a>'; context.querySelector(".contextMenuArtist").innerHTML = '<a style="color:inherit;" class="button-link emby-button" is="emby-linkbutton" href="itemdetails.html?id=' + item.ArtistItems[0].Id + '&amp;serverId=' + (item.ServerId || serverId) + '"><i class="actionsheetMenuItemIcon listItemIcon listItemIcon-transparent material-icons">person</i> ' + globalize.translate("ViewArtist") + '</a>';
} else { } else {
artistName = item.Artists; artistName = item.Artists;
context.querySelector(".nowPlayingAlbum").innerHTML = albumName; // context.querySelector(".nowPlayingAlbum").innerHTML = albumName;
context.querySelector(".nowPlayingArtist").innerHTML = artistName; context.querySelector(".nowPlayingArtist").innerHTML = artistName;
} }
} }
@ -176,6 +177,7 @@ define(["browser", "datetime", "backdrop", "libraryBrowser", "listView", "imageL
context.querySelector(".nowPlayingPageUserDataButtons").innerHTML = ""; context.querySelector(".nowPlayingPageUserDataButtons").innerHTML = "";
} }
} }
}
function setImageUrl(context, state, url) { function setImageUrl(context, state, url) {
currentImgUrl = url; currentImgUrl = url;