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 +++++++++++++++++- js/offline.js | 34 ++++++++++++++++++---------------- 2 files changed, 35 insertions(+), 17 deletions(-) (limited to '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]; diff --git a/js/offline.js b/js/offline.js index c47c7b6..afde6b5 100644 --- a/js/offline.js +++ b/js/offline.js @@ -98,29 +98,31 @@ function populate_list() { const series_link = info.series_name ? `
${info.series_name + " [" + info.series_index + "]"}
` : ""; - const cell = $(`
-
+ const cell = $(`
+ +
+ + + ${series_link} +
+
`); if (cover) { - cell.find("img").attr("src", cover); + cell.find("img") + .css("background-image", "url(" + cover + ")") + .fadeIn(); cell.find(".series_link") .attr("title", info.series_name + " [" + info.series_index + "]") -- cgit v1.2.3