-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathindex.html
385 lines (379 loc) · 15.1 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
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
<html lang="en-US">
<head>
<title>Fun, Friendly CS</title>
<script type="module" src="big-o-notation/big-o-notation-example.js"></script>
<script type="module" src="set-theory/set-theory-example.js"></script>
<script type="module" src="recursion/recursion-example.js"></script>
<script type="module" src="linked-list/linked-list-example.js"></script>
<script type="module" src="stack/stack-example.js"></script>
<script type="module" src="queue/queue-example.js"></script>
<script type="module" src="tree/tree-example.js"></script>
<script type="module" src="encapsulation/encapsulation-example.js"></script>
<script type="module" src="abstraction/abstraction-example.js"></script>
<script type="module" src="inheritance/inheritance-example.js"></script>
<script type="module" src="polymorphism/polymorphism-example.js"></script>
<link rel="stylesheet" href="assets/styles/app.css" />
</head>
<body>
<main class="App">
<h1 class="App-title">Fun, Friendly CS</h1>
<div class="ScreenContainer">
<section class="Screen Screen--purple Screen--active">
<div class="Screen-header">
<img
class="Screen-thumbnail"
src="assets/images/Cupcake.png"
alt="Line drawing of a cupcake"
/>
<h2>Let's make cupcakes! - Big O Notation example</h2>
</div>
<button class="BigOButton BigOButton--step1">Preheat oven</button>
<button class="BigOButton BigOButton--step2" disabled="disabled">
Combine butter and sugar
</button>
<button class="BigOButton BigOButton--step3" disabled="disabled">
Add eggs
</button>
<button class="BigOButton BigOButton--step4" disabled="disabled">
Combine flour and baking powder
</button>
<button class="BigOButton BigOButton--step5" disabled="disabled">
Slowly add milk and flour to butter mixture
</button>
<button class="BigOButton BigOButton--step6" disabled="disabled">
Bake
</button>
<button class="BigOButton BigOButton--step7 BigOButton--last" disabled="disabled">
Frost with Fibonacci number
</button>
<h2>Our baking progress</h2>
<div class="BigONotation">You haven't started baking yet :(</div>
</section>
<section class="Screen Screen--purple">
<h2>
Let's find those cute instagram accounts! - Set theory example
</h2>
<h3>Add some accounts to our list</h3>
<form class="SetTheoryForm--add">
<label for="Account">
New account
</label>
<input type="text" id="Account" />
<fieldset>
<legend>
<h3>Choose the type of cute animal(s) featured</h3>
</legend>
<div class="Fieldset">
<div>
<label for="Dog">Dog</label>
<input type="checkbox" name="AnimalType" id="Dog" value="dog" />
</div>
<div>
<label for="Cat">Cat</label>
<input type="checkbox" name="AnimalType" id="Cat" value="cat" />
</div>
</div>
</fieldset>
<button type="submit">Add Account</button>
</form>
<h3>Let's do some set math</h3>
<button class="SetTheoryButton--intersect">
Find the intersection
</button>
<button class="SetTheoryButton--union">Find the union</button>
<button class="SetTheoryButton--difference">
Find the difference (dogs!)
</button>
<button class="SetTheoryButton--complement">
Find the relative complement (cats!)
</button>
<button class="SetTheoryButton--symmetricDifference">
Find the symmetric difference
</button>
<h2>The Instagram accounts we love</h2>
<div class="SetTheory">We haven't added any accounts yet :(</div>
</section>
<section class="Screen Screen--purple">
<div class="Screen-header">
<img
class="Screen-thumbnail"
src="assets/images/RussianNestingDoll.png"
alt="Line drawing of a Russian nesting doll"
/>
<h2>Let's play with dolls! - Recursion example</h2>
</div>
<h3>Count how many nesting dolls we have</h3>
<button class="RecursionButton--count">Count</button>
<h2>Our Nesting Dolls</h2>
<div class="Recursion">We haven't counted yet :(</div>
</section>
<section class="Screen Screen--yellow">
<div class="Screen-header">
<img
class="Screen-thumbnail"
src="assets/images/ScavengerHunt.png"
alt="Line drawing of a scavenger hunt map"
/>
<h2>Let's make a scavenger hunt! - Linked List example</h2>
</div>
<h3>Adding a new item</h3>
<form class="LinkedListForm">
<label for="Add">
New clue
</label>
<input type="text" id="Add" />
<button type="submit">Add Clue</button>
</form>
<h3>Removing an item</h3>
<button class="LinkedList-remove">Remove Clue</button>
<h2>Our Scavenger Hunt</h2>
<div class="LinkedList">No clues yet :(</div>
</section>
<section class="Screen Screen--yellow">
<div class="Screen-header">
<img
class="Screen-thumbnail"
src="assets/images/PEZDispenser.png"
alt="Line drawing of a Cookie Monster PEZ dispenser"
/>
<h2>Let's eat some candy! - Stack example</h2>
</div>
<h3>Pushing a new item</h3>
<button class="StackButton--push">Add a PEZ</button>
<h3>Popping an item</h3>
<button class="StackButton--pop">Eat a PEZ</button>
<h2>Our PEZ Dispenser</h2>
<div class="Stack">No candy yet :(</div>
</section>
<section class="Screen Screen--yellow">
<div class="Screen-header">
<img
class="Screen-thumbnail"
src="assets/images/Bacon.png"
alt="Line drawing of slices of bacon"
/>
<h2>Let's get THAT Bacon! - Queue example</h2>
</div>
<h3>Enqueuing a new item</h3>
<button class="QueueButton--enqueue">Get in line</button>
<h3>Dequeuing an item</h3>
<button class="QueueButton--dequeue">Get THAT bacon!</button>
<h2>Our Bacon Line</h2>
<div class="Queue">Nobody wants bacon yet :(</div>
</section>
<section class="Screen Screen--yellow">
<div class="Screen-header">
<img
class="Screen-thumbnail"
src="assets/images/TriwizardTree.png"
alt="A tree representation of Harry and Cedric's path through the Triwizard maze"
/>
<h2>Let's win the triwizard cup! - Binary Tree example</h2>
</div>
<div class="TreeContainer">
<div>
<h3>Let's see the possible routes</h3>
<button class="TreeButton--HarryWorstIteratively">
Harry's worst route - iteratively
</button>
<button class="TreeButton--HarryWorstRecursively">
Harry's worst route - recursively
</button>
<button class="TreeButton--HarryBestIteratively">
Harry's best route - iteratively
</button>
<button class="TreeButton--HarryBestRecursively">
Harry's best route - recursively
</button>
<br />
<button class="TreeButton--CedricWorstIteratively">
Cedric's worst route - iteratively
</button>
<button class="TreeButton--CedricWorstRecursively">
Cedric's worst route - recursively
</button>
<button class="TreeButton--CedricBestIteratively">
Cedric's best route - iteratively
</button>
<button class="TreeButton--CedricBestRecursively">
Cedric's best route - recursively
</button>
<div class="Tree">
You haven't chosen anyone to go through the maze yet :(
</div>
</div>
<div>
<img
src="assets/images/TriwizardTree.png"
alt="A tree representation of Harry and Cedric's path through the Triwizard maze"
/>
</div>
</div>
</section>
<section class="Screen Screen--red">
<div class="Screen-header">
<img
class="Screen-thumbnail"
src="assets/images/Horse.png"
alt="Line drawing of a horse"
/>
<h2>Let's move a horse! - Encapsulation example</h2>
</div>
<label for="Steps">
Number of steps
</label>
<input type="number" id="Steps" />
<button class="EncapsulationButton--walk">Walk</button>
<button class="EncapsulationButton--trot">Trot</button>
<button class="EncapsulationButton--canter">Canter</button>
<button class="EncapsulationButton--gallop">Gallop</button>
<h2>Our Horse</h2>
<div class="Encapsulation">Your horse hasn't moved yet :(</div>
</section>
<section class="Screen Screen--red">
<div class="Screen-header">
<img
class="Screen-thumbnail"
src="assets/images/RemoteControl.png"
alt="Line drawing of a hand holding a remote control"
/>
<h2>Let's turn up the volume! - Abstraction example</h2>
</div>
<button class="AbstractionButton--power">Power</button>
<button class="AbstractionButton--volumeUp">Volume Up</button>
<button class="AbstractionButton--volumeDown">Volume Down</button>
<h2>Our TV</h2>
<div class="Abstraction">The TV is off.</div>
</section>
<section class="Screen Screen--red">
<div class="Screen-header">
<img
class="Screen-thumbnail"
src="assets/images/Plant.png"
alt="Line drawing of a plant"
/>
<h2>Let's plant a garden! - Inheritance example</h2>
</div>
<form class="InheritanceForm">
<fieldset>
<legend>
<h3>What kind of light does your garden get?</h3>
</legend>
<div class="Fieldset">
<div>
<label for="sun">My garden is sunny</label>
<input type="radio" name="lightNeeds" id="sun" value="sun" />
</div>
<div>
<label for="shade">My garden is shady</label>
<input type="radio" name="lightNeeds" id="shade" value="shade" />
</div>
</div>
</fieldset>
<fieldset>
<legend>
<h3>How does your garden handle moisture ?</h3>
</legend>
<div class="Fieldset">
<div>
<label for="wet">My garden stays wet</label>
<input type="radio" name="waterNeeds" id="wet" value="wet" />
</div>
<div>
<label for="dry">My garden stay dry</label>
<input type="radio" name="waterNeeds" id="dry" value="dry" />
</div>
</div>
</fieldset>
<button type="submit">
Learn about plants that work in my garden!
</button>
</form>
<div class="Inheritance">
You haven't picked your garden type yet :(
</div>
</section>
<section class="Screen Screen--red">
<div class="Screen-header">
<img
class="Screen-thumbnail"
src="assets/images/YarnCrafts.png"
alt="Line drawing of common yarn crafts"
/>
<h2>Let's craft! - Polymorphism example</h2>
</div>
<form class="PolymorphismForm">
<fieldset>
<legend><h3>Choose your favorite yarn craft</h3></legend>
<div class="Fieldset">
<div>
<label for="Knit">Knitting</label>
<input type="radio" name="YarnCraft" id="Knit" value="knit" />
</div>
<div>
<label for="Crochet">Crocheting</label>
<input type="radio" name="YarnCraft" id="Crochet" value="crochet" />
</div>
<div>
<label for="Weave">Weaving</label>
<input type="radio" name="YarnCraft" id="Weave" value="weave" />
</div>
</div>
</fieldset>
<label for="RowLength">
Row length
</label>
<input type="number" id="RowLength" />
<label for="NumRows">
Number of rows
</label>
<input type="number" id="NumRows" />
<div>
<button type="submit">Create my fabric!</button>
</div>
</form>
<h2>Our Fabric</h2>
<div class="Polymorphism">You haven't created anything yet :(</div>
</section>
<div class="ButtonContainer">
<button class="Button PrevButton" disabled="disabled">Prev</button>
<button class="Button NextButton">Next</button>
</div>
</div>
</main>
<script>
let activeScreenIndex = 0;
function setActiveScreen() {
const screens = document.querySelectorAll(".Screen");
for (screen of screens) {
screen.classList.remove("Screen--active");
}
screens[activeScreenIndex].classList.add("Screen--active");
}
function setDisabledStateOfButtons() {
const screens = document.querySelectorAll(".Screen");
if (activeScreenIndex === 0) {
document.querySelector(".PrevButton").disabled = "disabled";
} else {
document.querySelector(".PrevButton").disabled = "";
}
const numberOfScreens = screens.length;
if (activeScreenIndex >= numberOfScreens - 1) {
document.querySelector(".NextButton").disabled = "disabled";
} else {
document.querySelector(".NextButton").disabled = "";
}
}
document.querySelector(".NextButton").addEventListener("click", function(e) {
activeScreenIndex++;
setActiveScreen();
setDisabledStateOfButtons();
});
document.querySelector(".PrevButton").addEventListener("click", function(e) {
activeScreenIndex--;
setActiveScreen();
setDisabledStateOfButtons();
});
</script>
</body>
</html>