diff options
-rw-r--r-- | js/read.js | 15 | ||||
-rw-r--r-- | read.html | 5 |
2 files changed, 15 insertions, 5 deletions
@@ -38,7 +38,12 @@ function open_lastread() { item = item || {}; - if (item.cfi) book.rendition.display(item.cfi); + // CFI missing or w/e + try { + if (item.cfi) book.rendition.display(item.cfi); + } catch (e) { + console.warn(e); + } if (navigator.onLine) { @@ -49,8 +54,12 @@ function open_lastread() { localforage.setItem(cacheId("lastread"), {cfi: data.cfi, page: data.page, total: data.total}); - if (item.cfi != data.cfi && (!item.page || data.page > item.page)) - book.rendition.display(data.cfi); + try { + if (item.cfi != data.cfi && (!item.page || data.page > item.page)) + book.rendition.display(data.cfi); + } catch (e) { + console.warn(e); + } } }); @@ -705,6 +705,9 @@ }); open_lastread(); + + $(".loading").hide(); + }); rendition.on("keyup", hotkey_handler); @@ -776,8 +779,6 @@ if (book.locations.length() == 0) return; - $(".loading").hide(); - var currentCfi = location.start.cfi; var currentPage = parseInt(book.locations.percentageFromCfi(currentCfi) * 100); var pct = book.locations.percentageFromCfi(currentCfi); |