2021-12-20 00:05:38 +00:00
|
|
|
if (navigator.clipboard) {
|
|
|
|
const buttons = document.querySelectorAll("button[data-copy], a[data-copy]");
|
|
|
|
for (const button of buttons) {
|
|
|
|
button.classList.remove("hidden");
|
|
|
|
button.onclick = () => {
|
|
|
|
const target = document.querySelector(button.getAttribute("data-copy"));
|
|
|
|
navigator.clipboard.writeText(target.textContent).then(
|
|
|
|
(_) => (button.innerText = "kopiert!"),
|
|
|
|
(_) => (button.innerText = "nicht unterstützt")
|
|
|
|
);
|
|
|
|
};
|
2021-02-13 15:47:04 +00:00
|
|
|
}
|
2021-12-20 00:05:38 +00:00
|
|
|
}
|