views/honkform.html (view raw)
1<p>
2<button onclick="showhonkform(); return false"><a href="/newhonk">it's honking time</a></button>
3<form id="honkform" action="/honk" method="POST" enctype="multipart/form-data" style="display: none">
4<p>
5in reply to: <input type="text" name="rid" id="ridinput" value="">
6<input type="hidden" name="CSRF" value="{{ .HonkCSRF }}">
7<p>
8<textarea name="noise" id="honknoise"></textarea>
9<p>
10<input type="submit" value="it's gonna be honked">
11<label id="donker" style="margin-left:4em;">attach: <input onchange="updatedonker();" type="file" name="donk"><span></span></label>
12</form>
13<script>
14function showhonkform(rid, hname) {
15 var form = document.getElementById("honkform")
16 form.style = "display: block"
17 var ridinput = document.getElementById("ridinput")
18 var honknoise = document.getElementById("honknoise")
19 if (rid) {
20 ridinput.value = rid
21 honknoise.value = "@" + hname + " "
22 } else {
23 ridinput.value = ""
24 honknoise.value = ""
25 }
26 document.getElementById("infobox").scrollIntoView()
27}
28function updatedonker() {
29 var el = document.getElementById("donker")
30 el.children[1].textContent = el.children[0].value
31}
32</script>