diff options
Diffstat (limited to 'yarrow-ui.cgi')
-rwxr-xr-x | yarrow-ui.cgi | 16 |
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' }), }) |