update buttons after click to prevent dupe actions

This commit is contained in:
Ted Unangst 2019-04-23 11:12:17 -04:00
parent 86764b327f
commit 1e99e99835
2 changed files with 8 additions and 4 deletions

View File

@ -20,10 +20,14 @@ function post(url, data) {
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>

View File

@ -27,8 +27,8 @@ convoy: {{ .Convoy }}
{{ 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>