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="" autocomplete=off>
6<input type="hidden" name="CSRF" value="{{ .HonkCSRF }}">
7<p>
8<label id="donker">attach: <input onchange="updatedonker();" type="file" name="donk"><span></span></label>
9<p>
10<textarea name="noise" id="honknoise"></textarea>
11<p>
12<input type="submit" value="it's gonna be honked">
13</form>
14<script>
15function showhonkform(rid, hname) {
16 var form = document.getElementById("honkform")
17 form.style = "display: block"
18 var ridinput = document.getElementById("ridinput")
19 var honknoise = document.getElementById("honknoise")
20 if (rid) {
21 ridinput.value = rid
22 honknoise.value = "@" + hname + " "
23 } else {
24 ridinput.value = ""
25 honknoise.value = ""
26 }
27 document.getElementById("infobox").scrollIntoView()
28}
29function updatedonker() {
30 var el = document.getElementById("donker")
31 el.children[1].textContent = el.children[0].value.slice(-20)
32}
33</script>