fix: copy button (#6)

Reviewed-on: yw5n/yw5ncom#6
This commit is contained in:
ange 2025-04-22 02:18:56 +00:00
parent abd9218561
commit 9420df0a4c
11 changed files with 29 additions and 28 deletions

View file

@ -2,7 +2,21 @@
<html>
<head>
{{template "head.tmpl" .}}
<script src="copy.js"></script>
<script>
function copyElem(id, r='') {
navigator.clipboard.writeText(
document.getElementById(id).innerText.replaceAll(r, ''),
);
}
function copyFile(id) {
fetch(document.getElementById(id).childNodes[1].href).then(f => {
f.text().then(t => {
navigator.clipboard.writeText(t);
})
})
}
</script>
</head>
<body>
{{template "header.tmpl" .}}