From 4f1c7a977ba958b6def28b2ca42bcaef83286e4f Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Fri, 15 Mar 2019 13:54:02 +0300 Subject: code/layout cleanup --- js/index.js | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) (limited to 'js/index.js') diff --git a/js/index.js b/js/index.js index a16dd44..5bafdca 100644 --- a/js/index.js +++ b/js/index.js @@ -91,6 +91,22 @@ function mark_offline_books() { }); } +/* exported show_covers */ +function show_covers() { + $("img[data-cover-link]").each((i,e) => { + e = $(e); + + const img = $("") + .on("load", function() { + e.css("background-image", "url(" + e.attr('data-cover-link') + ")") + e.fadeIn(); + + img.attr("src", null); + }) + .attr("src", e.attr('data-cover-link')); + }); +} + function offline_cache(bookId, callback) { console.log("offline cache: " + bookId); @@ -187,7 +203,7 @@ function offline_get_all() { if (confirm("Download all books on this page?")) { - $(".index_cell").each(function (i, row) { + $(".row > div").each(function (i, row) { const bookId = $(row).attr("id").replace("cell-", ""); const dropitem = $(row).find(".offline_dropitem")[0]; -- cgit v1.2.3