summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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);