honk/views/honkform.html

33 lines
1.1 KiB
HTML

<p>
<button onclick="showhonkform(); return false"><a href="/newhonk">it's honking time</a></button>
<form id="honkform" action="/honk" method="POST" enctype="multipart/form-data" style="display: none">
<p>
in reply to: <input type="text" name="rid" id="ridinput" value="">
<input type="hidden" name="CSRF" value="{{ .HonkCSRF }}">
<p>
<textarea name="noise" id="honknoise"></textarea>
<p>
<input type="submit" value="it's gonna be honked">
<label id="donker" style="margin-left:4em;">attach: <input onchange="updatedonker();" type="file" name="donk"><span></span></label>
</form>
<script>
function showhonkform(rid, hname) {
var form = document.getElementById("honkform")
form.style = "display: block"
var ridinput = document.getElementById("ridinput")
var honknoise = document.getElementById("honknoise")
if (rid) {
ridinput.value = rid
honknoise.value = "@" + hname + " "
} else {
ridinput.value = ""
honknoise.value = ""
}
document.getElementById("infobox").scrollIntoView()
}
function updatedonker() {
var el = document.getElementById("donker")
el.children[1].textContent = el.children[0].value
}
</script>