diff options
author | Andrew Dolgov <[email protected]> | 2017-02-26 00:14:30 +0300 |
---|---|---|
committer | Andrew Dolgov <[email protected]> | 2017-02-26 00:14:30 +0300 |
commit | b8ae4b31c129031e89e4c7fb9801d6761513dd73 (patch) | |
tree | 4522dc5c059837a8c143c2a90c1dc562db0915ff /js/read.js | |
parent | f858879a3d13bcec694a5e2493fbfe3a1a233e13 (diff) |
experimental service worker offline stuff
Diffstat (limited to 'js/read.js')
-rw-r--r-- | js/read.js | 15 |
1 files changed, 9 insertions, 6 deletions
@@ -110,13 +110,16 @@ function mark_as_read() { } function save_and_close() { + if (navigator.onLine) { + var curPage = book.pagination.pageFromCfi(book.getCurrentLocationCfi()); - var curPage = book.pagination.pageFromCfi(book.getCurrentLocationCfi()); - - $.post("backend.php", { op: "storelastread", id: $.urlParam("id"), page: curPage, - cfi: book.getCurrentLocationCfi() }, function(data) { - window.location = "index.php"; - }); + $.post("backend.php", { op: "storelastread", id: $.urlParam("id"), page: curPage, + cfi: book.getCurrentLocationCfi() }, function(data) { + window.location = "index.php"; + }); + } else { + window.location = "index.php"; + } } function invert() { |