mirror of
https://github.com/jellyfin/jellyfin-web
synced 2025-03-30 19:56:21 +00:00
Added play/queue artist buttons
This commit is contained in:
parent
725e435584
commit
fd6e7a1370
4 changed files with 69 additions and 5 deletions
|
@ -945,7 +945,14 @@
|
|||
|
||||
$('#btnPlay', page).on('click', function () {
|
||||
var userdata = currentItem.UserData || {};
|
||||
LibraryBrowser.showPlayMenu(this, currentItem.Id, currentItem.Type, currentItem.MediaType, userdata.PlaybackPositionTicks);
|
||||
|
||||
var mediaType = currentItem.MediaType;
|
||||
|
||||
if (currentItem.Type == "MusicArtist" || currentItem.Type == "MusicAlbum") {
|
||||
mediaType = "Audio";
|
||||
}
|
||||
|
||||
LibraryBrowser.showPlayMenu(this, currentItem.Id, currentItem.Type, mediaType, userdata.PlaybackPositionTicks);
|
||||
});
|
||||
|
||||
$('#btnEdit', page).on('click', function () {
|
||||
|
|
|
@ -81,6 +81,12 @@
|
|||
ApiClient.sendWebSocketMessage("Context", vals.join('|'));
|
||||
}
|
||||
|
||||
if (MediaPlayer.canPlay(item)) {
|
||||
$('#playButtonContainer', page).show();
|
||||
} else {
|
||||
$('#playButtonContainer', page).hide();
|
||||
}
|
||||
|
||||
Dashboard.getCurrentUser().done(function (user) {
|
||||
|
||||
if (user.Configuration.IsAdministrator && item.LocationType !== "Offline") {
|
||||
|
@ -487,6 +493,11 @@
|
|||
|
||||
var page = this;
|
||||
|
||||
$('#btnPlay', page).on('click', function () {
|
||||
var userdata = currentItem.UserData || {};
|
||||
LibraryBrowser.showPlayMenu(this, currentItem.Name, currentItem.Type, "Audio", userdata.PlaybackPositionTicks);
|
||||
});
|
||||
|
||||
$('#btnRemote', page).on('click', function () {
|
||||
|
||||
RemoteControl.showMenuForItem({ item: currentItem, context: getParameterByName('context') || '' });
|
||||
|
|
|
@ -317,7 +317,7 @@
|
|||
|
||||
var isPlaying = MediaPlayer.isPlaying();
|
||||
|
||||
if (!isPlaying && !resumePositionTicks) {
|
||||
if (!isPlaying && !resumePositionTicks && mediaType != "Audio") {
|
||||
MediaPlayer.playById(itemId);
|
||||
return;
|
||||
}
|
||||
|
@ -329,15 +329,23 @@
|
|||
html += '<ul data-role="listview" style="min-width: 150px;" data-theme="c">';
|
||||
html += '<li data-role="list-divider" data-theme="a">Play Menu</li>';
|
||||
|
||||
if (itemType == "Artist") {
|
||||
html += '<li><a href="#" onclick="MediaPlayer.playArtist(\'' + itemId + '\');LibraryBrowser.closePlayMenu();">Play</a></li>';
|
||||
} else {
|
||||
html += '<li><a href="#" onclick="MediaPlayer.playById(\'' + itemId + '\');LibraryBrowser.closePlayMenu();">Play</a></li>';
|
||||
}
|
||||
|
||||
if (resumePositionTicks) {
|
||||
html += '<li><a href="#" onclick="MediaPlayer.playById(\'' + itemId + '\', ' + resumePositionTicks + ');LibraryBrowser.closePlayMenu();">Resume</a></li>';
|
||||
}
|
||||
|
||||
if (isPlaying) {
|
||||
if (itemType == "Artist") {
|
||||
html += '<li><a href="#" onclick="MediaPlayer.queueArtist(\'' + itemId + '\');LibraryBrowser.closePlayMenu();">Queue</a></li>';
|
||||
} else {
|
||||
html += '<li><a href="#" onclick="MediaPlayer.queue(\'' + itemId + '\');LibraryBrowser.closePlayMenu();">Queue</a></li>';
|
||||
}
|
||||
}
|
||||
|
||||
html += '</ul>';
|
||||
|
||||
|
|
|
@ -727,7 +727,7 @@
|
|||
|
||||
self.canPlay = function (item) {
|
||||
|
||||
if (item.Type == "MusicAlbum" || item.Type == "MusicArtist") {
|
||||
if (item.Type == "MusicAlbum" || item.Type == "MusicArtist" || item.Type == "Artist") {
|
||||
return true;
|
||||
}
|
||||
return self.canPlayMediaType(item.MediaType);
|
||||
|
@ -972,6 +972,23 @@
|
|||
|
||||
};
|
||||
|
||||
self.playArtist = function (artist) {
|
||||
|
||||
self.getItemsForPlayback({
|
||||
|
||||
Artists: artist,
|
||||
Recursive: true,
|
||||
SortBy: "Album,SortName",
|
||||
IncludeItemTypes: "Audio"
|
||||
|
||||
}).done(function (result) {
|
||||
|
||||
self.play(result.Items);
|
||||
|
||||
});
|
||||
|
||||
};
|
||||
|
||||
self.toggleFullscreen = function () {
|
||||
if (isFullScreen()) {
|
||||
if (document.cancelFullScreen) { document.cancelFullScreen(); }
|
||||
|
@ -1073,6 +1090,27 @@
|
|||
});
|
||||
};
|
||||
|
||||
self.queueArtist = function (artist) {
|
||||
|
||||
self.getItemsForPlayback({
|
||||
|
||||
Artists: artist,
|
||||
Recursive: true,
|
||||
SortBy: "Album,SortName",
|
||||
IncludeItemTypes: "Audio"
|
||||
|
||||
}).done(function (result) {
|
||||
|
||||
for (var i = 0, length = result.Items.length; i < length; i++) {
|
||||
|
||||
self.queueItem(result.Items[i]);
|
||||
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
};
|
||||
|
||||
self.pause = function () {
|
||||
currentMediaElement.pause();
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue