Skip to content

Commit e6dcabf

Browse files
committed
Fixed epub view init not resuming from last position
1 parent 806836a commit e6dcabf

File tree

2 files changed

+10
-10
lines changed

2 files changed

+10
-10
lines changed

internal/webserver/embedded/js/foliate-js/reader.js renamed to internal/webserver/embedded/js/reader.js

+9-9
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
import './view.js'
2-
import { createTOCView } from './ui/tree.js'
3-
import { createMenu } from './ui/menu.js'
4-
import { Overlayer } from './overlayer.js'
1+
import './foliate-js/view.js'
2+
import { createTOCView } from './foliate-js/ui/tree.js'
3+
import { createMenu } from './foliate-js/ui/menu.js'
4+
import { Overlayer } from './foliate-js/overlayer.js'
55

66
const isZip = async file => {
77
const arr = new Uint8Array(await file.slice(0, 4).arrayBuffer())
@@ -17,7 +17,7 @@ const isPDF = async file => {
1717

1818
const makeZipLoader = async file => {
1919
const { configure, ZipReader, BlobReader, TextWriter, BlobWriter } =
20-
await import('./vendor/zip.js')
20+
await import('./foliate-js/vendor/zip.js')
2121
configure({ useWebWorkers: false })
2222
const reader = new ZipReader(new BlobReader(file))
2323
const entries = await reader.getEntries()
@@ -35,19 +35,19 @@ const getView = async file => {
3535
if (!file.size) throw new Error('File not found')
3636
else if (await isZip(file)) {
3737
const loader = await makeZipLoader(file)
38-
const { EPUB } = await import('./epub.js')
38+
const { EPUB } = await import('./foliate-js/epub.js')
3939
book = await new EPUB(loader).init()
4040
}
4141
else if (await isPDF(file)) {
42-
const { makePDF } = await import('./pdf.js')
42+
const { makePDF } = await import('./foliate-js/pdf.js')
4343
book = await makePDF(file)
4444
}
4545
if (!book) throw new Error('File type not supported')
4646
const view = document.createElement('foliate-view')
4747
const storage = window.localStorage
4848
document.body.append(view)
4949
await view.open(book)
50-
view.init({lastLocation: storage.getItem("loc")})
50+
await view.init({lastLocation: storage.getItem("loc")})
5151
return view
5252
}
5353

@@ -185,7 +185,7 @@ class Reader {
185185
// load and show highlights embedded in the file by Calibre
186186
const bookmarks = await book.getCalibreBookmarks?.()
187187
if (bookmarks) {
188-
const { fromCalibreHighlight } = await import('./epubcfi.js')
188+
const { fromCalibreHighlight } = await import('./foliate-js/epubcfi.js')
189189
for (const obj of bookmarks) {
190190
if (obj.type === 'highlight') {
191191
const value = fromCalibreHighlight(obj)

internal/webserver/embedded/views/reader.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -79,4 +79,4 @@
7979
}}</script>
8080

8181
<script src="/js/foliate-js/vendor/pdfjs/pdf.js"></script>
82-
<script src="/js/foliate-js/reader.js" type="module"></script>
82+
<script src="/js/reader.js" type="module"></script>

0 commit comments

Comments
 (0)