Skip to content

Commit

Permalink
fix copy-to-clipboard button
Browse files Browse the repository at this point in the history
Signed-off-by: Michael Kaufmann <[email protected]>
  • Loading branch information
d00p committed Mar 27, 2024
1 parent 1f4f1d8 commit b49f20a
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion templates/Froxlor/assets/js/jquery/global.js
Original file line number Diff line number Diff line change
Expand Up @@ -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());
})

Expand Down

0 comments on commit b49f20a

Please sign in to comment.