all repos — honk @ 8c10eb721a2bca3b03cf0b725924001eab6869a8

my fork of honk

views/chatter.html (view raw)

 1{{ template "header.html" . }}
 2<main>
 3<div class="info">
 4<p>
 5<form action="/sendchonk" method="POST" enctype="multipart/form-data">
 6<h3>new chatter</h3>
 7<input type="hidden" name="CSRF" value="{{ .ChonkCSRF }}">
 8<p><label for=target>target:</label><br>
 9<input type="text" name="target" value="" autocomplete=off>
10<p><label for=noise>noise:</label><br>
11<textarea name="noise" id="noise"></textarea>
12<p><button name="chonk" value="chonk">chonk</button>
13<label class=button id="donker">attach: <input onchange="updatedonker(this);" type="file" name="donk"><span></span></label>
14</form>
15<script>
16function updatedonker(el) {
17	el = el.parentElement
18	el.children[1].textContent = el.children[0].value.slice(-20)
19}
20</script>
21</div>
22{{ $chonkcsrf := .ChonkCSRF }}
23{{ range .Chatter }}
24<section class="honk">
25<p class="chattarget">
26chatter: {{ .Target }}
27{{ $target := .Target }}
28{{ range .Chonks }}
29<div class="chat">
30<p>
31<span class="chatstamp">{{ .Date.Local.Format "15:04" }} {{ .Handle }}:</span>
32{{ .HTML }}
33{{ range .Donks }}
34{{ if .Local }}
35{{ if eq .Media "text/plain" }}
36<p><a href="/d/{{ .XID }}">Attachment: {{ .Name }}</a>{{ if not (eq .Desc .Name) }} {{ .Desc }}{{ end }}
37{{ else if eq .Media "application/pdf" }}
38<p><a href="/d/{{ .XID }}">Attachment: {{ .Name }}</a>{{ if not (eq .Desc .Name) }} {{ .Desc }}{{ end }}
39{{ else }}
40<p><img src="/d/{{ .XID }}" title="{{ .Desc }}" alt="{{ .Desc }}">
41{{ end }}
42{{ else }}
43{{ if .XID }}
44<p><a href="{{ .URL }}" rel=noreferrer>External Attachment: {{ .Name }}</a>{{ if not (eq .Desc .Name) }} {{ .Desc }}{{ end }}
45{{ else }}
46{{ if eq .Media "video/mp4" }}
47<p><video controls src="{{ .URL }}">{{ .Name }}</video>
48{{ else }}
49<p><img src="{{ .URL }}" title="{{ .Desc }}" alt="{{ .Desc }}">
50{{ end }}
51{{ end }}
52{{ end }}
53{{ end }}
54</div>
55{{ end }}
56<form action="/sendchonk" method="POST" enctype="multipart/form-data">
57<input type="hidden" name="CSRF" value="{{ $chonkcsrf }}">
58<input type="hidden" name="target" value="{{ $target }}" autocomplete=off>
59<p><label for=noise>noise:</label><br>
60<textarea name="noise" id="noise"></textarea>
61<p><button name="chonk" value="chonk">chonk</button>
62<label class=button id="donker">attach: <input onchange="updatedonker(this);" type="file" name="donk"><span></span></label>
63</form>
64</section>
65{{ end }}
66</main>