Initial commit for Hugo site.

This commit is contained in:
Charish Patel
2025-02-20 08:28:31 -05:00
parent 737c448252
commit 045d0c24f3
696 changed files with 91218 additions and 0 deletions
+30
View File
@@ -0,0 +1,30 @@
document.addEventListener("DOMContentLoaded", function() {
// Get code blocks
const codeblocks = document.querySelectorAll("pre code");
// Iterate over each to perform modifications
codeblocks.forEach((codeblock) => {
// Create copy button and container element
const copyButton = document.createElement("button");
copyButton.className = "copy-button";
const container = document.createElement("div");
container.className = "code-container";
// Copy clicked closure
copyButton.addEventListener("click", (e) => {
e.target.className = "copy-success";
setTimeout(() => {
e.target.className = "copy-button";
}, 1000);
const code = codeblock.textContent;
navigator.clipboard.writeText(code);
});
// Wrap the codeblock with the container
codeblock.parentNode.insertBefore(container, codeblock);
container.appendChild(codeblock);
// Add the copy button to the container
container.appendChild(copyButton);
})
});