diff options
author | Andrew Dolgov <[email protected]> | 2017-07-26 16:15:26 +0300 |
---|---|---|
committer | Andrew Dolgov <[email protected]> | 2017-07-26 16:15:26 +0300 |
commit | c63095caf467c0959c13f2d772db1319767b467f (patch) | |
tree | f18550d23ecf32fecccd6c1105e18b9c0587f0ef | |
parent | 6ec52b5dda11acb8a6ea7bb06392ff67cb5ffba0 (diff) |
offline_get_all: do not redownload already cached books
-rw-r--r-- | js/index.js | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/js/index.js b/js/index.js index 2ec26f3..c5e2748 100644 --- a/js/index.js +++ b/js/index.js @@ -207,9 +207,18 @@ function offline_get_all() { var dropitem = $(row).find(".offline_dropitem")[0]; if (bookId) { - offline_cache(bookId, function() { - mark_offline(dropitem); + + var cacheId = 'epube-book.' + bookId; + localforage.getItem(cacheId).then(function(book) { + + if (!book) { + offline_cache(bookId, function() { + mark_offline(dropitem); + }); + } + }); + } }); } |