mirror of
https://github.com/jellyfin/jellyfin-web
synced 2025-03-30 19:56:21 +00:00
added play buttons to song table
This commit is contained in:
parent
3dc52fabbc
commit
7d55230e20
5 changed files with 111 additions and 50 deletions
|
@ -1,4 +1,4 @@
|
|||
var LibraryBrowser = (function (window, $) {
|
||||
var LibraryBrowser = (function (window, document, $) {
|
||||
|
||||
var defaultBackground = "#999;";
|
||||
|
||||
|
@ -213,6 +213,7 @@
|
|||
|
||||
html += '<tr>';
|
||||
|
||||
html += '<th></th>';
|
||||
html += '<th></th>';
|
||||
|
||||
html += '<th>Track</th>';
|
||||
|
@ -236,6 +237,8 @@
|
|||
|
||||
html += '<tr>';
|
||||
|
||||
html += '<td><button data-icon="play" data-mini="true" data-iconpos="notext" onclick="LibraryBrowser.showPlayMenu(this, \'' + item.Id + '\', \'Audio\');">Options</button></td>';
|
||||
|
||||
var num = item.IndexNumber;
|
||||
|
||||
if (num && item.ParentIndexNumber) {
|
||||
|
@ -281,6 +284,50 @@
|
|||
return html;
|
||||
},
|
||||
|
||||
showPlayMenu: function (positionTo, itemId, mediaType, resumePositionTicks) {
|
||||
|
||||
var isPlaying = MediaPlayer.isPlaying();
|
||||
|
||||
if (!isPlaying && !resumePositionTicks) {
|
||||
MediaPlayer.playById(itemId);
|
||||
return;
|
||||
}
|
||||
|
||||
$('.playFlyout').popup("close").remove();
|
||||
|
||||
var html = '<div data-role="popup" class="playFlyout" style="max-width:300px;" data-corners="false" data-theme="c" data-history="false">';
|
||||
|
||||
html += '<ul data-role="listview" style="min-width: 150px;" data-theme="c">';
|
||||
html += '<li data-role="list-divider" data-theme="a">Play Menu</li>';
|
||||
|
||||
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();">Play</a></li>';
|
||||
}
|
||||
|
||||
if (isPlaying && MediaPlayer.canQueue(mediaType)) {
|
||||
html += '<li><a href="#" onclick="MediaPlayer.playNext(\'' + itemId + '\');LibraryBrowser.closePlayMenu();">Play Next</a></li>';
|
||||
html += '<li><a href="#" onclick="MediaPlayer.playLast(\'' + itemId + '\');LibraryBrowser.closePlayMenu();">Play Last</a></li>';
|
||||
}
|
||||
|
||||
html += '</ul>';
|
||||
|
||||
html += '</div>';
|
||||
|
||||
$($.mobile.activePage).append(html);
|
||||
|
||||
$('.playFlyout').popup({ positionTo: positionTo || "window" }).trigger('create').popup("open").on("popupafterclose", function () {
|
||||
|
||||
$(this).off("popupafterclose").remove();
|
||||
|
||||
}).parents(".ui-popup-container").css("margin-left", 100);
|
||||
},
|
||||
|
||||
closePlayMenu: function () {
|
||||
$('.playFlyout').popup("close").remove();
|
||||
},
|
||||
|
||||
getHref: function (item, itemByNameContext) {
|
||||
|
||||
if (item.url) {
|
||||
|
@ -1472,4 +1519,4 @@
|
|||
|
||||
};
|
||||
|
||||
})(window, jQuery);
|
||||
})(window, document, jQuery);
|
Loading…
Add table
Add a link
Reference in a new issue