From ba6a7bbccdc2a543f411961b9491bf978acd4ec1 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Sun, 1 Jan 2023 08:45:34 +0530 Subject: [PATCH] Content server home page: When showing recently read books from across devices hide the entries for which loading the cover fails --- src/pyj/book_list/home.pyj | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/pyj/book_list/home.pyj b/src/pyj/book_list/home.pyj index c9e0f19ecc..f292e24954 100644 --- a/src/pyj/book_list/home.pyj +++ b/src/pyj/book_list/home.pyj @@ -132,12 +132,12 @@ def show_recent_for_user(container_id): if item.cfi: q.bookpos = item.cfi url_to_read = open_book_url(item.book_id, item.format, q) + img = E.img(alt=item.tooltip, src=absolute_path(f'get/cover/{item.book_id}/{item.library_id}')) images.appendChild(E.div(style='margin: 0 1em', - E.a( - title=item.tooltip, - href=url_to_read, - E.img(alt=item.tooltip, src=absolute_path(f'get/cover/{item.book_id}/{item.library_id}')) - ))) + E.a(title=item.tooltip, href=url_to_read, img))) + img.onerror = def(err): + failed = err.target + failed.parentNode.parentNode.style.display = 'none' def show_recent_stage2(books):