From 81836c0ddea8879b7914de91902dfc397504d42f 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 Signed-off-by: Jonathan Druart (cherry picked from commit 3d10b9f16fe339776fdfe484a8d9ac67385d0d3b) Signed-off-by: Fridolin Somers (cherry picked from commit be79e679960fea53f4b30507274d967f703e2daa) Signed-off-by: Andrew Fuerste-Henry --- .../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 eb5c6d69e1..19fb945ecc 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/upload.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/upload.tt @@ -432,19 +432,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.39.5