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