Merge pull request #3741 from murphy52589/shuffle-all-songs

Add shuffle to songs page
This commit is contained in:
Bill Thornton 2022-07-06 15:05:17 -04:00 committed by GitHub
commit 0e49497b46
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 192 additions and 184 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,8 +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';
/* eslint-disable indent */
import {playbackManager} from '../../components/playback/playbackmanager';
export default function (view, params, tabContent) {
function getPageData(context) {
@ -118,6 +117,9 @@ import Dashboard from '../../utils/dashboard';
itemsContainer.innerHTML = html;
imageLoader.lazyChildren(itemsContainer);
libraryBrowser.saveQueryValues(getSavedQueryKey(page), query);
tabContent.querySelector('.btnShuffle').classList.toggle('hide', result.TotalRecordCount < 1);
loading.hide();
isLoading = false;
@ -146,6 +148,12 @@ import Dashboard from '../../utils/dashboard';
});
};
function shuffle() {
ApiClient.getItem(ApiClient.getCurrentUserId(), params.topParentId).then(function (item) {
playbackManager.shuffle(item);
});
}
self.getCurrentViewStyle = function () {
return getPageData(tabContent).view;
};
@ -192,6 +200,7 @@ import Dashboard from '../../utils/dashboard';
button: e.target
});
});
tabContent.querySelector('.btnShuffle').addEventListener('click', shuffle);
}
initPage(tabContent);
@ -200,5 +209,3 @@ import Dashboard from '../../utils/dashboard';
reloadItems(tabContent);
};
}
/* eslint-enable indent */