all repos — honk @ v0.2.3

my fork of honk

views/homepage.html (view raw)

 1{{ template "header.html" . }}
 2<div class="center">
 3<div class="info" id="infobox">
 4<p>{{ .ServerMessage }}
 5{{ if .HonkCSRF }}
 6{{ template "honkform.html" . }}
 7{{ end }}
 8</div>
 9<div>
10{{ $BonkCSRF := .HonkCSRF }}
11{{ range .Honks }}
12{{ template "honk.html" map "Honk" . "Bonk" $BonkCSRF }}
13{{ end }}
14</div>
15{{ if $BonkCSRF }}
16<script>
17function post(url, data) {
18	var x = new XMLHttpRequest()
19	x.open("POST", url)
20	x.setRequestHeader("Content-Type", "application/x-www-form-urlencoded")
21	x.send(data)
22}
23function bonk(xid) {
24	post("/bonk", "CSRF={{ $BonkCSRF }}&xid=" + xid)
25}
26function zonkit(xid) {
27	post("/zonkit", "CSRF={{ $BonkCSRF }}&xid=" + xid)
28}
29</script>
30{{ end }}