gomoku/public/scripts/copy-game-link.js

14 lines
344 B
JavaScript

function copyGameLink() {
const gameLinkInput = document.getElementById('game-link');
if (gameLinkInput) {
navigator.clipboard
.writeText(gameLinkInput.value)
.then(() => {
alert('Game link copied to clipboard!');
})
.catch((err) => {
console.error('Failed to copy link: ', err);
});
}
}