diff options
author | Andrew Dolgov <[email protected]> | 2024-01-14 22:46:21 +0300 |
---|---|---|
committer | Andrew Dolgov <[email protected]> | 2024-01-14 22:46:21 +0300 |
commit | b11394d7ec73c01257604c343323efb249371f9b (patch) | |
tree | 39df7a49232a06d0b82e16c4f99f439cda8eee5f /js/reader.js | |
parent | 2bb310c4732694536f91a92f912f70fc1122b1aa (diff) |
openLastRead: use book global
Diffstat (limited to 'js/reader.js')
-rw-r--r-- | js/reader.js | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/js/reader.js b/js/reader.js index d1868ac..4540664 100644 --- a/js/reader.js +++ b/js/reader.js @@ -230,7 +230,7 @@ const Reader = { Reader.initModals(); Reader.initToc(book); Reader.initStyleHooks(book); - Reader.Page.openLastRead(rendition); + Reader.Page.openLastRead(); }, showBookInfo: async function(book) { const bookinfo = await localforage.getItem(Reader.cacheId()); @@ -1312,7 +1312,14 @@ const Reader = { await window.book.rendition.display(window.book.locations.cfiFromPercentage(0)); } }, - openLastRead: async function(rendition) { + openLastRead: async function() { + const rendition = window.book.rendition; + + if (!rendition) { + console.error('no rendition to work on'); + return; + } + let location_found = false; const lr_local = await localforage.getItem(Reader.cacheId("lastread")) || {}; |