This commit is contained in:
Benjamin Toby
2024-12-05 08:03:33 +01:00
parent 9686a22c96
commit 3ffd2d6777
821 changed files with 3251 additions and 91996 deletions
+5 -12
View File
@@ -5,14 +5,15 @@ const codeBlocks = document.querySelectorAll("pre");
if (codeBlocks) {
try {
codeBlocks?.forEach((codeBlock) => {
if (codeBlock.classList.contains("skip-js")) return;
codeBlock.style.position = "relative";
const copyCodeButton = document.createElement("span");
copyCodeButton.style.position = "absolute";
copyCodeButton.style.top = "10px";
copyCodeButton.style.right = "10px";
// copyCodeButton.style.position = "absolute";
// copyCodeButton.style.top = "10px";
// copyCodeButton.style.right = "10px";
copyCodeButton.style.cursor = "pointer";
copyCodeButton.style.display = "none";
// copyCodeButton.style.display = "none";
copyCodeButton.addEventListener("click", () => {
// console.log(codeBlock.innerText);
@@ -30,14 +31,6 @@ if (codeBlocks) {
copyCodeButton.appendChild(copyIcon);
codeBlock.appendChild(copyCodeButton);
codeBlock.addEventListener("mouseenter", () => {
copyCodeButton.style.display = "flex";
});
codeBlock.addEventListener("mouseleave", () => {
copyCodeButton.style.display = "none";
});
});
} catch (error) {}
}