allow replying to off site honks by entering url manually

This commit is contained in:
Ted Unangst 2019-04-11 10:33:05 -04:00
parent fde8a2d085
commit 33bf469807
2 changed files with 13 additions and 11 deletions

View File

@ -1,6 +1,6 @@
{{ template "header.html" . }} {{ template "header.html" . }}
<div class="center"> <div class="center">
<div class="info"> <div class="info" id="infobox">
<p>{{ .ServerMessage }} <p>{{ .ServerMessage }}
{{ if .HonkCSRF }} {{ if .HonkCSRF }}
{{ template "honkform.html" . }} {{ template "honkform.html" . }}

View File

@ -1,9 +1,10 @@
<p> <p>
<button onclick="showhonkform(); return false"><a href="/newhonk">it's honking time</a></button> <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"> <form id="honkform" action="/honk" method="POST" enctype="multipart/form-data" style="display: none">
<p></p> <p>
ly: <input type="text" name="rid" value=""> in reply to: <input type="text" name="rid" id="ridinput" value="">
<input type="hidden" name="CSRF" value="{{ .HonkCSRF }}"> <input type="hidden" name="CSRF" value="{{ .HonkCSRF }}">
<p>
<textarea name="noise" id="honknoise"></textarea> <textarea name="noise" id="honknoise"></textarea>
<p> <p>
<input type="submit" value="it's gonna be honked"> <input type="submit" value="it's gonna be honked">
@ -11,17 +12,18 @@ ly: <input type="text" name="rid" value="">
</form> </form>
<script> <script>
function showhonkform(rid, hname) { function showhonkform(rid, hname) {
var el = document.getElementById("honkform") var form = document.getElementById("honkform")
el.style = "display: block" form.style = "display: block"
var ridinput = document.getElementById("ridinput")
var honknoise = document.getElementById("honknoise")
if (rid) { if (rid) {
el.children[0].innerHTML = "tonking " + rid ridinput.value = rid
el.children[1].value = rid honknoise.value = "@" + hname + " "
el.children[3].value = "@" + hname + " "
} else { } else {
el.children[0].innerHTML = "" ridinput.value = ""
el.children[1].value = "" honknoise.value = ""
} }
el.scrollIntoView() document.getElementById("infobox").scrollIntoView()
} }
function updatedonker() { function updatedonker() {
var el = document.getElementById("donker") var el = document.getElementById("donker")