summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Dolgov <[email protected]>2017-07-26 14:34:35 +0300
committerAndrew Dolgov <[email protected]>2017-07-26 14:34:35 +0300
commit6ec52b5dda11acb8a6ea7bb06392ff67cb5ffba0 (patch)
tree9a947d32c025c8c072fef143e77dbb1e28b067f5
parent73b159aa7864a29d2ed13f5b28382b37c649d840 (diff)
add a button to download all favs
-rw-r--r--index.php7
-rw-r--r--js/index.js19
2 files changed, 26 insertions, 0 deletions
diff --git a/index.php b/index.php
index f7bf169..203aa59 100644
--- a/index.php
+++ b/index.php
@@ -105,6 +105,12 @@
<li><a href="offline.html">Local</a></li>
</ul>
+ <?php if ($mode == "favorites") { ?>
+ <form onsubmit="return false;" class="navbar-form navbar-right">
+ <button type="submit" onclick="offline_get_all()" class="btn btn-primary">Get all</button>
+ </form>
+ <?php } ?>
+
<form class="navbar-form navbar-right">
<input type="text" name="query" class="form-control"
value="<?php echo htmlspecialchars($query) ?>">
@@ -116,6 +122,7 @@
<li><a href="logout.php">Logout</a></li>
</li>
+
</div>
</div>
diff --git a/js/index.js b/js/index.js
index 28e1227..2ec26f3 100644
--- a/js/index.js
+++ b/js/index.js
@@ -197,3 +197,22 @@ function show_summary(elem) {
return false;
}
+
+function offline_get_all() {
+
+ if (confirm("Download all books on this page?")) {
+
+ $(".index_cell").each(function (i, row) {
+ var bookId = $(row).attr("id").replace("cell-", "");
+ var dropitem = $(row).find(".offline_dropitem")[0];
+
+ if (bookId) {
+ offline_cache(bookId, function() {
+ mark_offline(dropitem);
+ });
+ }
+ });
+ }
+
+}
+