ssavpn/assets/copy.js

19 lines
512 B
JavaScript
Raw Normal View History

2023-12-29 23:20:18 +03:00
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';
}