forked from tildetown/tilde.town
things
parent
1d4b43471a
commit
585905cb8c
11
genusers.go
11
genusers.go
|
@ -70,13 +70,18 @@ func renderUserLink(u *user) (string, error) {
|
|||
pr := rand.Intn(20)
|
||||
opacity := rand.Intn(50) + 50
|
||||
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>
|
||||
</h{{.H}}>`)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
float := "left"
|
||||
if rand.Intn(2) == 0 {
|
||||
float = "right"
|
||||
}
|
||||
|
||||
out := bytes.Buffer{}
|
||||
err = t.Execute(&out, struct {
|
||||
Username string
|
||||
|
@ -87,11 +92,13 @@ func renderUserLink(u *user) (string, error) {
|
|||
Opacity int
|
||||
H int
|
||||
Title string
|
||||
Float string
|
||||
}{
|
||||
Pt: pt, Pb: pb, Pl: pl, Pr: pr,
|
||||
Opacity: opacity,
|
||||
H: h,
|
||||
Username: u.Username, Title: title,
|
||||
Float: float,
|
||||
})
|
||||
|
||||
if err != nil {
|
||||
|
@ -137,7 +144,7 @@ func getHeader() string {
|
|||
<title>web pages of tilde town</title>
|
||||
<meta charset="UTF-8">
|
||||
<link rel="icon" href="/favicon.ico">
|
||||
<link rel="stylesheet" href="style.css"
|
||||
<link rel="stylesheet" href="style.css">
|
||||
<style>
|
||||
body {
|
||||
background-color: black;
|
||||
|
|
Loading…
Reference in New Issue