summaryrefslogtreecommitdiff
path: root/js
diff options
context:
space:
mode:
authorAndrew Dolgov <[email protected]>2017-07-26 16:15:26 +0300
committerAndrew Dolgov <[email protected]>2017-07-26 16:15:26 +0300
commitc63095caf467c0959c13f2d772db1319767b467f (patch)
treef18550d23ecf32fecccd6c1105e18b9c0587f0ef /js
parent6ec52b5dda11acb8a6ea7bb06392ff67cb5ffba0 (diff)
offline_get_all: do not redownload already cached books
Diffstat (limited to 'js')
-rw-r--r--js/index.js13
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);
+ });
+ }
+
});
+
}
});
}