diff options
author | Andrew Dolgov <[email protected]> | 2017-02-26 13:12:33 +0300 |
---|---|---|
committer | Andrew Dolgov <[email protected]> | 2017-02-26 13:12:33 +0300 |
commit | e01f57a3d98943954372110dc75e8d731fbacc10 (patch) | |
tree | 2d57e3a2368984f03507f2650f0b94273dced625 /js/read.js | |
parent | b8ae4b31c129031e89e4c7fb9801d6761513dd73 (diff) |
further offline improvements
Diffstat (limited to 'js/read.js')
-rw-r--r-- | js/read.js | 10 |
1 files changed, 7 insertions, 3 deletions
@@ -111,10 +111,14 @@ function mark_as_read() { function save_and_close() { if (navigator.onLine) { - var curPage = book.pagination.pageFromCfi(book.getCurrentLocationCfi()); + var currentPage = book.pagination.pageFromCfi(book.getCurrentLocationCfi()); + var currentCfi = book.getCurrentLocationCfi(); - $.post("backend.php", { op: "storelastread", id: $.urlParam("id"), page: curPage, - cfi: book.getCurrentLocationCfi() }, function(data) { + localforage.setItem("epube-book." + $.urlParam("b") + ".lastread", + {cfi: currentCfi, page: currentPage}); + + $.post("backend.php", { op: "storelastread", id: $.urlParam("id"), page: currentPage, + cfi: currentCfi }, function(data) { window.location = "index.php"; }); } else { |