fix: copy button #6

Merged
ange merged 2 commits from devel into prod 2025-04-22 02:18:56 +00:00
4 changed files with 17 additions and 16 deletions
Showing only changes of commit 3f47b51aca - Show all commits

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},
}