From 3cfa1d1cae9cc5dc1b4ca3210ae39a16e3c45ccf Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Sun, 5 Mar 2017 23:05:42 +0300 Subject: add dropdown menu item to show book summary --- css/index.css | 3 ++- index.php | 21 +++++++++++++++++++++ js/index.js | 15 +++++++++++++++ js/offline.js | 17 +++++++++++++++++ offline.html | 19 +++++++++++++++++++ 5 files changed, 74 insertions(+), 1 deletion(-) diff --git a/css/index.css b/css/index.css index b3231ad..484b21d 100644 --- a/css/index.css +++ b/css/index.css @@ -24,7 +24,8 @@ white-space : nowrap; } -.qtip-custom { +.qtip-custom, .book-summary { max-height : 250px; overflow : auto; } + diff --git a/index.php b/index.php index 38f1dd5..d67a39e 100644 --- a/index.php +++ b/index.php @@ -103,6 +103,24 @@
+ + + --> +
  • ">Summary
  • +
  • " class="offline_dropitem">
  • diff --git a/js/index.js b/js/index.js index 349794a..ac418da 100644 --- a/js/index.js +++ b/js/index.js @@ -150,6 +150,21 @@ function init_tooltips() { } } }); +} + +function show_summary(elem) { + var id = elem.getAttribute("data-book-id"); + + $.post("backend.php", {op: 'getinfo', id: id}, 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(); + + }); } 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..." + ""; cell += ""; @@ -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(); + + }); +} + + diff --git a/offline.html b/offline.html index 429b776..cc98443 100644 --- a/offline.html +++ b/offline.html @@ -80,6 +80,25 @@
    + + + +
    -- cgit v1.2.3