Skip to content

Commit

Permalink
Remove unused copy code script
Browse files Browse the repository at this point in the history
  • Loading branch information
RomanHauksson committed Oct 22, 2024
1 parent 777f079 commit 0bfced1
Showing 1 changed file with 0 additions and 33 deletions.
33 changes: 0 additions & 33 deletions src/layouts/Layout.astro
Original file line number Diff line number Diff line change
Expand Up @@ -103,36 +103,3 @@ const baseUrl = import.meta.env.BASE_URL;
@apply px-4;
}
</style>

<!-- <script>
function copyCode(button: HTMLElement) {
const codeBlock = button.closest("pre");
if (!codeBlock) {
return;
}
const codeContent = codeBlock.querySelector("code")?.innerText;
if (!codeContent) {
return;
}
const successIcon = codeBlock.querySelector(
".copy-code-successful"
) as HTMLElement;
if (!successIcon) {
console.error("Failed to find success icon.");
return;
}
navigator.clipboard.writeText(codeContent).catch((err) => {
console.error("Failed to copy code: ", err);
});
button.style.display = "none";
successIcon.style.display = "inline";
setTimeout(() => {
button.style.display = "inline";
successIcon.style.display = "none";
}, 1000);
}
document.querySelectorAll(".copy-code").forEach((button) => {
button.addEventListener("click", () => copyCode(button as HTMLElement));
});
</script> -->

0 comments on commit 0bfced1

Please sign in to comment.