all repos — honk @ ccfcaac0c06d34da8fe7f54b6dbeefc4c280bfee

my fork of honk

views/honkform.html (view raw)

 1<p id="honkformhost">
 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(elem, rid, hname) {
17	var form = document.getElementById("honkform")
18	form.style = "display: block"
19	if (elem) {
20		form.remove()
21		elem.parentElement.insertAdjacentElement('beforebegin', form)
22	} else {
23		elem = document.getElementById("honkformhost")
24		elem.insertAdjacentElement('afterend', form)
25	}
26	var ridinput = document.getElementById("ridinput")
27	var honknoise = document.getElementById("honknoise")
28	if (rid) {
29		ridinput.value = rid
30		honknoise.value = "@" + hname + " "
31	}
32	//document.getElementById("infobox").scrollIntoView()
33}
34function updatedonker() {
35	var el = document.getElementById("donker")
36	el.children[1].textContent = el.children[0].value.slice(-20)
37}
38</script>