www/iflpanel/ssavpn/assets/copy.js

19 lines
512 B
JavaScript
Raw Normal View History

async function copy2Clipboard(id) {
2023-11-11 23:57:55 +03:00
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';
2023-11-11 23:57:55 +03:00
}