commit e846c637f8c5fcde85333efa492ca0424fff1b52
parent a3cb080d904d745f1b71c2e0bc250756358e960f
Author: David Eisinger <[email protected]>
Date: Thu, 29 Jan 2026 12:27:21 -0500
Add 'clear' button
Diffstat:
1 file changed, 6 insertions(+), 0 deletions(-)
diff --git a/internal/api.go b/internal/api.go
@@ -198,6 +198,7 @@ func NewHandlerWithConfig(db *DB, cfg HandlerConfig) (http.Handler, error) {
<label>Referrer
<span class="inline-row">
<input id="ref" type="text" value="%[8]s" placeholder="https://site-that-linked-here.example">
+ <button id="refClear" class="secondary inline" type="button">Clear</button>
<button id="refPaste" class="secondary inline" type="button">Paste</button>
</span>
</label>
@@ -216,7 +217,12 @@ func NewHandlerWithConfig(db *DB, cfg HandlerConfig) (http.Handler, error) {
const form = document.getElementById('f');
const msg = document.getElementById('msg');
const refInput = document.getElementById('ref');
+ const refClear = document.getElementById('refClear');
const refPaste = document.getElementById('refPaste');
+ refClear.addEventListener('click', function(){
+ refInput.value = '';
+ refInput.focus();
+ });
refPaste.addEventListener('click', async function(){
try {
const text = await navigator.clipboard.readText();