diff --git a/client/components/app/Appbar.vue b/client/components/app/Appbar.vue index 4602fb89c..4f88b9146 100644 --- a/client/components/app/Appbar.vue +++ b/client/components/app/Appbar.vue @@ -134,8 +134,8 @@ export default { return this.$route.name === 'item-id' }, isBookshelfPage() { - const bookshelfRoutes = ['library-library-bookshelf', 'library-library-series', 'library-library-collections', 'library-library-playlists', 'library-library-authors', 'library-library'] - return bookshelfRoutes.includes(this.$route.name) + if (!this.$route.name) return false + return this.$route.name.startsWith('library-library') }, selectedMediaItemsArePlayable() { return !this.selectedMediaItems.some((i) => !i.hasTracks) @@ -543,7 +543,7 @@ export default { const shift = e.shiftKey const alt = e.altKey - if (ctrlOrMeta && e.key === 'a') { + if (ctrlOrMeta && e.key.toLowerCase() === 'a') { if (this.isBookshelfPage) { e.preventDefault() this.$eventBus.$emit('bookshelf_select_all') diff --git a/client/components/app/BookShelfCategorized.vue b/client/components/app/BookShelfCategorized.vue index 2580ca512..6b31d8a3a 100644 --- a/client/components/app/BookShelfCategorized.vue +++ b/client/components/app/BookShelfCategorized.vue @@ -180,6 +180,29 @@ export default { this.$eventBus.$emit('item-selected', entity) }) }, + selectAll() { + const itemsToSelect = [] + this.supportedShelves.forEach((shelf) => { + if (shelf.type === 'book' || shelf.type === 'podcast' || shelf.type === 'episode') { + shelf.entities.forEach((entity) => { + const mediaItem = { + id: entity.id, + libraryId: entity.libraryId, + mediaType: entity.mediaType, + hasTracks: entity.mediaType === 'podcast' || (entity.media && (entity.media.audioFile || entity.media.numTracks || (entity.media.tracks && entity.media.tracks.length))) + } + itemsToSelect.push(mediaItem) + }) + } + }) + + if (itemsToSelect.length) { + this.$store.commit('globals/addBatchMediaItemsSelected', itemsToSelect) + this.$nextTick(() => { + this.$eventBus.$emit('item-selected') + }) + } + }, async init() { this.wrapperClientWidth = this.$refs.wrapper ? this.$refs.wrapper.clientWidth : 0 @@ -506,6 +529,7 @@ export default { } else { console.error('Error socket not initialized') } + this.$eventBus.$on('bookshelf_select_all', this.selectAll) }, removeListeners() { if (this.$root.socket) { @@ -523,6 +547,7 @@ export default { } else { console.error('Error socket not initialized') } + this.$eventBus.$off('bookshelf_select_all', this.selectAll) } }, mounted() {