summaryrefslogtreecommitdiff
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
parentcad12aef84254da925f793a0eb54c5cee06d0fd0 (diff)
fix issues with splash not always hiding if open_lastread() fails on startup
-rw-r--r--js/read.js15
-rw-r--r--read.html5
2 files changed, 15 insertions, 5 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);
+ }
}
});
diff --git a/read.html b/read.html
index 2458e7f..bc0fce2 100644
--- a/read.html
+++ b/read.html
@@ -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);