2021-02-13 15:47:04 +00:00
|
|
|
const button = document.getElementById("copy");
|
2021-04-04 12:49:34 +00:00
|
|
|
button.classList.remove("hidden");
|
2021-02-13 15:47:04 +00:00
|
|
|
button.onclick = () => {
|
|
|
|
if (!navigator.clipboard) {
|
|
|
|
button.innerText = "nicht unterstützt";
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
const content = document.getElementsByClassName("copy-content")[0];
|
|
|
|
navigator.clipboard.writeText(content.textContent).then(
|
|
|
|
(_) => {
|
|
|
|
button.innerText = "kopiert!";
|
|
|
|
},
|
|
|
|
(_) => {
|
|
|
|
button.innerText = "nicht unterstützt";
|
|
|
|
}
|
|
|
|
);
|
|
|
|
};
|