all repos — honk @ eb1f2a55293816b6dedf413b87b07ff92784491d

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