From 4ba712725fd11023b6e95c1c6cc4e401abf53cf1 Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Thu, 23 Apr 2020 14:14:05 +0300 Subject: fix App.Offline.getAll() --- js/app.js | 48 ++++++++++++++++++++++++------------------------ 1 file changed, 24 insertions(+), 24 deletions(-) (limited to 'js') diff --git a/js/app.js b/js/app.js index 941ed1b..793c9f9 100644 --- a/js/app.js +++ b/js/app.js @@ -248,6 +248,30 @@ const App = { App.Offline.populateList(); }, + getAll: function() { + if (confirm("Download all books on this page?")) { + + $(".row > div").each(function (i, row) { + const bookId = $(row).attr("id").replace("cell-", ""); + const dropitem = $(row).find(".offline_dropitem")[0]; + + if (bookId) { + + const cacheId = 'epube-book.' + bookId; + localforage.getItem(cacheId).then(function(book) { + + if (!book) { + App.Offline.get(bookId, function() { + App.Offline.mark(dropitem); + }); + } + + }); + + } + }); + } + }, markBooks: function() { const elems = $(".offline_dropitem"); @@ -452,30 +476,6 @@ const App = { }); } }, - getAll: function() { - if (confirm("Download all books on this page?")) { - - $(".row > div").each(function (i, row) { - const bookId = $(row).attr("id").replace("cell-", ""); - const dropitem = $(row).find(".offline_dropitem")[0]; - - if (bookId) { - - const cacheId = 'epube-book.' + bookId; - localforage.getItem(cacheId).then(function(book) { - - if (!book) { - App.Offline.get(bookId, function() { - App.Offline.mark(dropitem); - }); - } - - }); - - } - }); - } - }, get: function(bookId, callback) { console.log("offline cache: " + bookId); -- cgit v1.2.3