diff options
-rw-r--r-- | index.php | 2 | ||||
-rw-r--r-- | js/index.js | 22 | ||||
-rw-r--r-- | js/offline.js | 20 |
3 files changed, 26 insertions, 18 deletions
@@ -241,7 +241,7 @@ $cover_link = "backend.php?" . http_build_query(["op" => "cover", "id" => $line["id"], "ts" => $cover_mtime]); } else { - $cover_link = "holder.js/120x180"; + $cover_link = ""; } $author_link = "?" . http_build_query(["query" => $line["author_sort"]]); diff --git a/js/index.js b/js/index.js index 5bafdca..ea8c763 100644 --- a/js/index.js +++ b/js/index.js @@ -93,18 +93,24 @@ function mark_offline_books() { /* exported show_covers */ function show_covers() { - $("img[data-cover-link]").each((i,e) => { + $("img[data-book-id]").each((i,e) => { e = $(e); - const img = $("<img>") - .on("load", function() { - e.css("background-image", "url(" + e.attr('data-cover-link') + ")") - e.fadeIn(); + if (e.attr('data-cover-link')) { + const img = $("<img>") + .on("load", function() { + e.css("background-image", "url(" + e.attr('data-cover-link') + ")") + .fadeIn(); - img.attr("src", null); - }) - .attr("src", e.attr('data-cover-link')); + img.attr("src", null); + }) + .attr("src", e.attr('data-cover-link')); + } else { + e.attr('src', 'holder.js/130x190?auto=yes').fadeIn(); + } }); + + Holder.run(); } function offline_cache(bookId, callback) { diff --git a/js/offline.js b/js/offline.js index e8af78b..5ad5088 100644 --- a/js/offline.js +++ b/js/offline.js @@ -117,20 +117,22 @@ function populate_list() { </div>`); if (cover) { - cell.find("img") .css("background-image", "url(" + cover + ")") .fadeIn(); + } else { + cell + .find("img").attr("data-src", 'holder.js/130x190?auto=yes') + .fadeIn(); + } - cell.find(".series_link") - .attr("title", info.series_name + " [" + info.series_index + "]") - .attr("href", "offline.html?query=" + encodeURIComponent(info.series_name)); - - cell.find(".author_link") - .attr("title", info.author_sort) - .attr("href", "offline.html?query=" + encodeURIComponent(info.author_sort)); + cell.find(".series_link") + .attr("title", info.series_name + " [" + info.series_index + "]") + .attr("href", "offline.html?query=" + encodeURIComponent(info.series_name)); - } + cell.find(".author_link") + .attr("title", info.author_sort) + .attr("href", "offline.html?query=" + encodeURIComponent(info.author_sort)); books.append(cell); |