webgames/static/script.js

18 lines
502 B
JavaScript
Raw Permalink Normal View History

2021-10-31 14:44:14 +01:00
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();
});