views/honkpage.html (view raw)
1{{ template "header.html" . }}
2<div class="center">
3<div class="info" id="infobox">
4{{ if .Name }}
5<p>{{ .Name }} <span style="margin-left:1em;"><a href="/u/{{ .Name }}/rss">rss</a></span>
6{{ if .HonkCSRF }}
7<div>
8<form id="aboutform" action="/saveuser" method="POST">
9<input type="hidden" name="CSRF" value="{{ .UserCSRF }}">
10<textarea name="whatabout">{{ .RawWhatAbout }}</textarea>
11<p>
12<input type="submit" value="update">
13</form>
14</div>
15{{ else }}
16<p>{{ .WhatAbout }}
17{{ end }}
18{{ end }}
19<p>{{ .ServerMessage }}
20{{ if .HonkCSRF }}
21{{ template "honkform.html" . }}
22{{ end }}
23</div>
24<div>
25{{ $BonkCSRF := .HonkCSRF }}
26{{ range .Honks }}
27{{ template "honk.html" map "Honk" . "Bonk" $BonkCSRF }}
28{{ end }}
29</div>
30{{ if $BonkCSRF }}
31<script>
32function post(url, data) {
33 var x = new XMLHttpRequest()
34 x.open("POST", url)
35 x.setRequestHeader("Content-Type", "application/x-www-form-urlencoded")
36 x.send(data)
37}
38function bonk(el, xid) {
39 el.innerHTML = "bonked"
40 el.disabled = true
41 post("/bonk", "CSRF={{ $BonkCSRF }}&xid=" + xid)
42}
43function zonkit(el, xid) {
44 el.innerHTML = "zonked"
45 el.disabled = true
46 post("/zonkit", "CSRF={{ $BonkCSRF }}&xid=" + xid)
47}
48</script>
49{{ end }}