Koha/koha-tmpl/opac-tmpl/bootstrap/js/amazonimages.js
Owen Leonard 3d82116830
Bug 36566: Correct eslint errors in OPAC enhanced content JS
This patch fixes various eslint errors in enhanced content JS files:

- Consistent indentation
- Remove variables which are declared but not used
- Add missing semicolons
- Add missing "var" declarations

To test, apply the patch and clear your browser cache if necessary.

- Go to Administration -> System preferences and enable these
  preferences:
  - OPACAmazonCoverImages
  - BakerTaylorEnabled
  - GoogleJackets
  - OPACLocalCoverImages
  - OpenLibraryCovers
- Go to the OPAC and confirm that covers from these services appear
  correctly in search results and on detail pages.

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
2024-07-25 11:02:38 +01:00

16 lines
760 B
JavaScript

/* global __ */
/* exported verify_images */
// http://www.oreillynet.com/pub/a/javascript/2003/10/21/amazonhacks.html
function verify_images() {
$("img").each(function(){
if ((this.src.indexOf('images.amazon.com') >= 0) || (this.src.indexOf('g-images.amazon.com') >=0) || (this.src.indexOf('syndetics.com') >=0) ) {
var w = this.width;
var h = this.height;
if ((w == 1) || (h == 1)) {
$(this).parent().html("<span class=\"no-image\">"+ __("No cover image available") +"</span>");
} else if ((this.complete != null) && (!this.complete)) {
$(this).parent().html("<span class=\"no-image\">"+ __("No cover image available") +"</span>");
}
}
});
}