Bug 27594: (follow-up) Check for secure context

Signed-off-by: David Nind <david@davidnind.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit 3d10b9f16f)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
This commit is contained in:
Owen Leonard 2021-04-09 15:44:28 +00:00 committed by Fridolin Somers
parent dd2a60525d
commit be79e67996
1 changed files with 15 additions and 13 deletions

View File

@ -455,19 +455,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" ) );
});
}
});
</script>
[% END %]