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

Fix playing theme song when using parent links

Navigation by plain links breaks the theme song player because
there is no BaseItemDto in 'state'.
This commit is contained in:
Dmitry Lyzo 2022-02-20 23:34:21 +03:00
parent f94b64ad99
commit 7b0f4ed859

View file

@ -439,7 +439,6 @@ function getArtistLinksHtml(artists, serverId, context) {
* @param {Object} context - Application context. * @param {Object} context - Application context.
*/ */
function renderName(item, container, context) { function renderName(item, container, context) {
let parentRoute;
const parentNameHtml = []; const parentNameHtml = [];
let parentNameLast = false; let parentNameLast = false;
@ -450,55 +449,19 @@ function renderName(item, container, context) {
parentNameHtml.push(getArtistLinksHtml(item.ArtistItems, item.ServerId, context)); parentNameHtml.push(getArtistLinksHtml(item.ArtistItems, item.ServerId, context));
parentNameLast = true; parentNameLast = true;
} else if (item.SeriesName && item.Type === 'Episode') { } else if (item.SeriesName && item.Type === 'Episode') {
parentRoute = appRouter.getRouteUrl({ parentNameHtml.push(`<a style="color:inherit;" class="button-link itemAction" is="emby-linkbutton" href="#" data-action="link" data-id="${item.SeriesId}" data-serverid="${item.ServerId}" data-type="Series" data-isfolder="true">${item.SeriesName}</a>`);
Id: item.SeriesId,
Name: item.SeriesName,
Type: 'Series',
IsFolder: true,
ServerId: item.ServerId
}, {
context: context
});
parentNameHtml.push('<a style="color:inherit;" class="button-link" is="emby-linkbutton" href="' + parentRoute + '">' + item.SeriesName + '</a>');
} else if (item.IsSeries || item.EpisodeTitle) { } else if (item.IsSeries || item.EpisodeTitle) {
parentNameHtml.push(item.Name); parentNameHtml.push(item.Name);
} }
if (item.SeriesName && item.Type === 'Season') { if (item.SeriesName && item.Type === 'Season') {
parentRoute = appRouter.getRouteUrl({ parentNameHtml.push(`<a style="color:inherit;" class="button-link itemAction" is="emby-linkbutton" href="#" data-action="link" data-id="${item.SeriesId}" data-serverid="${item.ServerId}" data-type="Series" data-isfolder="true">${item.SeriesName}</a>`);
Id: item.SeriesId,
Name: item.SeriesName,
Type: 'Series',
IsFolder: true,
ServerId: item.ServerId
}, {
context: context
});
parentNameHtml.push('<a style="color:inherit;" class="button-link" is="emby-linkbutton" href="' + parentRoute + '">' + item.SeriesName + '</a>');
} else if (item.ParentIndexNumber != null && item.Type === 'Episode') { } else if (item.ParentIndexNumber != null && item.Type === 'Episode') {
parentRoute = appRouter.getRouteUrl({ parentNameHtml.push(`<a style="color:inherit;" class="button-link itemAction" is="emby-linkbutton" href="#" data-action="link" data-id="${item.SeasonId}" data-serverid="${item.ServerId}" data-type="Season" data-isfolder="true">${item.SeasonName}</a>`);
Id: item.SeasonId,
Name: item.SeasonName,
Type: 'Season',
IsFolder: true,
ServerId: item.ServerId
}, {
context: context
});
parentNameHtml.push('<a style="color:inherit;" class="button-link" is="emby-linkbutton" href="' + parentRoute + '">' + item.SeasonName + '</a>');
} else if (item.ParentIndexNumber != null && item.IsSeries) { } else if (item.ParentIndexNumber != null && item.IsSeries) {
parentNameHtml.push(item.SeasonName || 'S' + item.ParentIndexNumber); parentNameHtml.push(item.SeasonName || 'S' + item.ParentIndexNumber);
} else if (item.Album && item.AlbumId && (item.Type === 'MusicVideo' || item.Type === 'Audio')) { } else if (item.Album && item.AlbumId && (item.Type === 'MusicVideo' || item.Type === 'Audio')) {
parentRoute = appRouter.getRouteUrl({ parentNameHtml.push(`<a style="color:inherit;" class="button-link itemAction" is="emby-linkbutton" href="#" data-action="link" data-id="${item.AlbumId}" data-serverid="${item.ServerId}" data-type="MusicAlbum" data-isfolder="true">${item.Album}</a>`);
Id: item.AlbumId,
Name: item.Album,
Type: 'MusicAlbum',
IsFolder: true,
ServerId: item.ServerId
}, {
context: context
});
parentNameHtml.push('<a style="color:inherit;" class="button-link" is="emby-linkbutton" href="' + parentRoute + '">' + item.Album + '</a>');
} else if (item.Album) { } else if (item.Album) {
parentNameHtml.push(item.Album); parentNameHtml.push(item.Album);
} }
@ -2105,8 +2068,11 @@ export default function (view, params) {
Events.on(apiClient, 'message', onWebSocketMessage); Events.on(apiClient, 'message', onWebSocketMessage);
Events.on(playbackManager, 'playerchange', onPlayerChange); Events.on(playbackManager, 'playerchange', onPlayerChange);
itemShortcuts.on(view.querySelector('.nameContainer'));
}); });
view.addEventListener('viewbeforehide', function () { view.addEventListener('viewbeforehide', function () {
itemShortcuts.off(view.querySelector('.nameContainer'));
Events.off(apiClient, 'message', onWebSocketMessage); Events.off(apiClient, 'message', onWebSocketMessage);
Events.off(playbackManager, 'playerchange', onPlayerChange); Events.off(playbackManager, 'playerchange', onPlayerChange);
libraryMenu.setTransparentMenu(false); libraryMenu.setTransparentMenu(false);