mirror of
https://github.com/advplyr/audiobookshelf.git
synced 2026-07-14 21:31:43 +00:00
Compare commits
No commits in common. "cb7632b216709d72d2309eceb33a519e3b94e9b1" and "9bf8d7de11b969bb7ece861d0321db33d1b016c9" have entirely different histories.
cb7632b216
...
9bf8d7de11
1 changed files with 3 additions and 37 deletions
|
|
@ -16,7 +16,7 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<p dir="auto" class="text-lg font-semibold mb-6">{{ title }}</p>
|
<p dir="auto" class="text-lg font-semibold mb-6">{{ title }}</p>
|
||||||
<div v-if="description" dir="auto" class="default-style less-spacing" @click="handleDescriptionClick" v-html="description" />
|
<div v-if="description" dir="auto" class="default-style less-spacing" v-html="description" />
|
||||||
<p v-else class="mb-2">{{ $strings.MessageNoDescription }}</p>
|
<p v-else class="mb-2">{{ $strings.MessageNoDescription }}</p>
|
||||||
|
|
||||||
<div class="w-full h-px bg-white/5 my-4" />
|
<div class="w-full h-px bg-white/5 my-4" />
|
||||||
|
|
@ -68,7 +68,7 @@ export default {
|
||||||
return this.episode.title || 'No Episode Title'
|
return this.episode.title || 'No Episode Title'
|
||||||
},
|
},
|
||||||
description() {
|
description() {
|
||||||
return this.parseDescription(this.episode.description || '')
|
return this.episode.description || ''
|
||||||
},
|
},
|
||||||
media() {
|
media() {
|
||||||
return this.libraryItem?.media || {}
|
return this.libraryItem?.media || {}
|
||||||
|
|
@ -94,41 +94,7 @@ export default {
|
||||||
return this.$store.getters['libraries/getBookCoverAspectRatio']
|
return this.$store.getters['libraries/getBookCoverAspectRatio']
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {},
|
||||||
handleDescriptionClick(e) {
|
|
||||||
if (e.target.matches('span.time-marker')) {
|
|
||||||
const time = parseInt(e.target.dataset.time)
|
|
||||||
if (!isNaN(time)) {
|
|
||||||
this.$eventBus.$emit('play-item', {
|
|
||||||
episodeId: this.episodeId,
|
|
||||||
libraryItemId: this.libraryItem.id,
|
|
||||||
startTime: time
|
|
||||||
})
|
|
||||||
}
|
|
||||||
e.preventDefault()
|
|
||||||
}
|
|
||||||
},
|
|
||||||
parseDescription(description) {
|
|
||||||
const timeMarkerLinkRegex = /<a href="#([^"]*?\b\d{1,2}:\d{1,2}(?::\d{1,2})?)">(.*?)<\/a>/g
|
|
||||||
const timeMarkerRegex = /\b\d{1,2}:\d{1,2}(?::\d{1,2})?\b/g
|
|
||||||
|
|
||||||
function convertToSeconds(time) {
|
|
||||||
const timeParts = time.split(':').map(Number)
|
|
||||||
return timeParts.reduce((acc, part, index) => acc * 60 + part, 0)
|
|
||||||
}
|
|
||||||
|
|
||||||
return description
|
|
||||||
.replace(timeMarkerLinkRegex, (match, href, displayTime) => {
|
|
||||||
const time = displayTime.match(timeMarkerRegex)[0]
|
|
||||||
const seekTimeInSeconds = convertToSeconds(time)
|
|
||||||
return `<span class="time-marker cursor-pointer text-blue-400 hover:text-blue-300" data-time="${seekTimeInSeconds}">${displayTime}</span>`
|
|
||||||
})
|
|
||||||
.replace(timeMarkerRegex, (match) => {
|
|
||||||
const seekTimeInSeconds = convertToSeconds(match)
|
|
||||||
return `<span class="time-marker cursor-pointer text-blue-400 hover:text-blue-300" data-time="${seekTimeInSeconds}">${match}</span>`
|
|
||||||
})
|
|
||||||
}
|
|
||||||
},
|
|
||||||
mounted() {}
|
mounted() {}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue