From 3d10b9f16fe339776fdfe484a8d9ac67385d0d3b 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 --- .../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 483d9a18db..5de1586850 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.39.5