From ad1741744d2b10bf68ba5b43019bf53b0752fb5d Mon Sep 17 00:00:00 2001 From: Dan Scott Date: Wed, 1 Jun 2011 22:18:42 -0400 Subject: [PATCH] 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 --- Open-ILS/web/opac/images/openlibrary.gif | Bin 0 -> 1406 bytes Open-ILS/web/opac/skin/default/js/result_common.js | 51 ++++++++++----------- .../opac/skin/default/xml/result/result_table.xml | 4 +- 3 files changed, 27 insertions(+), 28 deletions(-) create mode 100644 Open-ILS/web/opac/images/openlibrary.gif diff --git a/Open-ILS/web/opac/images/openlibrary.gif b/Open-ILS/web/opac/images/openlibrary.gif new file mode 100644 index 0000000000000000000000000000000000000000..9ac053d173b1f5d6a28481b6a977be3a713ae670 GIT binary patch literal 1406 zcmZQzU<5(|0R}M0U}azs1F|%L7$l?s#Ec9aKoZP=&`9jftLKBo{{R2a5aQ>;uqu}s zp=Ojd8UmvsFsws>5go9g07euZn8U=v0zynoKnl!;QXpX%AIO3-!GaJjSPxV)LO+@X zXcmH8#{hF8i~*%#T&M~J7c79xWn^S#h8Y5(;e24R$I!rtKZ-%}@4quJe1Fft@cTXk N!{7Z34FBpO7yvy$7r6ic literal 0 HcmV?d00001 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 @@ - -
-- 2.11.0