summaryrefslogtreecommitdiff
path: root/js
diff options
context:
space:
mode:
authorAndrew Dolgov <[email protected]>2018-06-29 18:14:27 +0300
committerAndrew Dolgov <[email protected]>2018-06-29 18:14:27 +0300
commitf738e738eb2a353498da91272c565eb44d0d6250 (patch)
treed8f9703a8d3cec95ac20b1e7296a3cdb03af6565 /js
parentcad12aef84254da925f793a0eb54c5cee06d0fd0 (diff)
fix issues with splash not always hiding if open_lastread() fails on startup
Diffstat (limited to 'js')
-rw-r--r--js/read.js15
1 files changed, 12 insertions, 3 deletions
diff --git a/js/read.js b/js/read.js
index 5582ae4..080167b 100644
--- a/js/read.js
+++ b/js/read.js
@@ -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);
+ }
}
});