fix copy-to-clipboard button

Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
This commit is contained in:
Michael Kaufmann
2024-03-27 12:59:48 +01:00
parent 1f4f1d8203
commit b49f20af95

View File

@@ -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());
})