From ceb2f000c5edadb2f5205124ff064ad033bc8174 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 --- .../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 6bab6e1004..ba01b642c2 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