summaryrefslogtreecommitdiff
path: root/yarrow-ui.cgi
diff options
context:
space:
mode:
authorsanine <sanine.not@pm.me>2023-09-18 05:25:43 +0000
committersanine <sanine.not@pm.me>2023-09-18 05:25:43 +0000
commitea194b4cad05f003b7bad5e7e5f059d745c64995 (patch)
tree44f753ff5db6b09f057295c79f9635c11f2169dc /yarrow-ui.cgi
parent3425c3c435a000b14103a0055fd913ccb855b734 (diff)
add link copying
Diffstat (limited to 'yarrow-ui.cgi')
-rwxr-xr-xyarrow-ui.cgi16
1 files changed, 16 insertions, 0 deletions
diff --git a/yarrow-ui.cgi b/yarrow-ui.cgi
index 9a1d134..fffa653 100755
--- a/yarrow-ui.cgi
+++ b/yarrow-ui.cgi
@@ -163,6 +163,22 @@ local head = h('head', {
h('meta', { name='viewport', content='width=device-width, initial-scale=1' }),
h('title', 'yarrow config'),
h('link', { rel='stylesheet', href='style.css' }),
+ h('script', string.format([[
+ window.onload = () => {
+ const link = document.getElementById('permalink');
+ const br = document.createElement('br');
+
+ const button = document.createElement('button');
+ button.textContent = 'copy link';
+ button.addEventListener('click', () => {
+ navigator.clipboard.writeText('%s');
+ button.textContent = 'copied!';
+ setTimeout(() => button.textContent = 'copy link', 1000);
+ });
+
+ link.after(br, button);
+ };
+ ]], 'https://sanine.net/utils/yarrow/yarrow.cgi?statistics='..b64.encode(convert(stat))), { type='text/javascript' }),
})