all repos — honk @ 87825edffd7e602cbefb5590d791a085f5cdcd95

my fork of honk

update buttons after click to prevent dupe actions
Ted Unangst tedu@tedunangst.com
Tue, 23 Apr 2019 11:12:17 -0400
commit

87825edffd7e602cbefb5590d791a085f5cdcd95

parent

5331434ed6c91a0a1beec10408b9069270b8a67b

2 files changed, 8 insertions(+), 4 deletions(-)

jump to
M views/homepage.htmlviews/homepage.html

@@ -20,10 +20,14 @@ x.open("POST", url)

x.setRequestHeader("Content-Type", "application/x-www-form-urlencoded") x.send(data) } -function bonk(xid) { +function bonk(el, xid) { + el.innerHTML = "bonked" + el.disabled = true post("/bonk", "CSRF={{ $BonkCSRF }}&xid=" + xid) } -function zonkit(xid) { +function zonkit(el, xid) { + el.innerHTML = "zonked" + el.disabled = true post("/zonkit", "CSRF={{ $BonkCSRF }}&xid=" + xid) } </script>
M views/honk.htmlviews/honk.html

@@ -27,8 +27,8 @@ </div>

{{ end }} {{ if and .Bonk (not (eq .Honk.What "zonked")) }} <p> -<button onclick="bonk('{{ .Honk.XID }}'); return false;"><a href="/bonk">bonk</a></button> +<button onclick="bonk(this, '{{ .Honk.XID }}'); return false;"><a href="/bonk">bonk</a></button> <button onclick="showhonkform('{{ .Honk.XID }}', '{{ .Honk.Username }}'); return false;"><a href="/newhonk">tonk</a></button> -<button onclick="zonkit('{{ .Honk.XID }}'); return false;"><a href="/zonkit">zonk</a></button> +<button onclick="zonkit(this, '{{ .Honk.XID }}'); return false;"><a href="/zonkit">zonk</a></button> {{ end }} </div>