From 4a86025c88500d171b04ac321eadf2f5d23e424b Mon Sep 17 00:00:00 2001 From: Dan Scott Date: Sun, 16 Apr 2017 22:27:52 -0400 Subject: [PATCH] LP#1685840: Dojoless Google Books Preview Avoid polluting the global namespace by wrapping the code in (function() {})(). Add event listeners to the DOM elements rather than the crufty href=javascript:function approach. Optimization: do not load the Google Books JSAPI unless there is a matching embedded ISBN. Use display style directly, rather than munging class names with hide_me Supports IE 10/11, which does not handle responseType = 'json', through the fallback to XHR responseText. IE9 for now; it seems the new Google Books Loader wipes out the DOM in IE9 instead of loading nicely in the . Could go back to the old Google JS loader, which still works, but is deprecated, so could disappear at any point. Signed-off-by: Dan Scott Signed-off-by: Ben Shum --- Open-ILS/src/templates/opac/css/style.css.tt2 | 4 + .../src/templates/opac/parts/ac_google_books.tt2 | 241 ++++++++++++--------- .../src/templates/opac/parts/record/extras.tt2 | 9 +- 3 files changed, 143 insertions(+), 111 deletions(-) diff --git a/Open-ILS/src/templates/opac/css/style.css.tt2 b/Open-ILS/src/templates/opac/css/style.css.tt2 index aba12de235..3daeb4985a 100644 --- a/Open-ILS/src/templates/opac/css/style.css.tt2 +++ b/Open-ILS/src/templates/opac/css/style.css.tt2 @@ -774,6 +774,10 @@ div.format_icon { margin:0; } +#gbp_extra, #gbp_arrow_down_link { + display: none; +} + .almost-content-wrapper { background: [% css_colors.background %]; } diff --git a/Open-ILS/src/templates/opac/parts/ac_google_books.tt2 b/Open-ILS/src/templates/opac/parts/ac_google_books.tt2 index a03bfb9c5b..c5a13031ff 100644 --- a/Open-ILS/src/templates/opac/parts/ac_google_books.tt2 +++ b/Open-ILS/src/templates/opac/parts/ac_google_books.tt2 @@ -1,132 +1,161 @@ - diff --git a/Open-ILS/src/templates/opac/parts/record/extras.tt2 b/Open-ILS/src/templates/opac/parts/record/extras.tt2 index 04cdd141e0..b35cf5471d 100644 --- a/Open-ILS/src/templates/opac/parts/record/extras.tt2 +++ b/Open-ILS/src/templates/opac/parts/record/extras.tt2 @@ -8,14 +8,13 @@ IF ctx.google_books_preview; label = l('Google Preview'); name = 'google_preview'; - href = 'javascript:GBDisplayPreview();'; %] -
[% END %] -- 2.11.0