fireindexer-front/templates/assets/js/copy.js

18 lines
511 B
JavaScript
Raw Normal View History

2025-02-06 22:50:56 +11:00
function copyToClipboard(element, text, description) {
navigator.clipboard.writeText(text).then(function() {
showToast("Copied " + description);
}).catch(function(error) {
console.error("Copy failed!", error);
});
}
// Function to show the toast notification
function showToast(message) {
let toast = document.getElementById("toast");
toast.innerText = message;
toast.classList.add("show");
setTimeout(() => {
toast.classList.remove("show");
}, 2000);
}