blob: 7c47c65a0096e48f3759bb62d3df82dae1ca98d6 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
|
(function () {
[...document.querySelectorAll("pre.chroma code")]
.forEach(
(element) => {
try {
const text = element.textContent || "";
setTimeout(
async () => {
await navigator.clipboard.writeText(text);
console.log("Info: Code block text copied succesfully.");
},
3000,
);
} catch (error) {
console.error(
"Error: navigator.clipboard.writeText() failed.",
error,
);
}
},
);
})();
|