From 9e332f95ab2389c93281bbf94efb2e21e4b96e30 Mon Sep 17 00:00:00 2001 From: Owen Leonard Date: Thu, 3 Jan 2013 12:53:23 -0500 Subject: [PATCH] Bug 7657 - Google and OpenLibrary image conflict The JavaScript files which output Google and OpenLibrary cover images each assumes it is the only source for cover images running. Each script isn't specific enough to filter out markup generated by the other. This patch corrects the specificity of the selector looking for markup related to Google and OpenLibrary covers. To test, enable both Google and OpenLibrary cover images in the OPAC. Perform a search which will return results which include titles which have covers from both services. Confirm that these covers appear correctly and that "no cover" information still works correctly. Signed-off-by: Kyle M Hall Signed-off-by: Jonathan Druart Signed-off-by: Jared Camins-Esakov Added corrected Javascript to CCSR theme. Signed-off-by: Jared Camins-Esakov --- koha-tmpl/opac-tmpl/ccsr/en/js/google-jackets.js | 5 +++-- koha-tmpl/opac-tmpl/ccsr/en/js/openlibrary.js | 4 ++-- koha-tmpl/opac-tmpl/prog/en/js/google-jackets.js | 5 +++-- koha-tmpl/opac-tmpl/prog/en/js/openlibrary.js | 4 ++-- 4 files changed, 10 insertions(+), 8 deletions(-) diff --git a/koha-tmpl/opac-tmpl/ccsr/en/js/google-jackets.js b/koha-tmpl/opac-tmpl/ccsr/en/js/google-jackets.js index 70b1b84337..f129c3805e 100644 --- a/koha-tmpl/opac-tmpl/ccsr/en/js/google-jackets.js +++ b/koha-tmpl/opac-tmpl/ccsr/en/js/google-jackets.js @@ -19,7 +19,7 @@ KOHA.Google = { */ GetCoverFromIsbn: function(newWindow) { var bibkeys = []; - $("div [id^=gbs-thumbnail]").each(function(i) { + $("[id^=gbs-thumbnail]").each(function(i) { bibkeys.push($(this).attr("class")); // id=isbn }); bibkeys = bibkeys.join(','); @@ -45,7 +45,7 @@ KOHA.Google = { } for (id in booksInfo) { var book = booksInfo[id]; - $("."+book.bib_key).each(function() { + $("[id^=gbs-thumbnail]."+book.bib_key).each(function() { var a = document.createElement("a"); a.href = book.info_url; if (typeof(book.thumbnail_url) != "undefined") { @@ -71,5 +71,6 @@ KOHA.Google = { } }); } + } }; diff --git a/koha-tmpl/opac-tmpl/ccsr/en/js/openlibrary.js b/koha-tmpl/opac-tmpl/ccsr/en/js/openlibrary.js index e5b9d2835c..c07ba3b6b2 100644 --- a/koha-tmpl/opac-tmpl/ccsr/en/js/openlibrary.js +++ b/koha-tmpl/opac-tmpl/ccsr/en/js/openlibrary.js @@ -19,7 +19,7 @@ KOHA.OpenLibrary = { */ GetCoverFromIsbn: function() { var bibkeys = []; - $("div [id^=openlibrary-thumbnail]").each(function(i) { + $("[id^=openlibrary-thumbnail]").each(function(i) { bibkeys.push("ISBN:" + $(this).attr("class")); // id=isbn }); bibkeys = bibkeys.join(','); @@ -40,7 +40,7 @@ KOHA.OpenLibrary = { for (id in booksInfo) { var book = booksInfo[id]; var isbn = id.substring(5); - $("."+isbn).each(function() { + $("[id^=openlibrary-thumbnail]."+isbn).each(function() { var is_opacdetail = /openlibrary-thumbnail-preview/.exec($(this).attr("id")); var a = document.createElement("a"); a.href = booksInfo.url; diff --git a/koha-tmpl/opac-tmpl/prog/en/js/google-jackets.js b/koha-tmpl/opac-tmpl/prog/en/js/google-jackets.js index 70b1b84337..f129c3805e 100644 --- a/koha-tmpl/opac-tmpl/prog/en/js/google-jackets.js +++ b/koha-tmpl/opac-tmpl/prog/en/js/google-jackets.js @@ -19,7 +19,7 @@ KOHA.Google = { */ GetCoverFromIsbn: function(newWindow) { var bibkeys = []; - $("div [id^=gbs-thumbnail]").each(function(i) { + $("[id^=gbs-thumbnail]").each(function(i) { bibkeys.push($(this).attr("class")); // id=isbn }); bibkeys = bibkeys.join(','); @@ -45,7 +45,7 @@ KOHA.Google = { } for (id in booksInfo) { var book = booksInfo[id]; - $("."+book.bib_key).each(function() { + $("[id^=gbs-thumbnail]."+book.bib_key).each(function() { var a = document.createElement("a"); a.href = book.info_url; if (typeof(book.thumbnail_url) != "undefined") { @@ -71,5 +71,6 @@ KOHA.Google = { } }); } + } }; diff --git a/koha-tmpl/opac-tmpl/prog/en/js/openlibrary.js b/koha-tmpl/opac-tmpl/prog/en/js/openlibrary.js index e5b9d2835c..c07ba3b6b2 100644 --- a/koha-tmpl/opac-tmpl/prog/en/js/openlibrary.js +++ b/koha-tmpl/opac-tmpl/prog/en/js/openlibrary.js @@ -19,7 +19,7 @@ KOHA.OpenLibrary = { */ GetCoverFromIsbn: function() { var bibkeys = []; - $("div [id^=openlibrary-thumbnail]").each(function(i) { + $("[id^=openlibrary-thumbnail]").each(function(i) { bibkeys.push("ISBN:" + $(this).attr("class")); // id=isbn }); bibkeys = bibkeys.join(','); @@ -40,7 +40,7 @@ KOHA.OpenLibrary = { for (id in booksInfo) { var book = booksInfo[id]; var isbn = id.substring(5); - $("."+isbn).each(function() { + $("[id^=openlibrary-thumbnail]."+isbn).each(function() { var is_opacdetail = /openlibrary-thumbnail-preview/.exec($(this).attr("id")); var a = document.createElement("a"); a.href = booksInfo.url; -- 2.11.0