Bugzilla – Attachment 103033 Details for
Bug 25016
Coce should not return a 1-pixel Amazon cover image
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 25016: Coce should not return a 1-pixel Amazon cover image
Bug-25016-Coce-should-not-return-a-1-pixel-Amazon-.patch (text/plain), 1.72 KB, created by
Lucas Gass (lukeg)
on 2020-04-15 20:45:15 UTC
(
hide
)
Description:
Bug 25016: Coce should not return a 1-pixel Amazon cover image
Filename:
MIME Type:
Creator:
Lucas Gass (lukeg)
Created:
2020-04-15 20:45:15 UTC
Size:
1.72 KB
patch
obsolete
>From f99cee3252e1ac331c68d40ba01e044330dec8a7 Mon Sep 17 00:00:00 2001 >From: Owen Leonard <oleonard@myacpl.org> >Date: Sun, 29 Mar 2020 00:19:39 +0000 >Subject: [PATCH] Bug 25016: Coce should not return a 1-pixel Amazon cover > image > >This patch adds an onload function to the JavaScript which loads images >from Coce. In the case where the image is 1 x 1 pixel the image should >be removed. > >To test you should have Coce enabled and Amazon.com included in the list >of sources. > > - Apply the patch and view the bibliographic details page under a > variety of conditions: > - A title which has a matching Amazon image: > - The image should load as expected. > - A title which doesn't have a matching Amazon image > - The image should not be found in the source at all after the page > has loaded. > - Test with local cover images enabled > >Signed-off-by: Lucas Gass <lucas@bywatersolutions.com> >--- > koha-tmpl/intranet-tmpl/js/coce.js | 8 +++++++- > 1 file changed, 7 insertions(+), 1 deletion(-) > >diff --git a/koha-tmpl/intranet-tmpl/js/coce.js b/koha-tmpl/intranet-tmpl/js/coce.js >index daa21b72d5..930d7c1647 100644 >--- a/koha-tmpl/intranet-tmpl/js/coce.js >+++ b/koha-tmpl/intranet-tmpl/js/coce.js >@@ -33,7 +33,13 @@ KOHA.coce = { > var img = document.createElement("img"); > img.src = url; > img.classList.add("thumbnail"); >- img.title = url; //FIXME: to delete >+ img.alt = "Cover image"; >+ img.onload = function(){ >+ // image dimensions can't be known until image has loaded >+ if( img.height == 1 && img.width == 1 ){ >+ $(this).remove(); >+ } >+ } > $(this).html(img); > }); > } >-- >2.11.0
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 25016
:
102058
|
103033
|
103078
|
103082