Added and internalized Pico theme for customization
This commit is contained in:
parent
8e7f72ce8b
commit
8c90bb2dfc
71 changed files with 4587 additions and 0 deletions
17
themes/pico/static/js/codecopy.js
Normal file
17
themes/pico/static/js/codecopy.js
Normal file
|
@ -0,0 +1,17 @@
|
|||
function enableCopy() {
|
||||
document.querySelectorAll('pre:not(.mermaid)').forEach(node => {
|
||||
let copyBtn = document.createElement("span");
|
||||
copyBtn.classList.add('copybutton');
|
||||
copyBtn.classList.add('icon');
|
||||
copyBtn.classList.add('icon-copy');
|
||||
node.appendChild(copyBtn);
|
||||
copyBtn.addEventListener("click", async () => {
|
||||
if (navigator.clipboard) {
|
||||
let text = node.querySelectorAll('code')[0].innerText;
|
||||
await navigator.clipboard.writeText(text);
|
||||
copyBtn.classList.add('clicked');
|
||||
}
|
||||
setTimeout(() => copyBtn.classList.remove('clicked'), 600);
|
||||
})
|
||||
})
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue