From eb1bc893bd5042d669e3b56032f2d3328de83fad Mon Sep 17 00:00:00 2001 From: Owen Leonard Date: Fri, 9 Apr 2021 15:44:28 +0000 Subject: [PATCH] Bug 27594: (follow-up) Check for secure context Signed-off-by: David Nind --- .../intranet-tmpl/prog/en/modules/tools/upload.tt | 28 ++++++++++++---------- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/upload.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/upload.tt index ae80f542ed..cebb6a7b51 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/upload.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/upload.tt @@ -469,19 +469,21 @@ SubmitMe('new'); }); - $(".get-file").on("click", function(e){ - e.preventDefault(); - if( navigator.clipboard && navigator.clipboard.writeText){ - navigator.clipboard.writeText( $(this).attr("href") ); - $(this).attr("data-original-title", _( "Link copied to the clipboard" ) ) - .tooltip("show"); - } - }); - $(".get-file").tooltip({ - delay: { "show": 100, "hide": 500 } - }).on("hidden.bs.tooltip", function(){ - $(this).attr("data-original-title", _( "Copy link to this file" ) ); - }); + if ( window.isSecureContext ) { + $(".get-file").on("click", function(e){ + e.preventDefault(); + if( navigator.clipboard && navigator.clipboard.writeText){ + navigator.clipboard.writeText( $(this).attr("href") ); + $(this).attr("data-original-title", _( "Link copied to the clipboard" ) ) + .tooltip("show"); + } + }); + $(".get-file").tooltip({ + delay: { "show": 100, "hide": 500 } + }).on("hidden.bs.tooltip", function(){ + $(this).attr("data-original-title", _( "Copy link to this file" ) ); + }); + } }); [% END %] -- 2.11.0