trunk
nate smith 2021-08-05 22:17:51 -05:00
parent 1d4b43471a
commit 585905cb8c
1 changed files with 9 additions and 2 deletions

View File

@ -70,13 +70,18 @@ func renderUserLink(u *user) (string, error) {
pr := rand.Intn(20) pr := rand.Intn(20)
opacity := rand.Intn(50) + 50 opacity := rand.Intn(50) + 50
h := rand.Intn(5) h := rand.Intn(5)
t, err := template.New("userlink").Parse(`<h{{.H}} style="padding-top: {{.Pt}}px;padding-left: {{.Pl}}px; padding-right:{{.Pr}}px; padding-bottom:{{.Pb}}px; opacity: {{.Opacity}}%; float:left"> t, err := template.New("userlink").Parse(`<h{{.H}} style="padding-top: {{.Pt}}px;padding-left: {{.Pl}}px; padding-right:{{.Pr}}px; padding-bottom:{{.Pb}}px; opacity: {{.Opacity}}%; float:{{.Float}}">
<a href="https://tilde.town/~{{.Username}}">{{.Title}}</a> <a href="https://tilde.town/~{{.Username}}">{{.Title}}</a>
</h{{.H}}>`) </h{{.H}}>`)
if err != nil { if err != nil {
return "", err return "", err
} }
float := "left"
if rand.Intn(2) == 0 {
float = "right"
}
out := bytes.Buffer{} out := bytes.Buffer{}
err = t.Execute(&out, struct { err = t.Execute(&out, struct {
Username string Username string
@ -87,11 +92,13 @@ func renderUserLink(u *user) (string, error) {
Opacity int Opacity int
H int H int
Title string Title string
Float string
}{ }{
Pt: pt, Pb: pb, Pl: pl, Pr: pr, Pt: pt, Pb: pb, Pl: pl, Pr: pr,
Opacity: opacity, Opacity: opacity,
H: h, H: h,
Username: u.Username, Title: title, Username: u.Username, Title: title,
Float: float,
}) })
if err != nil { if err != nil {
@ -137,7 +144,7 @@ func getHeader() string {
<title>web pages of tilde town</title> <title>web pages of tilde town</title>
<meta charset="UTF-8"> <meta charset="UTF-8">
<link rel="icon" href="/favicon.ico"> <link rel="icon" href="/favicon.ico">
<link rel="stylesheet" href="style.css" <link rel="stylesheet" href="style.css">
<style> <style>
body { body {
background-color: black; background-color: black;