mirror of
https://github.com/jellyfin/jellyfin-web
synced 2025-03-30 19:56:21 +00:00
fixes #1420 - Go to now playing in web ui
This commit is contained in:
parent
13838f9d76
commit
cc687118d2
3 changed files with 81 additions and 20 deletions
|
@ -813,10 +813,21 @@
|
|||
};
|
||||
|
||||
// TOOD: This doesn't really belong here
|
||||
self.getNowPlayingNameHtml = function (nowPlayingItem, includeNonNameInfo) {
|
||||
self.getNowPlayingNames = function (nowPlayingItem, includeNonNameInfo) {
|
||||
|
||||
var topItem = nowPlayingItem;
|
||||
var bottomItem = null;
|
||||
var topText = nowPlayingItem.Name;
|
||||
|
||||
if (nowPlayingItem.AlbumId && nowPlayingItem.MediaType == 'Audio') {
|
||||
topItem = {
|
||||
Id: nowPlayingItem.AlbumId,
|
||||
Name: nowPlayingItem.Album,
|
||||
Type: 'MusicAlbum',
|
||||
IsFolder: true
|
||||
};
|
||||
}
|
||||
|
||||
if (nowPlayingItem.MediaType == 'Video') {
|
||||
if (nowPlayingItem.IndexNumber != null) {
|
||||
topText = nowPlayingItem.IndexNumber + " - " + topText;
|
||||
|
@ -829,18 +840,69 @@
|
|||
var bottomText = '';
|
||||
|
||||
if (nowPlayingItem.Artists && nowPlayingItem.Artists.length) {
|
||||
bottomText = topText;
|
||||
topText = nowPlayingItem.Artists[0];
|
||||
|
||||
if (nowPlayingItem.ArtistItems && nowPlayingItem.ArtistItems.length) {
|
||||
|
||||
bottomItem = {
|
||||
Id: nowPlayingItem.ArtistItems[0].Id,
|
||||
Name: nowPlayingItem.ArtistItems[0].Name,
|
||||
Type: 'MusicArtist',
|
||||
IsFolder: true
|
||||
};
|
||||
|
||||
bottomText = bottomItem.Name;
|
||||
} else {
|
||||
bottomText = nowPlayingItem.Artists[0];
|
||||
}
|
||||
}
|
||||
else if (nowPlayingItem.SeriesName || nowPlayingItem.Album) {
|
||||
bottomText = topText;
|
||||
topText = nowPlayingItem.SeriesName || nowPlayingItem.Album;
|
||||
|
||||
bottomItem = topItem;
|
||||
|
||||
if (nowPlayingItem.SeriesId) {
|
||||
topItem = {
|
||||
Id: nowPlayingItem.SeriesId,
|
||||
Name: nowPlayingItem.SeriesName,
|
||||
Type: 'Series',
|
||||
IsFolder: true
|
||||
};
|
||||
} else {
|
||||
topItem = null;
|
||||
}
|
||||
}
|
||||
else if (nowPlayingItem.ProductionYear && includeNonNameInfo !== false) {
|
||||
bottomText = nowPlayingItem.ProductionYear;
|
||||
}
|
||||
|
||||
return bottomText ? topText + '<br/>' + bottomText : topText;
|
||||
var list = [];
|
||||
|
||||
list.push({
|
||||
text: topText,
|
||||
item: topItem
|
||||
});
|
||||
|
||||
if (bottomText) {
|
||||
list.push({
|
||||
text: bottomText,
|
||||
item: bottomItem
|
||||
});
|
||||
}
|
||||
|
||||
return list;
|
||||
};
|
||||
|
||||
// TOOD: This doesn't really belong here
|
||||
self.getNowPlayingNameHtml = function (nowPlayingItem, includeNonNameInfo) {
|
||||
|
||||
var names = self.getNowPlayingNames(nowPlayingItem, includeNonNameInfo);
|
||||
|
||||
return names.map(function (i) {
|
||||
|
||||
return i.text;
|
||||
|
||||
}).join('<br/>');
|
||||
};
|
||||
|
||||
self.showPlaybackInfoErrorMessage = function (errorCode) {
|
||||
|
|
|
@ -1260,7 +1260,9 @@ define(['appSettings', 'userSettings', 'appStorage', 'datetime'], function (appS
|
|||
nowPlayingItem.PremiereDate = item.PremiereDate;
|
||||
nowPlayingItem.SeriesName = item.SeriesName;
|
||||
nowPlayingItem.Album = item.Album;
|
||||
nowPlayingItem.AlbumId = item.AlbumId;
|
||||
nowPlayingItem.Artists = item.Artists;
|
||||
nowPlayingItem.ArtistItems = item.ArtistItems;
|
||||
|
||||
var imageTags = item.ImageTags || {};
|
||||
|
||||
|
|
|
@ -288,14 +288,13 @@
|
|||
var nowPlayingBarElement;
|
||||
function getNowPlayingBar() {
|
||||
|
||||
return new Promise(function (resolve, reject) {
|
||||
|
||||
if (nowPlayingBarElement) {
|
||||
resolve(nowPlayingBarElement);
|
||||
return;
|
||||
return Promise.resolve(nowPlayingBarElement);
|
||||
}
|
||||
|
||||
require(['css!css/nowplayingbar.css', 'emby-slider'], function () {
|
||||
return new Promise(function (resolve, reject) {
|
||||
|
||||
require(['itemShortcuts', 'css!css/nowplayingbar.css', 'emby-slider'], function (itemShortcuts) {
|
||||
|
||||
nowPlayingBarElement = document.querySelector('.nowPlayingBar');
|
||||
|
||||
|
@ -312,6 +311,8 @@
|
|||
nowPlayingBarElement.classList.add('noMediaProgress');
|
||||
}
|
||||
|
||||
itemShortcuts.on(nowPlayingBarElement);
|
||||
|
||||
bindEvents(nowPlayingBarElement);
|
||||
resolve(nowPlayingBarElement);
|
||||
});
|
||||
|
@ -507,19 +508,15 @@
|
|||
var currentImgUrl;
|
||||
function updateNowPlayingInfo(state) {
|
||||
|
||||
var nameHtml = MediaController.getNowPlayingNameHtml(state.NowPlayingItem) || '';
|
||||
nowPlayingTextElement.innerHTML = MediaController.getNowPlayingNames(state.NowPlayingItem).map(function (nowPlayingName) {
|
||||
|
||||
if (nameHtml.indexOf('<br/>') != -1) {
|
||||
nowPlayingTextElement.classList.add('nowPlayingDoubleText');
|
||||
} else {
|
||||
nowPlayingTextElement.classList.remove('nowPlayingDoubleText');
|
||||
if (nowPlayingName.item) {
|
||||
return '<div>' + LibraryBrowser.getTextActionButton(nowPlayingName.item, nowPlayingName.text) + '</div>';
|
||||
}
|
||||
|
||||
if (state.NowPlayingItem.Id) {
|
||||
nameHtml = '<a style="color:inherit;text-decoration:none;" href="' + LibraryBrowser.getHref(state.NowPlayingItem) + '">' + nameHtml + '</a>';
|
||||
}
|
||||
return '<div>' + nowPlayingName.text + '</div>';
|
||||
|
||||
nowPlayingTextElement.innerHTML = nameHtml;
|
||||
}).join('');
|
||||
|
||||
var url;
|
||||
var imgHeight = 80;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue