X-Git-Url: https://git.p6c8.net/jirafeau_project.git/blobdiff_plain/bfbbf72959faa385b97d250484be1d25e4fd22aa..d4e344cf24f5cc5c8c8c563b756cc42530c38fcd:/lib/functions.js.php?ds=inline diff --git a/lib/functions.js.php b/lib/functions.js.php index 50aa2f0..58623e6 100644 --- a/lib/functions.js.php +++ b/lib/functions.js.php @@ -786,6 +786,21 @@ function addCopyListener(button_id, link_id) { } } +function copyTextToClipboard(text_id){ + var copyText = document.getElementById(text_id); + copyText.select(); + copyText.setSelectionRange(0, 99999); + navigator.clipboard.writeText(copyText.value); +} + +function addTextCopyListener(button_id, text_id) { + if(document.getElementById(button_id)){ + document.getElementById(button_id) + .addEventListener("click", function() { + copyTextToClipboard(text_id);}); + } +} + function set_dark_mode() { let steel_sheet = ""; let shortcut_icon = "";