Fix epub reader

This commit is contained in:
advplyr 2023-03-06 13:09:09 -06:00
parent f594b734c0
commit cb5d32bbb9
3 changed files with 7 additions and 16 deletions

View file

@ -72,7 +72,7 @@ export default {
methods: { methods: {
clickBg(ev) { clickBg(ev) {
if (this.processing && this.persistent) return if (this.processing && this.persistent) return
if (ev && ev.srcElement && ev.srcElement.classList.contains('modal-bg')) { if (ev && ev.srcElement && ev.srcElement.classList && ev.srcElement.classList.contains('modal-bg')) {
this.show = false this.show = false
} }
}, },

View file

@ -58,13 +58,6 @@ export default {
this.rendition.next() this.rendition.next()
} }
}, },
keyUp() {
if ((e.keyCode || e.which) == 37) {
this.prev()
} else if ((e.keyCode || e.which) == 39) {
this.next()
}
},
initEpub() { initEpub() {
var book = ePub(this.url) var book = ePub(this.url)
this.book = book this.book = book
@ -93,7 +86,7 @@ export default {
console.error('No Start', currentLocation) console.error('No Start', currentLocation)
} else { } else {
var currentPage = book.locations.percentageFromCfi(currentLocation.start.cfi) var currentPage = book.locations.percentageFromCfi(currentLocation.start.cfi)
// console.log('current page', currentPage) console.log('current page', currentPage)
} }
}) })
}) })
@ -105,10 +98,10 @@ export default {
}) })
this.chapters = _chapters this.chapters = _chapters
}) })
book.loaded.metadata.then((metadata) => { // book.loaded.metadata.then((metadata) => {
// this.author = metadata.creator // this.author = metadata.creator
// this.title = metadata.title // this.title = metadata.title
}) // })
// const spine_get = book.spine.get.bind(book.spine) // const spine_get = book.spine.get.bind(book.spine)
// book.spine.get = function (target) { // book.spine.get = function (target) {
@ -121,8 +114,6 @@ export default {
// return t // return t
// } // }
this.rendition.on('keyup', this.keyUp)
this.rendition.on('relocated', (location) => { this.rendition.on('relocated', (location) => {
var percent = book.locations.percentageFromCfi(location.start.cfi) var percent = book.locations.percentageFromCfi(location.start.cfi)
this.progress = Math.floor(percent * 100) this.progress = Math.floor(percent * 100)

View file

@ -1,6 +1,6 @@
<template> <template>
<div v-if="show" class="absolute top-0 left-0 w-full h-full bg-bg z-40 pt-16" :class="{ 'reader-player-open': !!playerLibraryItemId }"> <div v-if="show" class="absolute top-0 left-0 w-full h-full bg-bg z-40 pt-16" :class="{ 'reader-player-open': !!playerLibraryItemId }">
<div class="h-16 pt-6 w-full bg-primary flex items-center px-2 fixed top-0 left-0 z-30 box-shadow-sm"> <div class="h-16 pt-8 w-full bg-primary flex items-center px-2 fixed top-0 left-0 z-30 box-shadow-sm">
<p class="w-5/6 truncate">{{ title }}</p> <p class="w-5/6 truncate">{{ title }}</p>
<div class="flex-grow" /> <div class="flex-grow" />
<span class="material-icons text-xl text-white" @click.stop="show = false">close</span> <span class="material-icons text-xl text-white" @click.stop="show = false">close</span>