Merge pull request #3627 from bernarden/feature/movie-shuffle-button

This commit is contained in:
Bill Thornton 2022-05-14 03:09:37 -04:00 committed by GitHub
commit 5b17d6a5d7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 15 additions and 0 deletions

View File

@ -3,6 +3,7 @@
<div class="pageTabContent" id="moviesTab" data-index="0"> <div class="pageTabContent" id="moviesTab" data-index="0">
<div class="flex align-items-center justify-content-center flex-wrap-wrap padded-top padded-left padded-right padded-bottom focuscontainer-x"> <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> <div class="paging"></div>
<button is="paper-icon-button-light" class="btnShuffle autoSize hide" title="${Shuffle}"><span class="material-icons shuffle" aria-hidden="true"></span></button>
<button is="paper-icon-button-light" class="btnSelectView autoSize" title="${ButtonSelectView}"><span class="material-icons view_comfy" aria-hidden="true"></span></button> <button is="paper-icon-button-light" class="btnSelectView autoSize" title="${ButtonSelectView}"><span class="material-icons view_comfy" 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="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> <button is="paper-icon-button-light" class="btnFilter autoSize" title="${Filter}"><span class="material-icons filter_list" aria-hidden="true"></span></button>

View File

@ -6,6 +6,7 @@ import { AlphaPicker } from '../../components/alphaPicker/alphaPicker';
import listView from '../../components/listview/listview'; import listView from '../../components/listview/listview';
import cardBuilder from '../../components/cardbuilder/cardBuilder'; import cardBuilder from '../../components/cardbuilder/cardBuilder';
import globalize from '../../scripts/globalize'; import globalize from '../../scripts/globalize';
import { playbackManager } from '../../components/playback/playbackmanager';
import '../../elements/emby-itemscontainer/emby-itemscontainer'; import '../../elements/emby-itemscontainer/emby-itemscontainer';
/* eslint-disable indent */ /* eslint-disable indent */
@ -29,6 +30,15 @@ import '../../elements/emby-itemscontainer/emby-itemscontainer';
return ApiClient.getItems(ApiClient.getCurrentUserId(), query); return ApiClient.getItems(ApiClient.getCurrentUserId(), query);
} }
function shuffle() {
ApiClient.getItem(
ApiClient.getCurrentUserId(),
params.topParentId
).then((item) => {
playbackManager.shuffle(item);
});
}
const afterRefresh = (result) => { const afterRefresh = (result) => {
function onNextPageClick() { function onNextPageClick() {
if (isLoading) { if (isLoading) {
@ -77,6 +87,8 @@ import '../../elements/emby-itemscontainer/emby-itemscontainer';
elem.addEventListener('click', onPreviousPageClick); elem.addEventListener('click', onPreviousPageClick);
} }
tabContent.querySelector('.btnShuffle').classList.toggle('hide', result.TotalRecordCount < 1);
isLoading = false; isLoading = false;
loading.hide(); loading.hide();
@ -243,6 +255,8 @@ import '../../elements/emby-itemscontainer/emby-itemscontainer';
onViewStyleChange(); onViewStyleChange();
itemsContainer.refreshItems(); itemsContainer.refreshItems();
}); });
tabContent.querySelector('.btnShuffle').addEventListener('click', shuffle);
}; };
let itemsContainer = tabContent.querySelector('.itemsContainer'); let itemsContainer = tabContent.querySelector('.itemsContainer');