From b49f20af95ebfbf44ba7e039b2aa660fc025a035 Mon Sep 17 00:00:00 2001 From: Michael Kaufmann Date: Wed, 27 Mar 2024 12:59:48 +0100 Subject: [PATCH] fix copy-to-clipboard button Signed-off-by: Michael Kaufmann --- templates/Froxlor/assets/js/jquery/global.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/templates/Froxlor/assets/js/jquery/global.js b/templates/Froxlor/assets/js/jquery/global.js index 067c4dffc6..5127dace48 100644 --- a/templates/Froxlor/assets/js/jquery/global.js +++ b/templates/Froxlor/assets/js/jquery/global.js @@ -12,9 +12,14 @@ export default function () { new bootstrap.Popover($(this)); }) + if (!window.isSecureContext) { + // hide all copyClipboard buttons as this only works in a secure context + $('.copyClipboard').hide(); + } + $('.copyClipboard').on('click', function (e) { e.preventDefault(); - const source_element = $(this).data('clipboard-source').text(); + const source_element = $(this).data('clipboard-source'); navigator.clipboard.writeText($('#' + source_element).text().trim()); })