29 lines
920 B
JavaScript
29 lines
920 B
JavaScript
document.addEventListener("DOMContentLoaded", function() {
|
|
var gif = document.querySelector(".clickable");
|
|
|
|
var notification = document.getElementById("copyNotification");
|
|
|
|
gif.addEventListener("mouseenter", function() {
|
|
notification.textContent = "Get link to game";
|
|
notification.style.visibility = "visible";
|
|
});
|
|
|
|
gif.addEventListener("click", function() {
|
|
var gameUrl = "https://gitea.rkg.lv/elukjanovica/Picture-Puzzle-website.git";
|
|
|
|
navigator.clipboard.writeText(gameUrl).then(function() {
|
|
notification.textContent = "Link copied!";
|
|
|
|
setTimeout(function() {
|
|
notification.textContent = "Get link to game";
|
|
}, 2000);
|
|
}, function() {
|
|
console.error("Failed to copy link.");
|
|
});
|
|
});
|
|
|
|
gif.addEventListener("mouseleave", function() {
|
|
notification.style.visibility = "hidden";
|
|
});
|
|
});
|
|
|