This repository has been archived by the owner on Dec 1, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
/
index.jinja
184 lines (154 loc) · 5.86 KB
/
index.jinja
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
<!DOCTYPE html>
<html lang="en">
<meta property="og:description" content="There are stars: A generative story told through collaboration" />
<meta property="og:type" content="website" />
<meta name="author" content="Liza Daly" />
<meta property="og:title" content="There are stars" />
<head>
<title>There {{ "is" if stars == 1 else "are" }} {{ stars|numword }} star{{ "" if stars == 1 else "s" }}</title>
<style>
html, body {
margin: 0;
padding: 0;
height: auto;
background:rgb(219, 219, 219);
}
body {
font-family: "gill sans", sans-serif;
font-size: 22px;
}
a {
color: rgb(255, 246, 236);
}
main {
margin: 5vw 20vw 20vh 20vw;
line-height: 1.6rem;
}
@media (max-width: 700px) {
main {
margin: 5vw 5vw;
}
}
h1 {
margin: 0;
font-weight: normal;
}
h1, h2, h3 {
line-height: 1.8rem;
font-weight: normal;
}
h2, h3 {
margin-top: 2rem;
font-weight: normal;
}
h3 {
text-align: center;
}
header {
height: 20vh;
background: radial-gradient(circle at 100%, rgb(38, 36, 77), #333 50%, rgb(15, 15, 16) 75%);
color: rgb(255, 246, 236);
margin: 0;
padding: 2rem;
}
footer {
margin: 5vh 20vw;
}
.star {
position: absolute;
opacity: 0.5;
color: rgb(255, 246, 236);
}
.star:before {
content: '•';
}
</style>
</head>
<body>
<header>
<h1>There {{ "is" if stars == 1 else "are" }} {{ stars|numword }} star{{ "" if stars == 1 else "s" }}</h1>
<p>
This collaborative story began {{ repo.created_at | humanize_naturalday }}. <a href="https://github.com/lizadaly/there-are-stars">How to participate</a>.
</p>
</header>
<main>
<section>
<h3>Prologue</h3>
<p>
You started this journey over {{ repo.created_at | humanize_naturaldelta }} ago.
You left from your {{ you.home.place }}. It was a {{ you.weather }} day.
</p>
<p>
To help others follow you, you lay behind you a winding path of {{ you.stone }}
cobblestones until your pockets were empty of stones.
</p>
{% set ns = namespace(path=you.stone, star_count=0) %}
{% for days, groups in visitors|groupby('visited')%}
<section>
<h3>Chapter {{ loop.index }} <br><em>{{ days.day }} {{ days.strftime('%B') }}</em></h3>
{% for visitor in groups %}
<p>
{{ visitor.home.preposition | capitalize }} {{ visitor.home.place }} along the {{ ["way", "route", "path", "road"]|random }}, a{% if visitor.occupation.startswith(('a', 'o', 'i', 'e', 'u'))%}n{% endif %}
{{ visitor.occupation }}
{% if ns.star_count > 0 %}
observed {{ ns.star_count|numword }} new star{{ "" if ns.star_count == 1 else "s"}} in the sky
{% else %}
felt a stirring
{% endif %}
and decided to follow the {{ ns.path }} path.
They set out on a {{ visitor.weather }} {{ ["day", "morning", "afternoon", "evening"]|random }}.
</p>
{% if loop.last %}
<p>
After a time, the {{ visitor.occupation }} noticed that the path
had become {{ ["thin", "trampled", "faded", "muddied"]|random }} and hard to follow. They started a new trail with {% if visitor.trail_type == "flower" %}
delicate plantings of {{ visitor.flower }} flowers
{% set ns.path = visitor.flower %}
{% elif visitor.trail_type == "metal" %}
a shiny line of {{ visitor.metal }} coins
{% set ns.path = visitor.metal %}
{% endif %}
until their pockets were empty of
{% if visitor.trail_type == "flower" %}
seeds.
{% elif visitor.trail_type == "metal" %}
metal.
{% endif %}
</p>
{% endif %}
{% set ns.star_count = ns.star_count + 1 %}
{% endfor %}
</section>
{% endfor %}
<section>
<h3>Epilogue</h3>
<p> After a long journey, {% if stars > 1 %}your friends{% else %} you {% endif %} arrived at your sanctuary by the sea.
{% if stars > 1 %}
This is how there came to be {{ stars|numword }} new star{{ "" if stars == 1 else "s" }} in the sky.
{% else %}
Perhaps the next time others will follow.
{% endif %}
</p>
</section>
</main>
<footer>
<a href="https://github.com/lizadaly/there-are-stars" style="color: black">About this story</a>
</footer>
<script>
const stars = {{ visitors|length }};
const header = document.querySelector('header');
function rand(min, max) {
return Math.random() * (max - min) + min;
}
for (let i=0; i < stars; i++) {
const star = document.createElement('div');
star.classList.add('star');
const left = parseInt(rand(0, header.clientWidth), 10).toString();
const top = parseInt(rand(0, header.clientHeight, 10)).toString();
star.style.left = `${left}px`;
star.style.top = `${top}px`;
document.body.append(star);
}
</script>
</body>
</html>