From a99e3b980264d60d3193ca965666a4989b149f85 Mon Sep 17 00:00:00 2001
From: Barry Cannon <bc@interleaf.ie>
Date: Mon, 1 Feb 2016 11:34:35 +0000
Subject: [PATCH] Bug 14523 - Google jackets being blocked when OPAC using
 HTTPS
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Get the protocol of the current URL. This results is the correct prefix
being used to serve the google jackets regarless of koha apache server
setup.

Signed-off-by: Frédéric Demians <f.demians@tamil.fr>
---
 koha-tmpl/opac-tmpl/bootstrap/js/google-jackets.js | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/koha-tmpl/opac-tmpl/bootstrap/js/google-jackets.js b/koha-tmpl/opac-tmpl/bootstrap/js/google-jackets.js
index b23599f..0a2669c 100644
--- a/koha-tmpl/opac-tmpl/bootstrap/js/google-jackets.js
+++ b/koha-tmpl/opac-tmpl/bootstrap/js/google-jackets.js
@@ -27,7 +27,7 @@ KOHA.Google = {
         this.openInNewWindow=newWindow;
         scriptElement.setAttribute("id", "jsonScript");
         scriptElement.setAttribute("src",
-            "http://books.google.com/books?bibkeys=" + escape(bibkeys) +
+            location.protocol + "//books.google.com/books?bibkeys=" + escape(bibkeys) +
             "&jscmd=viewapi&callback=KOHA.Google.gbsCallBack");
         scriptElement.setAttribute("type", "text/javascript");
         document.documentElement.firstChild.appendChild(scriptElement);
@@ -59,7 +59,8 @@ KOHA.Google = {
                              '<a '+target+'href="' +
                              book.info_url +
                              '"><img src="' +
-                             'http://books.google.com/intl/en/googlebooks/images/gbs_preview_sticker1.gif' +
+                             location.protocol +
+							 '//books.google.com/intl/en/googlebooks/images/gbs_preview_sticker1.gif' +
                              '"></a></div>'
                              );
                      }
-- 
2.7.0