diff options
author | Andrew Dolgov <[email protected]> | 2017-03-05 23:05:42 +0300 |
---|---|---|
committer | Andrew Dolgov <[email protected]> | 2017-03-05 23:05:42 +0300 |
commit | 3cfa1d1cae9cc5dc1b4ca3210ae39a16e3c45ccf (patch) | |
tree | 67eedd3ee523d1561524d801c1865cca9c0c4ca9 /js/offline.js | |
parent | 237a9e913ddf1c281a62dc3fb144aa543c483fb0 (diff) |
add dropdown menu item to show book summary
Diffstat (limited to 'js/offline.js')
-rw-r--r-- | js/offline.js | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/js/offline.js b/js/offline.js index b6c8a24..e0138fb 100644 --- a/js/offline.js +++ b/js/offline.js @@ -112,6 +112,7 @@ function populate_list() { "More..." + "<span class=\"caret\"></span></a>"; cell += "<ul class=\"dropdown-menu\">"; + cell += "<li><a href=\"#\" data-book-id=\""+info.id+"\" onclick=\"show_summary(this)\">Summary</a></li>"; cell += "<li><a href=\"#\" data-book-id=\""+info.id+"\" onclick=\"offline_remove2(this)\">Remove offline data</a></li>"; cell += "</ul>"; @@ -163,3 +164,19 @@ function populate_list() { } +function show_summary(elem) { + var bookId = elem.getAttribute("data-book-id"); + + localforage.getItem("epube-book." + bookId).then(function(data) { + + var comment = data.comment ? data.comment : 'No description available'; + + $("#summary-modal .modal-title").html(data.title); + $("#summary-modal .book-summary").html(comment); + + $("#summary-modal").modal(); + + }); +} + + |