mirror of
https://github.com/advplyr/audiobookshelf-app.git
synced 2025-07-30 23:54:30 +02:00
Add:Progress for comics #738
This commit is contained in:
parent
c8b5cefeb5
commit
543ac209e4
7 changed files with 236 additions and 51 deletions
|
@ -39,7 +39,8 @@ export default {
|
|||
type: Object,
|
||||
default: () => {}
|
||||
},
|
||||
isLocal: Boolean
|
||||
isLocal: Boolean,
|
||||
keepProgress: Boolean
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
|
@ -92,7 +93,11 @@ export default {
|
|||
return this.$store.getters['user/getUserMediaProgress'](this.serverLibraryItemId)
|
||||
},
|
||||
savedPage() {
|
||||
return Number(this.userItemProgress?.ebookLocation || 0)
|
||||
if (!this.keepProgress) return 0
|
||||
|
||||
// Validate ebookLocation is a number
|
||||
if (!this.userItemProgress?.ebookLocation || isNaN(this.userItemProgress.ebookLocation)) return 0
|
||||
return Number(this.userItemProgress.ebookLocation)
|
||||
},
|
||||
pdfDocInitParams() {
|
||||
return {
|
||||
|
@ -105,10 +110,13 @@ export default {
|
|||
},
|
||||
methods: {
|
||||
async updateProgress() {
|
||||
if (!this.keepProgress) return
|
||||
|
||||
if (!this.numPages) {
|
||||
console.error('Num pages not loaded')
|
||||
return
|
||||
}
|
||||
|
||||
const payload = {
|
||||
ebookLocation: String(this.page),
|
||||
ebookProgress: Math.max(0, Math.min(1, (Number(this.page) - 1) / Number(this.numPages)))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue