-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfortune.html
More file actions
193 lines (153 loc) · 5.14 KB
/
fortune.html
File metadata and controls
193 lines (153 loc) · 5.14 KB
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
185
186
187
188
189
190
191
192
193
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Fortune Teller</title>
<style>
body {
width: 100dvw;
height: 100dvh;
display: flex;
flex-direction: column;
align-items: center;
align-content: center;
justify-content: center;
overflow: hidden;
gap: 48px;
background-color: black;
}
@keyframes float {
0% {
transform: translateY(-8px) rotate(2deg);
}
25% {
transform: translateY(8px) rotate(-2deg);
}
50% {
transform: translateY(-8px) rotate(2deg);
}
75% {
transform: translateY(8px) rotate(4deg);
}
100% {
transform: translateY(-8px) rotate(2deg);
}
}
div.fortune {
background-color: antiquewhite;
padding: 16px;
border-radius: 3px;
/* box-shadow: 2px 2px 2px #0000001d; */
position: relative;
font-size: 17px;
color: rgb(166, 119, 32);
animation-name: float;
animation-duration: 6s;
animation-iteration-count: infinite;
animation-fill-mode: both;
animation-direction: normal;
animation-timing-function: ease-in-out;
max-width: 142px;
}
div.fortune::before {
content: '✨';
font-size: 18px;
position: absolute;
left: -12px;
top: -12px;
transform: rotate(-15deg);
}
div.fortune::after {
content: '✨';
font-size: 18px;
position: absolute;
right: -12px;
bottom: -12px;
transform: rotate(15deg);
}
div.fortune>svg {
position: absolute;
bottom: 99.5%;
left: 0;
fill: antiquewhite;
z-index: -1;
}
div#loader {
background-color: antiquewhite;
border: 6px double rgb(228, 168, 55);
color: rgb(166, 119, 32);
padding: 4px;
animation-name: float;
animation-duration: 6s;
animation-iteration-count: infinite;
animation-fill-mode: both;
animation-direction: normal;
animation-timing-function: ease-in-out;
}
</style>
<link rel="stylesheet" href="fortunes.css">
</head>
<body>
<div class="cabinet">
<div class="banner">FORTUNES</div>
<div class="tlco"></div>
<div class="trco"></div>
<div class="lwall"></div>
<div class="rwall"></div>
<div class="inside">
<div class="window"></div>
<div class="streak"></div>
<div class="teller">
<div class="ball"></div>
<div class="stand"></div>
<div class="nose"></div>
<div class="face"></div>
<div class="body"></div>
<div class="beard"></div>
</div>
</div>
<div class="panel">
<!-- <div class="prompt">Have your fortune told</div> -->
<div class="slot"></div>
<div class="price">£1 →</div>
<a href="https://buy.stripe.com/dRmfZh0Figos40OgX70kE00">Purchase Fortune</a>
</div>
</div>
<div id="loader">
Thinking...
</div>
<div class="fortune" id="fortunecontainer" hidden>
<svg id="visual" viewBox="0 0 900 600" xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1">
<path
d="M0 511L82 570L164 555L245 508L327 535L409 579L491 550L573 573L655 552L736 523L818 546L900 522L900 601L818 601L736 601L655 601L573 601L491 601L409 601L327 601L245 601L164 601L82 601L0 601Z">
</path>
</svg>
<span id="fortune">You will soon be swept off your feet by a romantic partner with a questionable credit
score.</span>
</div>
<script>
const fortune = document.getElementById("fortune")
document.getElementById("fortunecontainer").hidden = true;
let params = new URL(document.location.toString()).searchParams;
let id = params.get("fortune");
async function loadData() {
let response = await fetch(`https://fortune-teller.oliver-kotla.workers.dev/fortune?id=${id}`);
if (!response.ok) {
console.log("HTTP Error:", response.status);
return;
}
let data = await response.json();
if (data.error === 0) {
document.getElementById("loader").hidden = true;
document.getElementById("fortunecontainer").hidden = false;
fortune.innerText = data.fortune;
}
}
if (id !== null) {
loadData()
}
</script>
</body>
</html>