fix copy-to-clipboard button
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
This commit is contained in:
7
templates/Froxlor/assets/js/jquery/global.js
vendored
7
templates/Froxlor/assets/js/jquery/global.js
vendored
@@ -12,9 +12,14 @@ export default function () {
|
|||||||
new bootstrap.Popover($(this));
|
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) {
|
$('.copyClipboard').on('click', function (e) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
const source_element = $(this).data('clipboard-source').text();
|
const source_element = $(this).data('clipboard-source');
|
||||||
navigator.clipboard.writeText($('#' + source_element).text().trim());
|
navigator.clipboard.writeText($('#' + source_element).text().trim());
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user