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