From: Dan Scott Date: Thu, 2 Jun 2011 02:18:42 +0000 (-0400) Subject: Add some style to the OpenLibrary read links X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=ad1741744d2b10bf68ba5b43019bf53b0752fb5d;p=working%2FEvergreen.git Add some style to the OpenLibrary read links George Oates provided an OpenLibrary GIF to use for the links, and we can drop the links right into the block of white space between copy counts and bibliographic info. Also a bit of refactoring to reduce code duplication. Signed-off-by: Dan Scott --- diff --git a/Open-ILS/web/opac/images/openlibrary.gif b/Open-ILS/web/opac/images/openlibrary.gif new file mode 100644 index 0000000000..9ac053d173 Binary files /dev/null and b/Open-ILS/web/opac/images/openlibrary.gif differ diff --git a/Open-ILS/web/opac/skin/default/js/result_common.js b/Open-ILS/web/opac/skin/default/js/result_common.js index 93cc3bb144..809579f025 100644 --- a/Open-ILS/web/opac/skin/default/js/result_common.js +++ b/Open-ILS/web/opac/skin/default/js/result_common.js @@ -716,51 +716,50 @@ function renderOpenLibraryLinks(response) { }); /* Now populate the results page with our ebook goodness*/ - var ol_span = $n(document.documentElement, 'openLibraryLink-' + isbn); - - dojo.removeClass(ol_span, 'hide_me'); /* Go for the jugular - exact match with full access */ if (ol_ebooks[isbn]['exact_full']) { - var ol_a_span = dojo.create('a', { - "href": ol_ebooks[isbn]['exact_full'], - "class": "classic_link" - }, ol_span + createOpenLibraryLink( + isbn, ol_ebooks[isbn]['exact_full'], 'Read online' ); - ol_a_span.appendChild(dojo.doc.createTextNode('Read online')); - dojo.removeClass(ol_span, 'hide_me'); continue; } /* Fall back to slightly less palatable options */ else if (ol_ebooks[isbn]['exact_lendable']) { - var ol_a_span = dojo.create('a', { - "href": ol_ebooks[isbn]['exact_lendable'], - "class": "classic_link" - }, ol_span + createOpenLibraryLink( + isbn, ol_ebooks[isbn]['exact_lendable'], 'Borrow online' ); - ol_a_span.appendChild(dojo.doc.createTextNode('Borrow online')); } if (ol_ebooks[isbn]['similar_full']) { - var ol_a_span = dojo.create('a', { - "href": ol_ebooks[isbn]['similar_full'], - "class": "classic_link" - }, ol_span + createOpenLibraryLink( + isbn, ol_ebooks[isbn]['similar_full'], 'Read similar online' ); - ol_a_span.appendChild(dojo.doc.createTextNode('Read similar online')); } else if (ol_ebooks[isbn]['similar_lendable']) { - var ol_a_span = dojo.create('a', { - "href": ol_ebooks[isbn]['similar_lendable'], - "class": "classic_link" - }, ol_span + createOpenLibraryLink( + isbn, ol_ebooks[isbn]['similar_full'], 'Borrow similar online' ); - ol_a_span.appendChild(dojo.doc.createTextNode('Borrow similar online')); } - - dojo.removeClass(ol_span, 'hide_me'); } } +function createOpenLibraryLink(isbn, url, text) { + var ol_span = $n(document.documentElement, 'openLibraryLink-' + isbn); + + var ol_a_span = dojo.create('a', { + "href": url, + "class": "classic_link" + }, ol_span + ); + dojo.create('img', { + "src": "/opac/images/openlibrary.gif" + }, ol_a_span + ); + dojo.create('br', null, ol_a_span); + ol_a_span.appendChild(dojo.doc.createTextNode(text)); + dojo.removeClass(ol_span, 'hide_me'); +} + function fetchGoogleBooksLink () { if (isbnList.length > 0 && googleBooksLink) { var scriptElement = document.createElement("script"); diff --git a/Open-ILS/web/opac/skin/default/xml/result/result_table.xml b/Open-ILS/web/opac/skin/default/xml/result/result_table.xml index e45a9c41c1..0249cba2aa 100644 --- a/Open-ILS/web/opac/skin/default/xml/result/result_table.xml +++ b/Open-ILS/web/opac/skin/default/xml/result/result_table.xml @@ -44,6 +44,8 @@ + + @@ -55,8 +57,6 @@ - -