mirror of
https://github.com/advplyr/audiobookshelf.git
synced 2026-07-07 18:01:42 +00:00
Enable episode deep linking via episodeId
Wire episodeId query parameter through item links and search results, and preselect/show the corresponding episode on item page load.
This commit is contained in:
parent
50a4b61cbc
commit
61740bf08d
3 changed files with 12 additions and 1 deletions
|
|
@ -711,6 +711,7 @@ export default {
|
|||
var router = this.$router || this.$nuxt.$router
|
||||
if (router) {
|
||||
if (this.collapsedSeries) router.push(`/library/${this.libraryId}/series/${this.collapsedSeries.id}`)
|
||||
else if (this.recentEpisode) router.push(`/item/${this.libraryItemId}?episodeId=${this.recentEpisode.id}`)
|
||||
else router.push(`/item/${this.libraryItemId}`)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -42,7 +42,7 @@
|
|||
<p v-if="episodeResults.length" class="uppercase text-xs text-gray-400 my-1 px-1 font-semibold">{{ $strings.LabelEpisodes }}</p>
|
||||
<template v-for="item in episodeResults">
|
||||
<li :key="item.libraryItem.recentEpisode.id" class="text-gray-50 select-none relative cursor-pointer hover:bg-black-400 py-1" role="option" @click="clickOption">
|
||||
<nuxt-link :to="`/item/${item.libraryItem.id}`">
|
||||
<nuxt-link :to="`/item/${item.libraryItem.id}?episodeId=${item.libraryItem.recentEpisode.id}`">
|
||||
<cards-episode-search-card :episode="item.libraryItem.recentEpisode" :library-item="item.libraryItem" />
|
||||
</nuxt-link>
|
||||
</li>
|
||||
|
|
|
|||
|
|
@ -785,6 +785,16 @@ export default {
|
|||
this.episodeDownloadsQueued = this.libraryItem.episodeDownloadsQueued || []
|
||||
this.episodesDownloading = this.libraryItem.episodesDownloading || []
|
||||
|
||||
const episodeId = this.$route.query.episodeId
|
||||
if (episodeId) {
|
||||
const episode = this.podcastEpisodes.find((ep) => ep.id === episodeId)
|
||||
if (episode) {
|
||||
this.$store.commit('setSelectedLibraryItem', this.libraryItem)
|
||||
this.$store.commit('globals/setSelectedEpisode', episode)
|
||||
this.$store.commit('globals/setShowViewPodcastEpisodeModal', true)
|
||||
}
|
||||
}
|
||||
|
||||
this.$eventBus.$on(`${this.libraryItem.id}_updated`, this.libraryItemUpdated)
|
||||
this.$root.socket.on('item_updated', this.libraryItemUpdated)
|
||||
this.$root.socket.on('rss_feed_open', this.rssFeedOpen)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue