adding shuffle to songs page

This commit is contained in:
kylem 2022-06-30 15:24:59 -05:00 committed by Dmitry Lyzo
parent 543331b059
commit e9bac09bd6
2 changed files with 9 additions and 0 deletions

View File

@ -92,6 +92,7 @@
<div class="pageTabContent" id="songsTab" data-index="5">
<div class="flex align-items-center justify-content-center flex-wrap-wrap padded-top padded-left padded-right padded-bottom focuscontainer-x">
<div class="paging"></div>
<button is="paper-icon-button-light" class="btnShuffle autoSize" title="${Shuffle}"><span class="material-icons shuffle" aria-hidden="true"></span></button>
<button is="paper-icon-button-light" class="btnSort autoSize" title="${Sort}"><span class="material-icons sort_by_alpha" aria-hidden="true"></span></button>
<button is="paper-icon-button-light" class="btnFilter autoSize" title="${Filter}"><span class="material-icons filter_list" aria-hidden="true"></span></button>
</div>

View File

@ -8,6 +8,7 @@ import * as userSettings from '../../scripts/settings/userSettings';
import globalize from '../../scripts/globalize';
import '../../elements/emby-itemscontainer/emby-itemscontainer';
import Dashboard from '../../utils/dashboard';
import {playbackManager} from '../../components/playback/playbackmanager';
export default function (view, params, tabContent) {
function getPageData(context) {
@ -144,6 +145,12 @@ export default function (view, params, tabContent) {
});
};
function shuffle() {
ApiClient.getItem(ApiClient.getCurrentUserId(), params.topParentId).then(function (item) {
playbackManager.shuffle(item);
});
}
self.getCurrentViewStyle = function () {
return getPageData(tabContent).view;
};
@ -190,6 +197,7 @@ export default function (view, params, tabContent) {
button: e.target
});
});
tabContent.querySelector('.btnShuffle').addEventListener('click', shuffle);
}
initPage(tabContent);