7e293e20de
[Patch submitted by David Cook] Edmund, rather than myself, was the author of this patch, so I'm not entirely sure about his code choices, but...it looks like IE must process images differently than other browsers. It seems to me that the images are not appearing in IE, because they're being regarded as incomplete or having 0/NULL natural width. This patch simply introduces a try/catch hack where it tries to add the image and remove any "no-image" elements even nwhen the image is considered incomplete/width of 0/NULL. It won't do this if it catches any errors, although I'm not sure that any errors would be caught with this set up anyway... It's certainly not the ideal solution, but it's a solution. To Test: Before applying the patch: 1) Use IE and FF/Chrome/other browser to view a record with local images attached 2) Note that the local images appear in FF/Chrome/other, but not in IE Apply patch. After applying the patch: 1) Repeat step 1 from above 2) Note that the local images now appear in all browsers as they should. -- As I mentioned before, this seems like a real suboptimal solution. Any ideas on why IE might be considering local images to be incomplete or having 0/NULL natural width? Signed-off-by: David Cook <dcook@prosentient.com.au> Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de> I did a regression test using Chromium and Firefox in Ubuntu. I checked both prog and CCSR - covers displayed nicely. All tests and QA script pass. Signed-off-by: Jared Camins-Esakov <jcamins@cpbibliography.com> Changed author of patch to reflect actual authorship.
51 lines
1.9 KiB
JavaScript
51 lines
1.9 KiB
JavaScript
if (typeof KOHA == "undefined" || !KOHA) {
|
|
var KOHA = {};
|
|
}
|
|
|
|
/**
|
|
* A namespace for local cover related functions.
|
|
*/
|
|
KOHA.LocalCover = {
|
|
|
|
|
|
/**
|
|
* Search all:
|
|
* <div title="biblionumber" id="isbn" class="openlibrary-thumbnail"></div>
|
|
* or
|
|
* <div title="biblionumber" id="isbn" class="openlibrary-thumbnail-preview"></div>
|
|
* and run a search with all collected isbns to Open Library Book Search.
|
|
* The result is asynchronously returned by OpenLibrary and catched by
|
|
* olCallBack().
|
|
*/
|
|
GetCoverFromBibnumber: function(uselink) {
|
|
$("div[id^=local-thumbnail],span[id^=local-thumbnail]").each(function(i) {
|
|
var mydiv = this;
|
|
var message = document.createElement("span");
|
|
$(message).attr("class","no-image");
|
|
$(message).html(NO_LOCAL_JACKET);
|
|
$(mydiv).append(message);
|
|
var img = $("<img />").attr('src',
|
|
'/cgi-bin/koha/opac-image.pl?thumbnail=1&biblionumber=' + $(mydiv).attr("class"))
|
|
.load(function () {
|
|
if (!this.complete || typeof this.naturalWidth == "undefined" || this.naturalWidth == 0) {
|
|
//IE HACK
|
|
try {
|
|
$(mydiv).append(img);
|
|
$(mydiv).children('.no-image').remove();
|
|
}
|
|
catch(err){
|
|
};
|
|
} else {
|
|
if (uselink) {
|
|
var a = $("<a />").attr('href', '/cgi-bin/koha/opac-imageviewer.pl?biblionumber=' + $(mydiv).attr("class"));
|
|
$(a).append(img);
|
|
$(mydiv).append(a);
|
|
} else {
|
|
$(mydiv).append(img);
|
|
}
|
|
$(mydiv).children('.no-image').remove();
|
|
}
|
|
})
|
|
});
|
|
}
|
|
};
|