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">{{ .Noise }}</textarea>
11<p>
12<input type="submit" value="it's gonna be honked">
13<input type="submit" name="preview" value="preview">
14</form>
15<script>
16function showhonkform(rid, hname) {
17 var form = document.getElementById("honkform")
18 form.style = "display: block"
19 var ridinput = document.getElementById("ridinput")
20 var honknoise = document.getElementById("honknoise")
21 if (rid) {
22 ridinput.value = rid
23 honknoise.value = "@" + hname + " "
24 }
25 document.getElementById("infobox").scrollIntoView()
26}
27function updatedonker() {
28 var el = document.getElementById("donker")
29 el.children[1].textContent = el.children[0].value.slice(-20)
30}
31</script>