summaryrefslogtreecommitdiff
path: root/js
diff options
context:
space:
mode:
authorAndrew Dolgov <[email protected]>2017-02-26 17:37:37 +0300
committerAndrew Dolgov <[email protected]>2017-02-26 17:37:37 +0300
commit6f11b1d2856359aaca5f7ecc27eec8f27e6d8ce6 (patch)
treec1df684dd1896cacfb0ad84833def598530bdf87 /js
parente3c6ca80943ef45079ab0557e9b7a985146d21eb (diff)
do not regenerate entire offline list when something is removed
Diffstat (limited to 'js')
-rw-r--r--js/common.js3
-rw-r--r--js/index.js2
-rw-r--r--js/offline.js8
3 files changed, 8 insertions, 5 deletions
diff --git a/js/common.js b/js/common.js
index 34467ae..a400a17 100644
--- a/js/common.js
+++ b/js/common.js
@@ -1,8 +1,7 @@
-function offline_remove(elem, callback) {
+function offline_remove(id, callback) {
if (confirm("Remove download?")) {
- var id = elem.getAttribute("data-book-id");
var cacheId = "epube-book." + id;
var promises = [];
diff --git a/js/index.js b/js/index.js
index 5c138c2..87279c2 100644
--- a/js/index.js
+++ b/js/index.js
@@ -9,7 +9,7 @@ function mark_offline_books() {
if (book) {
elem.onclick = function() {
- offline_remove(elem, function() {
+ offline_remove(bookId, function() {
mark_offline_books();
});
};
diff --git a/js/offline.js b/js/offline.js
index 90a3132..959982c 100644
--- a/js/offline.js
+++ b/js/offline.js
@@ -1,5 +1,9 @@
function offline_remove2(elem) {
- return offline_remove(elem, populate_list);
+ var bookId = elem.getAttribute("data-book-id");
+
+ return offline_remove(bookId, function() {
+ $("#cell-" + bookId).remove();
+ });
}
function populate_list() {
@@ -35,7 +39,7 @@ function populate_list() {
is_read = lastread.total > 0 && lastread.total - lastread.page < 5;
}
- var cell = "<div class='col-xs-6 col-sm-3 col-md-2 index_cell'>";
+ var cell = "<div class='col-xs-6 col-sm-3 col-md-2 index_cell' id=\"cell-"+info.id+"\">";
var cover_read = is_read ? "read" : "";
var title_class = in_progress ? "in_progress" : "";