webgames/static/script.js
2021-10-31 14:44:14 +01:00

17 lines
502 B
JavaScript

document.getElementById('joinurl').addEventListener('click',(e) => {
var url = document.getElementById('joinurl');
var sel = window.getSelection();
var range = document.createRange();
range.selectNodeContents(url);
sel.removeAllRanges();
sel.addRange(range);
if (document.execCommand('copy') === true) {
url.classList.add('copied');
setTimeout(() => {
url.classList.remove('copied');
}, 0);
}
sel.removeAllRanges();
});