fix: copy button
All checks were successful
/ deploy (push) Successful in 1m1s

This commit is contained in:
ange 2025-04-19 08:50:37 +00:00
parent abd9218561
commit 3f47b51aca
Signed by: ange
GPG Key ID: 9E0C4157BB7BEB1D
4 changed files with 17 additions and 16 deletions

View File

@ -1,5 +1,5 @@
ssh /static/ssh
pgp /static/pgp.asc
termux.sh https://git.gmoker.com/ange/termux/raw/branch/main/install.sh
dotfiles.sh https://git.gmoker.com/ange/.dotfiles
dotfiles.sh https://git.gmoker.com/ange/dotfiles
arch.sh https://git.gmoker.com/ange/arch

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[0].href).then(f => {
f.text().then(t => {
navigator.clipboard.writeText(t);
})
})
}
</script>
</head>
<body>
{{template "header.tmpl" .}}

View File

@ -1,13 +0,0 @@
function copyElem(id, r='') {
navigator.clipboard.writeText(
document.getElementById(id).innerText.replaceAll(r, ''),
);
}
function copyFile(id) {
fetch(document.getElementById(id).childNodes[0].href).then(f => {
f.text().then(t => {
navigator.clipboard.writeText(t);
})
})
}

View File

@ -17,7 +17,7 @@ var routes = []struct {
}{
{[]string{"GET"}, url(""), index},
{[]string{"GET"}, url("/static/.+"), static},
{[]string{"GET"}, url("/(.+\\.(css|js))"), file},
{[]string{"GET"}, url("/(.+\\.(css))"), file},
{[]string{"GET"}, url("/([^/]+)"), html},
}