From 60b4bb1eabba0fef1b0eac7fbaa3619784314b5b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9rick?= Date: Mon, 9 Dec 2013 13:26:45 -0500 Subject: [PATCH] Use HTTPS Amazon images when Koha is using HTTPS. --- .../intranet-tmpl/prog/en/css/staff-global.css | 11 +++++ .../prog/en/includes/doc-head-close.inc | 7 +++ koha-tmpl/intranet-tmpl/prog/en/js/amazonimages.js | 15 +++++++ .../prog/en/modules/catalogue/detail.tt | 41 ++++++++++++++++---- .../prog/en/modules/catalogue/results.tt | 29 +++++--------- koha-tmpl/opac-tmpl/bootstrap/js/amazonimages.js | 13 +++--- koha-tmpl/opac-tmpl/ccsr/en/js/amazonimages.js | 13 +++--- .../opac-tmpl/prog/en/includes/shelfbrowser.inc | 6 ++- koha-tmpl/opac-tmpl/prog/en/js/amazonimages.js | 13 +++--- koha-tmpl/opac-tmpl/prog/en/modules/opac-detail.tt | 19 ++++++++- .../opac-tmpl/prog/en/modules/opac-opensearch.tt | 11 +++++- .../prog/en/modules/opac-readingrecord.tt | 8 +++- .../opac-tmpl/prog/en/modules/opac-results.tt | 12 +++++- .../opac-tmpl/prog/en/modules/opac-shelves.tt | 12 +++++- .../opac-tmpl/prog/en/modules/opac-showreviews.tt | 12 +++++- koha-tmpl/opac-tmpl/prog/en/modules/opac-user.tt | 25 +++++++++++- 16 files changed, 193 insertions(+), 54 deletions(-) create mode 100644 koha-tmpl/intranet-tmpl/prog/en/js/amazonimages.js diff --git a/koha-tmpl/intranet-tmpl/prog/en/css/staff-global.css b/koha-tmpl/intranet-tmpl/prog/en/css/staff-global.css index 755a02a..5c4927a 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/css/staff-global.css +++ b/koha-tmpl/intranet-tmpl/prog/en/css/staff-global.css @@ -2315,6 +2315,17 @@ div.authorizedheading { display: inline; } +span.no-image { + background-color : #FFF; + border: 1px solid #979797; + color : #AAA; + display:block; + font-size : 86%; + font-weight : bold; + text-align : center; + width : 75px; +} + #hierarchies a { font-weight: normal; text-decoration: underline; diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/doc-head-close.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/doc-head-close.inc index 5eabb6f..f6dda1a 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/includes/doc-head-close.inc +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/doc-head-close.inc @@ -57,3 +57,10 @@ var NO_LOCAL_JACKET = _("No cover image available"); //]]> [% END %] +[% IF ( AmazonCoverImages ) %] + + +[% END %] diff --git a/koha-tmpl/intranet-tmpl/prog/en/js/amazonimages.js b/koha-tmpl/intranet-tmpl/prog/en/js/amazonimages.js new file mode 100644 index 0000000..f91ecb0 --- /dev/null +++ b/koha-tmpl/intranet-tmpl/prog/en/js/amazonimages.js @@ -0,0 +1,15 @@ +// http://www.oreillynet.com/pub/a/javascript/2003/10/21/amazonhacks.html +function verify_images() { + $("img").each(function(i){ + if ((this.src.indexOf('images.amazon.com') >= 0) || (this.src.indexOf('g-images.amazon.com') >=0) + || (this.src.indexOf('syndetics.com') >=0) || (this.src.indexOf('images-na.ssl-images-amazon.com') >= 0)) { + w = this.width; + h = this.height; + if ((w == 1) || (h == 1)) { + $(this).parent().html(""+NO_AMAZON_IMAGE+""); + } else if ((this.complete != null) && (!this.complete)) { + $(this).parent().html(""+NO_AMAZON_IMAGE+""); + } + } + }); +} diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt index 26f945c..ef68776 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt @@ -27,7 +27,8 @@ // http://www.oreillynet.com/pub/a/javascript/2003/10/21/amazonhacks.html function verify_images() { $("#bookcoverimg img").each(function(i){ - if ((this.src.indexOf('images.amazon.com') >= 0) || (this.src.indexOf('g-images.amazon.com') >=0)) { + if ((this.src.indexOf('images.amazon.com') >= 0) || (this.src.indexOf('g-images.amazon.com') >=0) + || (this.src.indexOf('images-na.ssl-images-amazon.com') >= 0)) { w = this.width; h = this.height; if ((w == 1) || (h == 1)) { @@ -40,13 +41,14 @@ function verify_images() { } }); $("#editions img").each(function(i){ - if ((this.src.indexOf('images.amazon.com') >= 0) || (this.src.indexOf('g-images.amazon.com') >=0)) { + if ((this.src.indexOf('images.amazon.com') >= 0) || (this.src.indexOf('g-images.amazon.com') >=0) + || (this.src.indexOf('images-na.ssl-images-amazon.com') >= 0)) { w = this.width; h = this.height; if ((w == 1) || (h == 1)) { - this.src = 'http://g-images.amazon.com/images/G/01/x-site/icons/no-img-sm.gif'; + $(this).parent().html(""+NO_AMAZON_IMAGE+""); } else if ((this.complete != null) && (!this.complete)) { - this.src = 'http://g-images.amazon.com/images/G/01/x-site/icons/no-img-sm.gif'; + $(this).parent().html(""+NO_AMAZON_IMAGE+""); } } }); @@ -307,7 +309,6 @@ function verify_images() { [% IF ( XSLTDetailsDisplay ) %] [% XSLTBloc %] - [% IF ( GetShelves ) %] Lists that include this title: [% FOREACH GetShelve IN GetShelves %] @@ -332,7 +333,13 @@ function verify_images() { [% IF ( holdcount ) %]Holds: [% holdcount %][% ELSE %][% END %] [% IF ( AmazonCoverImages ) %]
- [% END %] + + [% IF ( using_https ) %] + + [% ELSE %] + + [% END %] + [% END %] [% ELSE %]

[% title |html %]

@@ -396,7 +403,14 @@ function verify_images() {
[% IF ( AmazonCoverImages ) %]
-
[% END %] + + [% IF ( using_https ) %] + + [% ELSE %] + + [% END %] + +[% END %]