package ss13_se import ( "html/template" ) func loadTemplates() (map[string]*template.Template, error) { tmpls := make(map[string]*template.Template) for name, src := range tmplList { t, err := parseTemplate(tmplBase, src) if err != nil { return nil, err } tmpls[name] = t } return tmpls, nil } func parseTemplate(src ...string) (*template.Template, error) { var err error t := template.New("*") for _, s := range src { t, err = t.Parse(s) if err != nil { return nil, err } } return t, nil } // Using the awesome style from http://bettermotherfuckingwebsite.com/ const tmplBase string = ` {{block "title" .}}NO TITLE{{end}} | ss13.se
ss13.se Global stats

Last updated: {{.Hub.LastUpdated}}

{{block "body" .}}NO BODY{{end}}
` var tmplList = map[string]string{ "style": ` * { padding: 0px; margin: 0px; } body { margin: 0px auto; max-width: 1024px; font-size: 18px; padding: 0 10px; line-height: 1.6; color: #444; background-color: #fff; } h1, h2 { text-align: center; } a, a:hover, a:visited { color: #444; text-decoration: none; } a:hover { color: #000; } img { display: block; margin: auto; } header { margin-bottom: 40px; padding: 10px 20px; color: #fff; background-color: #444; border-bottom-left-radius: 5px; border-bottom-right-radius: 5px; } header a, header a:hover, header a:visited { color: #fff; text-decoration: none; display: inline; padding-right: 40px; } footer { margin-top: 40px; padding: 10px; text-align: center; font-size: 12px; } .button a { background-color: #444; color: #fff; border-radius: 5px; padding: 5px 10px; text-decoration: none; } .button a:hover { background-color: #888; } .left { float: left; } .right { float: right; } .hide td, .hide a { color: #bbb; } `, "index": `{{define "title"}}Index{{end}} {{define "body"}}

Servers

{{range .Servers}} {{else}} {{end}}
Players Server
{{.Players}} {{.Title}}
0Sorry, no servers yet!
{{end}} `, "server": `{{define "title"}}{{.Server.Title}}{{end}} {{define "body"}}

{{.Server.Title}}

{{if .Server.SiteURL}} Website {{end}} {{if .Server.ByondURL}} Join game {{end}}

Current players: {{.Server.Players}}

Daily History

Unable to show a pretty graph

Weekly History

Unable to show a pretty graph

Average per day

Unable to show a pretty graph

Average per hour

Unable to show a pretty graph {{end}} `, }