From c63095caf467c0959c13f2d772db1319767b467f Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Wed, 26 Jul 2017 16:15:26 +0300 Subject: offline_get_all: do not redownload already cached books --- js/index.js | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'js') 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); + }); + } + }); + } }); } -- cgit v1.2.3