www/assets/js/copy.js
2023-11-22 19:01:38 +03:00

19 lines
No EOL
512 B
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

async function copy2Clipboard(id) {
var copyText = document.getElementById(id);
// copyText.select();
// copyText.setSelectionRange(0, 99999); // For mobile devices
navigator.clipboard.writeText(copyText.innerHTML);
var tooltip = document.getElementById(id+'-tip');
tooltip.innerHTML = "Kopyalandı! ";
tooltip.style.display = 'inherit';
tooltip.style.color = 'green';
tooltip.style.fontSize = "smaller";
await new Promise(r => setTimeout(r, 2000));
tooltip.style.display= 'none';
}