"
55 | ```
56 | 3. Push the changes to your remote repository:
57 | ```shell
58 | git push personal
59 | ```
60 |
61 | Don't simply run `git push`, because that will try to update our original
62 | repository, which will reject your changes.
63 |
--------------------------------------------------------------------------------
/day01/final/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | Pete's Pizza
7 |
8 |
9 |
10 |
11 |
12 | Pizza Pete's Palace
13 | Don't roll the dice, get a nice slice!
14 |
15 |
16 | About
17 | Founded in 2021, Pete's Pizza offers only the finest pizzas, pastas, and soups. Stop by and try a pie!
18 |
19 |
36 |
41 |
42 |
43 |
44 |
--------------------------------------------------------------------------------
/day01/final/style.css:
--------------------------------------------------------------------------------
1 | body {
2 | width: 90%;
3 | margin: auto;
4 | padding: 20px;
5 | background-color: aliceblue;
6 | font: "IBM Plex Sans", sans-serif;
7 | }
8 |
9 | section {
10 | padding: 20px;
11 | margin: 20px;
12 | background-color: #d5e1eb;
13 | min-height: 20px;
14 | }
15 |
16 | h1 {
17 | text-align: center;
18 | font-size: 64px;
19 | }
20 |
21 | h3 {
22 | text-align: center;
23 | font-style: italic;
24 | }
25 |
26 | div {
27 | padding: 20px;
28 | margin: 20px;
29 | background-color: #607482;
30 | color: white;
31 | display: flex;
32 | flex-direction: column;
33 | min-height: 20px;
34 | }
35 |
36 | h2 {
37 | font-size: 34px;
38 | }
39 |
40 | h4 {
41 | font-size: 30px;
42 | }
43 |
44 | p {
45 | margin-top: 30px;
46 | }
47 |
48 | h5 {
49 | font-size: 30px;
50 | text-align: right;
51 | }
52 |
53 | img {
54 | width: 100%;
55 | max-width: 600px;
56 | margin: auto;
57 | }
58 |
59 | footer {
60 | background-color: #7cbdeb;
61 | }
62 |
--------------------------------------------------------------------------------
/day01/starter/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | Pete's Pizza
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
--------------------------------------------------------------------------------
/day01/starter/style.css:
--------------------------------------------------------------------------------
1 | body {
2 | width: 90%;
3 | margin: auto;
4 | padding: 20px;
5 | background-color: aliceblue;
6 | font: "IBM Plex Sans", sans-serif;
7 | }
8 |
9 | section {
10 | padding: 20px;
11 | margin: 20px;
12 | background-color: #d5e1eb;
13 | }
14 |
15 | h1 {
16 | text-align: center;
17 | font-size: 64px;
18 | }
19 |
20 | h3 {
21 | text-align: center;
22 | font-style: italic;
23 | }
24 |
25 | div {
26 | padding: 20px;
27 | margin: 20px;
28 | background-color: #607482;
29 | color: white;
30 | display: flex;
31 | flex-direction: column;
32 | }
33 |
34 | h2 {
35 | font-size: 34px;
36 | }
37 |
38 | h4 {
39 | font-size: 30px;
40 | }
41 |
42 | p {
43 | margin-top: 30px;
44 | }
45 |
46 | h5 {
47 | font-size: 30px;
48 | text-align: right;
49 | }
50 |
51 | img {
52 | width: 100%;
53 | max-width: 600px;
54 | margin: auto;
55 | }
56 |
57 | footer {
58 | padding: 30px;
59 | padding-top: 20px;
60 | margin-bottom: -20px;
61 | margin-left: -40px;
62 | margin-right: -40px;
63 | background-color: #7cbdeb;
64 | }
65 |
--------------------------------------------------------------------------------
/day02/final/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 | CSSI 102's Top 10 Songs!
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 | CSSI 102's Playlist
19 |
20 |
21 | Our Top 10 Favorite Tunes
22 |
23 |
24 |
25 |
26 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
42 |
43 |
44 |
45 |
46 |
Good Days
47 |
SZA
48 |
49 |
50 |
51 |
52 |
53 |
54 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
70 |
71 |
72 |
73 |
74 |
Les Fleurs
75 |
Minnie Riperton
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
91 |
92 |
93 |
94 |
95 |
That's The Way of The World
96 |
Earth, Wind & Fire
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 |
110 |
111 |
112 |
113 |
114 |
Brush The Heat
115 |
Little Dragon
116 |
117 |
118 |
119 |
120 |
121 |
122 |
123 |
124 |
125 |
126 |
127 |
128 |
129 |
130 |
131 |
132 |
133 |
134 |
137 |
138 |
139 |
140 |
141 |
142 |
Watermelon Man
143 |
Herbie Hancock
144 |
145 |
146 |
147 |
148 |
149 |
150 |
151 |
152 |
153 |
154 |
155 |
156 |
157 |
158 |
160 |
161 |
162 |
163 |
164 |
165 |
Disparate Youth
166 |
Santigold
167 |
168 |
169 |
170 |
171 |
172 |
173 |
174 |
175 |
176 |
177 |
178 |
179 |
180 |
181 |
184 |
185 |
186 |
187 |
188 |
189 |
So In Love
190 |
Curtis Mayfield
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 |
C-Side
216 |
Khruangbin, Leon Bridges
217 |
218 |
219 |
220 |
221 |
222 |
223 |
224 |
225 |
226 |
227 |
228 |
229 |
230 |
231 |
234 |
235 |
236 |
237 |
238 |
239 |
1,000 Rads
240 |
David Axelrod
241 |
242 |
243 |
244 |
245 |
246 |
247 |
248 |
249 |
250 |
251 |
252 |
253 |
254 |
255 |
258 |
259 |
260 |
261 |
262 |
263 |
Pull Up
264 |
Burna Boy
265 |
266 |
267 |
268 |
269 |
270 |
271 |
272 |
273 |
274 |
275 |
--------------------------------------------------------------------------------
/day02/starter/part1/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | CSSI 102's Top 10 Songs!
8 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 | CSSI 102's Playlist
18 |
19 |
20 | Our Top 10 Favorite Tunes
21 |
22 |
23 |
24 |
25 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
Good Days
45 |
SZA
46 |
47 |
48 |
49 |
50 |
51 |
52 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
Les Fleurs
72 |
Minnie Riperton
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
That's The Way of The World
91 |
Earth, Wind & Fire
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 |
Brush The Heat
110 |
Little Dragon
111 |
112 |
113 |
114 |
115 |
116 |
117 |
118 |
119 |
--------------------------------------------------------------------------------
/day02/starter/part2/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | CSSI 102's Top 10 Songs!
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 | CSSI 102's Playlist
18 |
19 |
20 | Our Top 10 Favorite Tunes
21 |
22 |
23 |
24 |
25 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
Good Days
45 |
SZA
46 |
47 |
48 |
49 |
50 |
51 |
52 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
Les Fleurs
72 |
Minnie Riperton
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
That's The Way of The World
91 |
Earth, Wind & Fire
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 |
Brush The Heat
110 |
Little Dragon
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 |
Watermelon Man
136 |
Herbie Hancock
137 |
138 |
139 |
140 |
141 |
142 |
143 |
144 |
145 |
146 |
147 |
148 |
149 |
150 |
151 |
152 |
153 |
154 |
155 |
156 |
157 |
Disparate Youth
158 |
Santigold
159 |
160 |
161 |
162 |
163 |
164 |
165 |
166 |
167 |
168 |
169 |
170 |
171 |
172 |
173 |
174 |
175 |
176 |
177 |
178 |
179 |
So In Love
180 |
Curtis Mayfield
181 |
182 |
183 |
184 |
185 |
186 |
187 |
188 |
189 |
190 |
--------------------------------------------------------------------------------
/day03/final/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 | Welcome to the Zoo!
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 | Petting Zoo!
18 |
19 |
20 | Welcome to the world's first digital petting zoo!
21 |
22 |
23 |
24 |
25 |
26 |
27 | Tippy the Baby Goat
28 |
29 | Tippy the baby goat walks right up to you and bonks his head against your legs. It looks like he wants to be
30 | pet!
31 |
32 |
33 |
35 |
36 | He may bleat, but he won't bite!
37 |
38 |
39 |
40 |
41 |
42 | Brodie the Bunny
43 |
44 | Brodie the bunny loves gentle pets on the head! Go ahead and give him a little pet.
45 |
46 |
47 |
49 |
50 | Brodie is really quiet. He probably won't say much.
51 |
52 |
53 |
54 |
55 |
56 | Coco the Mama Goat
57 |
58 | Coco is Tippy's mother! She loves carrots. Would you like to feed her one?
59 |
60 |
61 |
63 |
64 | Coco has had 2 carrots today.
65 |
66 |
67 |
68 |
69 |
70 | Arno the Alligator
71 |
72 | Please do not pet the alligator! He's not part of the petting zoo.
73 |
74 |
75 |
78 |
79 | Please just look.
80 | No Touching!
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
--------------------------------------------------------------------------------
/day03/final/script.js:
--------------------------------------------------------------------------------
1 | console.log("script running!");
2 |
3 | const button1 = document.querySelector("#button1");
4 | const button2 = document.querySelector("#button2");
5 | const button3 = document.querySelector("#button3");
6 | const button4 = document.querySelector("#button4");
7 |
8 | console.log(button1);
9 | console.log(button2);
10 | console.log(button3);
11 | console.log(button4);
12 |
13 | button1.addEventListener("click", e => {
14 | console.log("button 1 pressed!");
15 | alert("Meh-eh-eh-eh-eh!");
16 | });
17 |
18 | const status2 = document.querySelector("#status2");
19 | console.log(status2);
20 |
21 | button2.addEventListener("click", e => {
22 | console.log("button 2 pressed!");
23 | status2.innerHTML = "Thanks for petting Brodie! He looks really happy!";
24 | });
25 |
26 | const status3 = document.querySelector("#status3");
27 | console.log(status3);
28 |
29 | let carrots = 2;
30 |
31 | button3.addEventListener("click", e => {
32 | console.log("button 3 pressed!");
33 | carrots = carrots + 1;
34 | status3.innerHTML = "Coco has had " + carrots + " carrots today!";
35 | });
36 |
37 | const zoo = document.querySelector(".container");
38 | console.log(zoo);
39 |
40 | button4.addEventListener("click", e => {
41 | console.log("button 4 pressed!");
42 | zoo.innerHTML = `Due to some dangerous rulebreaking, the petting zoo is temporarily closed
`
43 | });
44 |
--------------------------------------------------------------------------------
/day03/final/style.css:
--------------------------------------------------------------------------------
1 | img {
2 | max-width: 400px;
3 | }
4 |
--------------------------------------------------------------------------------
/day03/starter/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 | Welcome to the Zoo!
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 | Petting Zoo!
18 |
19 |
20 | Welcome to the world's first digital petting zoo!
21 |
22 |
23 |
24 |
25 |
26 |
27 | Tippy the Baby Goat
28 |
29 | Tippy the baby goat walks right up to you and bonks his head against your legs. It looks like he wants to be
30 | pet!
31 |
32 |
33 |
35 |
36 | He may bleat, but he won't bite!
37 |
38 |
39 |
40 |
41 |
42 | Brodie the Bunny
43 |
44 | Brodie the bunny loves gentle pets on the head! Go ahead and give him a little pet.
45 |
46 |
47 |
49 |
50 | Brodie is really quiet. He probably won't say much.
51 |
52 |
53 |
54 |
55 |
56 | Coco the Mama Goat
57 |
58 | Coco is Tippy's mother! She loves carrots. Would you like to feed her one?
59 |
60 |
61 |
63 |
64 | Coco has had 2 carrots today.
65 |
66 |
67 |
68 |
69 |
70 | Arno the Alligator
71 |
72 | Please do not pet the alligator! He's not part of the petting zoo.
73 |
74 |
75 |
78 |
79 | Please just look.
80 | No Touching!
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
--------------------------------------------------------------------------------
/day03/starter/script.js:
--------------------------------------------------------------------------------
1 | console.log("script running!");
2 |
3 | const button1 = document.querySelector("#button1");
4 |
--------------------------------------------------------------------------------
/day03/starter/style.css:
--------------------------------------------------------------------------------
1 | img {
2 | max-width: 400px;
3 | }
4 |
--------------------------------------------------------------------------------
/day04/final/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 | Languages Quiz
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 | Language Quiz
18 |
19 |
20 | Can you guess the top 9 languages spoken in the United States?
21 |
22 |
23 |
24 |
25 |
32 |
33 |
34 |
35 |
36 |
English
37 |
Hello World
38 |
39 |
40 |
41 |
42 |
Spanish
43 |
Hola Mundo
44 |
45 |
46 |
47 |
48 |
Chinese
49 |
你好世界
50 |
51 |
52 |
53 |
54 |
55 |
56 |
Tagalog
57 |
Kamusta sa Mundo
58 |
59 |
60 |
61 |
62 |
Vietnamese
63 |
Chào thế giới
64 |
65 |
66 |
67 |
68 |
Arabic
69 |
مرحبا بالعالم
70 |
71 |
72 |
73 |
74 |
75 |
76 |
French
77 |
Bonjour le monde
78 |
79 |
80 |
81 |
82 |
Korean
83 |
안녕하세요 세계
84 |
85 |
86 |
87 |
88 |
Russian
89 |
Привет мир
90 |
91 |
92 |
93 |
94 |
95 |
105 |
106 |
107 |
108 |
109 |
--------------------------------------------------------------------------------
/day04/final/script.js:
--------------------------------------------------------------------------------
1 | console.log("script running");
2 |
3 | // Fix these querySelectors so that they each select the correct element.
4 | const englishTile = document.querySelector("#English");
5 | const spanishTile = document.querySelector("#Spanish");
6 | const chineseTile = document.querySelector("#Chinese");
7 | const tagalogTile = document.querySelector("#Tagalog");
8 | const vietnameseTile = document.querySelector("#Vietnamese");
9 | const arabicTile = document.querySelector("#Arabic");
10 | const frenchTile = document.querySelector("#French");
11 | const koreanTile = document.querySelector("#Korean");
12 | const russianTile = document.querySelector("#Russian");
13 |
14 | console.log(englishTile);
15 | console.log(spanishTile);
16 | console.log(chineseTile);
17 | console.log(tagalogTile);
18 | console.log(vietnameseTile);
19 | console.log(arabicTile);
20 | console.log(frenchTile);
21 | console.log(koreanTile);
22 | console.log(russianTile);
23 |
24 | // Add the id of the input field so we can access it!
25 | const inputField = document.querySelector("#guess");
26 |
27 | inputField.addEventListener("change", (e) => {
28 | console.log("Guess submitted!");
29 | let guess = inputField.value;
30 | console.log(guess);
31 | if (guess === "English" || guess === "english") {
32 | englishTile.classList.remove("hidden");
33 | } else if (guess === "Spanish" || guess === "spanish") {
34 | spanishTile.classList.remove("hidden");
35 | } else if (guess === "Chinese" || guess === "chinese") {
36 | chineseTile.classList.remove("hidden");
37 | } else if (guess === "Tagalog" || guess === "tagalog") {
38 | tagalogTile.classList.remove("hidden");
39 | } else if (guess === "Vietnamese" || guess === "vietnamese") {
40 | vietnameseTile.classList.remove("hidden");
41 | } else if (guess === "Arabic" || guess === "arabic") {
42 | arabicTile.classList.remove("hidden");
43 | } else if (guess === "French" || guess === "french") {
44 | frenchTile.classList.remove("hidden");
45 | } else if (guess === "Korean" || guess === "korean") {
46 | koreanTile.classList.remove("hidden");
47 | } else if (guess === "Russian" || guess === "russian") {
48 | russianTile.classList.remove("hidden");
49 | }
50 | inputField.value = "";
51 | });
52 |
--------------------------------------------------------------------------------
/day04/final/style.css:
--------------------------------------------------------------------------------
1 | .hidden {
2 | display: none;
3 | }
4 |
--------------------------------------------------------------------------------
/day04/starter/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 | Languages Quiz
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 | Language Quiz
18 |
19 |
20 | Can you guess the top 9 languages spoken in the United States?
21 |
22 |
23 |
24 |
25 |
32 |
33 |
34 |
35 |
36 |
English
37 |
Hello World
38 |
39 |
40 |
41 |
42 |
Spanish
43 |
Hola Mundo
44 |
45 |
46 |
47 |
48 |
Chinese
49 |
你好世界
50 |
51 |
52 |
53 |
54 |
55 |
56 |
Tagalog
57 |
Kamusta sa Mundo
58 |
59 |
60 |
61 |
62 |
Vietnamese
63 |
Chào thế giới
64 |
65 |
66 |
67 |
68 |
Arabic
69 |
مرحبا بالعالم
70 |
71 |
72 |
73 |
74 |
75 |
76 |
French
77 |
Bonjour le monde
78 |
79 |
80 |
81 |
82 |
Korean
83 |
안녕하세요 세계
84 |
85 |
86 |
87 |
88 |
Russian
89 |
Привет мир
90 |
91 |
92 |
93 |
94 |
95 |
105 |
106 |
107 |
108 |
109 |
--------------------------------------------------------------------------------
/day04/starter/script.js:
--------------------------------------------------------------------------------
1 | console.log("script running");
2 |
3 | // Fix these querySelectors so that they each select the correct element.
4 | const englishTile = document.querySelector("#English");
5 | const spanishTile = document.querySelector("#Spanish");
6 | const chineseTile = document.querySelector("#chinese");
7 | const tagalogTile = querySelector("#Tagalog");
8 | const vietnameseTile = document.queryselector("#Vietnamese");
9 | const arabicTile = document.querySelector("#");
10 | const frenchTile = document.querySelector("#French");
11 | const koreanTile = document.querySelector("Korean");
12 | const russianTile = document.querySelector("#Russiian");
13 |
14 | console.log(englishTile);
15 | console.log(spanishTile);
16 | console.log(chineseTile);
17 | console.log(tagalogTile);
18 | console.log(vietnameseTile);
19 | console.log(arabicTile);
20 | console.log(frenchTile);
21 | console.log(koreanTile);
22 | console.log(russianTile);
23 |
24 | // Add the id of the input field so we can access it!
25 | const inputField = document.querySelector("#");
26 |
--------------------------------------------------------------------------------
/day04/starter/style.css:
--------------------------------------------------------------------------------
1 | .hidden {
2 | display: none;
3 | }
4 |
--------------------------------------------------------------------------------
/day05/hawaiiTravelSite/script.js:
--------------------------------------------------------------------------------
1 | // EAT MODAL event handlers
2 | const handleEat = () => {
3 | let eatModal = document.getElementById('eatModal');
4 | eatModal.classList.toggle('is-active');
5 | }
6 |
7 | const closeEatModal = () => {
8 | let eatModal = document.getElementById('eatModal');
9 | eatModal.classList.toggle('is-active');
10 | }
11 |
12 | // SLEEP MODAL event handlers
13 | const handleSleep = () => {
14 | let eatModal = document.getElementById('sleepModal');
15 | eatModal.classList.toggle('is-active');
16 | }
17 |
18 | const closeSleepModal = () => {
19 | let eatModal = document.getElementById('sleepModal');
20 | eatModal.classList.toggle('is-active');
21 | }
22 |
23 | // LEARN MODAL event handlers
24 | const handleLearn = () => {
25 | let eatModal = document.getElementById('learnModal');
26 | eatModal.classList.toggle('is-active');
27 | }
28 |
29 | const closeLearnModal = () => {
30 | let eatModal = document.getElementById('learnModal');
31 | eatModal.classList.toggle('is-active');
32 | }
33 |
34 | // PLAY MODAL event handlers
35 | const handlePlay = () => {
36 | let eatModal = document.getElementById('playModal');
37 | eatModal.classList.toggle('is-active');
38 | }
39 |
40 | const closePlayModal = () => {
41 | let eatModal = document.getElementById('playModal');
42 | eatModal.classList.toggle('is-active');
43 | }
44 |
--------------------------------------------------------------------------------
/day05/hawaiiTravelSite/style.css:
--------------------------------------------------------------------------------
1 | /* CSS files add styling rules to your content */
2 | body {
3 | font-family: helvetica, arial, sans-serif;
4 | margin: 2em;
5 | }
6 |
7 | .hero-body, .hero-foot {
8 | background-image: url('https://cdn.glitch.com/c701f73d-b6fd-4900-b986-32ba4f1563b5%2FPikPng.com_rainbow-png-image_3283328.png?v=1616004347601');
9 | background-repeat: no-repeat;
10 | background-attachment: fixed;
11 | background-position: center;
12 | background-size: cover;
13 | }
14 |
15 | .center-content {
16 | margin-left: 10%;
17 | margin-right: 10%;
18 | }
19 |
--------------------------------------------------------------------------------
/day05/tokyoTravelPage/script.js:
--------------------------------------------------------------------------------
1 | console.log("script running");
2 | // Select the input elements!
3 | const goSearch = document.querySelector("#go-search");
4 | const eatSearch = document.querySelector("#eat-search");
5 | const doSearch = document.querySelector("#do-search");
6 |
7 | // Select the go cards
8 | const shinjuku = document.querySelector("#go-1");
9 | const ueno = document.querySelector("#go-2");
10 | const harajuku = document.querySelector("#go-3");
11 |
12 | // Select the eat cards
13 | const shabu = document.querySelector("#eat-1");
14 | const okonomiyaki = document.querySelector("#eat-2");
15 | const gyudon = document.querySelector("#eat-3");
16 |
17 | // Select the do cards
18 | const wheel = document.querySelector("#do-1");
19 | const ghibli = document.querySelector("#do-2");
20 | const onsen = document.querySelector("#do-3");
21 | const mountain = document.querySelector("#do-4");
22 |
23 |
24 | goSearch.addEventListener('input', e => {
25 | let choice = e.target.value;
26 | let result = handleChoice(choice);
27 | if (result === "found!") {
28 | e.target.value = "";
29 | }
30 | })
31 |
32 | eatSearch.addEventListener('input', e => {
33 | let choice = e.target.value;
34 | let result = handleChoice(choice);
35 | if (result === "found!") {
36 | e.target.value = "";
37 | }
38 | })
39 |
40 | doSearch.addEventListener('input', e => {
41 | let choice = e.target.value;
42 | let result = handleChoice(choice);
43 | if (result === "found!") {
44 | e.target.value = "";
45 | }
46 | })
47 |
48 | function handleChoice(choice) {
49 | if (choice.toLowerCase().includes("plants")) {
50 | shinjuku.classList.remove("hidden")
51 | return "found!";
52 | } else if (choice.toLowerCase().includes("animals")) {
53 | ueno.classList.remove("hidden")
54 | return "found!";
55 | } else if (choice.toLowerCase().includes("shopping")) {
56 | harajuku.classList.remove("hidden")
57 | return "found!";
58 | } else if (choice.toLowerCase().includes("expensive")) {
59 | shabu.classList.remove("hidden")
60 | return "found!";
61 | } else if (choice.toLowerCase().includes("average")) {
62 | okonomiyaki.classList.remove("hidden")
63 | return "found!";
64 | } else if (choice.toLowerCase().includes("cheap")) {
65 | gyudon.classList.remove("hidden")
66 | return "found!";
67 | } else if (choice.toLowerCase().includes("ride")) {
68 | wheel.classList.remove("hidden")
69 | return "found!";
70 | } else if (choice.toLowerCase().includes("museum")) {
71 | ghibli.classList.remove("hidden")
72 | return "found!";
73 | } else if (choice.toLowerCase().includes("spa")) {
74 | onsen.classList.remove("hidden")
75 | return "found!";
76 | } else if (choice.toLowerCase().includes("hike")) {
77 | mountain.classList.remove("hidden")
78 | return "found!";
79 | }
80 | }
81 |
--------------------------------------------------------------------------------
/day05/tokyoTravelPage/style.css:
--------------------------------------------------------------------------------
1 | body {
2 | font-family: 'IBM Plex Sans', sans-serif;
3 | }
4 |
5 | .navbar {
6 | background-color: #80B4D9;
7 | display: flex;
8 | justify-content: flex-end;
9 | margin: -10px;
10 | margin-bottom: 0px;
11 | min-height: 80px;
12 | }
13 |
14 | .nav-item {
15 | display: flex;
16 | flex-direction: column;
17 | justify-content: center;
18 | padding: 15px 30px;
19 | }
20 |
21 | .nav-item:hover {
22 | background-color: white;
23 | color: #80B4D9;
24 | }
25 |
26 | .nav-item a {
27 | color: black;
28 | text-decoration: none;
29 | }
30 |
31 | .header {
32 | background-image: url('https://www.japan-guide.com/thumb/destination_tokyo.jpg');
33 | background-position: center center;
34 | background-size: cover;
35 | min-height: 400px;
36 | margin: 0px -10px 20px;
37 | display: flex;
38 | flex-direction: column;
39 | justify-content: center;
40 | padding: 20px;
41 | }
42 |
43 | .header h1 {
44 | color: white;
45 | text-align: center;
46 | font-size: 50px;
47 | }
48 |
49 | .container {
50 | width: 80%;
51 | margin: auto;
52 | max-width: 1200px;
53 | }
54 |
55 | .intro {
56 | font-size: 22px;
57 | padding: 10%;
58 | text-align: center;
59 | }
60 |
61 | .section-header {
62 | text-align: center;
63 | background-color: #80B4D9;
64 | color: white;
65 | font-size: 30px;
66 | padding: 30px;
67 | }
68 |
69 | .recommendation {
70 | display: flex;
71 | margin-top: 50px;
72 | margin-bottom: 50px;
73 | }
74 |
75 | .recommendation.reverse {
76 | flex-direction: row-reverse;
77 | }
78 |
79 | .img-container {
80 | width: 50%;
81 | min-height: 400px;
82 | background-position: center center;
83 | background-size: cover;
84 | }
85 |
86 | .img-container#shin {background-image: url('http://img.timeinc.net/time/photoessays/2009/tokyo/tokyo_shinjuku.jpg');}
87 | .img-container#ueno {background-image: url('http://japan.apike.ca/sites/default/files/jp_img/tokyo_ueno_zoo/tokyo-ueno-zoo-20060826-15-30-57.jpg');}
88 | .img-container#hara {background-image: url('https://images.japan-experience.com/guide-japon/33378/s880x460/laurentiu-morariu-lfznupiixd4-unsplash.jpg');}
89 | .img-container#shabu {background-image: url('https://cdn.vox-cdn.com/thumbor/L33PT8M2-84dCYkh6hysa-VKto4=/0x0:4896x3037/1200x800/filters:focal(1741x1068:2523x1850)/cdn.vox-cdn.com/uploads/chorus_image/image/63750007/shutterstock_707212795.0.jpg');}
90 | .img-container#okonomi {background-image: url('https://lh3.googleusercontent.com/proxy/HGspa45YYUXkyY_g7snMS5eZN89SjrCb2vkLpXXNr0R3wZml9KR50XedcHyy_GS0Wy9Yj55VwKxlI8551XtxRENOqto4rmv0mzpiusTLCcAGZ0UuZxZbQB7wRAwBoe4iRTj_Fno');}
91 | .img-container#gyudon {background-image: url('https://thedomesticatedman.files.wordpress.com/2016/09/img_9926.jpg');}
92 | .img-container#wheel {background-image: url('https://www.shutoko.jp/ss/shutokodeikou/special/yakei/img/p007_main-960x450.jpg');}
93 | .img-container#ghibli {background-image: url('https://en.compathy.net/magazine/wp-content/uploads/2016/11/74778993_YBRtrKtjNufe-wcdTq-S1Q_X1GW-4KlxOkojZzRta10.jpg');}
94 | .img-container#onsen {background-image: url('https://cdn.cheapoguides.com/wp-content/uploads/sites/2/2017/07/Park-Pools-1024x600.jpg');}
95 | .img-container#mountain {background-image: url('https://www.japan-guide.com/g18/3036_05.jpg');}
96 |
97 | .recommendation-content {
98 | margin: 0px 40px;
99 | width: 50%;
100 | }
101 |
102 | .recommendation-title {
103 | font-weight: 100;
104 | font-size: 1.5rem;
105 | /* transform: scaleY(1.5); */
106 | }
107 |
108 | .recommendation-body {
109 | font-size: 18px;
110 | font-weight: 100;
111 | line-height: 2;
112 | }
113 |
114 | .hidden {
115 | display: none;
116 | }
117 |
118 | .dashboard {
119 | display: flex;
120 | margin-top: 20px;
121 | margin-bottom: 20px;
122 | justify-content: space-between;
123 | }
124 |
125 | .dashboard input {
126 | width: 25%;
127 | border: none;
128 | border-bottom: 1px black solid;
129 | font-size: 22px;
130 | margin-left: 10px;
131 | }
132 |
133 | .dashboard p {
134 | font-size: 18px;
135 |
136 | }
137 |
138 | input:focus, textarea:focus, select:focus{
139 | outline: none;
140 | }
141 |
--------------------------------------------------------------------------------
/day06/final/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 | GifMaker!
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 | Welcome to the GifFinder!
18 |
19 |
20 | Gifs like grandma used to make :)
21 |
22 |

25 |
26 |
27 |
28 |
38 |
39 | Results
40 |
41 | Your gifs will appear below:
42 |
43 |
44 |

46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
--------------------------------------------------------------------------------
/day06/final/script.js:
--------------------------------------------------------------------------------
1 | console.log("Script running");
2 |
3 | // We'll want to get some random integers, and that isn't built right into JavaScript.
4 | // Here's a pre-built function that will do it for ya.
5 | const getRandom = (max) => {
6 | return Math.floor(Math.random() * Math.floor(max));
7 | }
8 |
9 | // Capture the three major foci of user interaction in variables.
10 | const submitButton = document.querySelector("#submit");
11 | const queryField = document.querySelector("#search");
12 | const imageHolderDiv = document.querySelector("#imageholder");
13 |
14 | // Log the elements to confirm that the querySelectors worked.
15 | console.log(submitButton);
16 | console.log(queryField);
17 | console.log(imageHolderDiv);
18 |
19 | submitButton.addEventListener("click", (e) => {
20 | let myKey = 'YOUR_API_KEY_HERE';
21 | let topic = queryField.value;
22 | let myQuery = `https://api.giphy.com/v1/gifs/search?api_key=${myKey}&q=${topic}+kitten`;
23 | console.log(myQuery);
24 | fetch(myQuery)
25 | .then(response => response.json()) // read JSON response
26 | .then(myjson => {
27 | // code to execute once JSON response is available
28 | let i = getRandom(10);
29 | let imgurl = myjson.data[i].images.downsized.url;
30 | console.log(imgurl);
31 | imageHolderDiv.innerHTML = `
` + imageHolderDiv.innerHTML
32 | })
33 | .catch(error => {
34 | console.log(error); // Log error if there is one
35 | })
36 | })
37 |
--------------------------------------------------------------------------------
/day06/final/style.css:
--------------------------------------------------------------------------------
1 | #imageholder {
2 | display: flex;
3 | flex-wrap: wrap;
4 | justify-content: space-between;
5 | }
6 |
7 | #imageholder img {
8 | height: 250px;
9 | margin-bottom: 30px;
10 | }
11 |
--------------------------------------------------------------------------------
/day06/starter/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 | GifMaker!
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 | Welcome to the GifFinder!
18 |
19 |
20 | Gifs like grandma used to make :)
21 |
22 |

25 |
26 |
27 |
28 |
38 |
39 | Results
40 |
41 | Your gifs will appear below:
42 |
43 |
44 |

46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
--------------------------------------------------------------------------------
/day06/starter/script.js:
--------------------------------------------------------------------------------
1 | console.log("Script running");
2 |
3 | // We'll want to get some random integers, and that isn't built right into JavaScript.
4 | // Here's a pre-built function that will do it for ya.
5 | const getRandom = (max) => {
6 | return Math.floor(Math.random() * Math.floor(max));
7 | }
8 |
9 | // Capture the three major foci of user interaction in variables.
10 | const submitButton = document.querySelector("#submit");
11 | const queryField = document.querySelector("#search");
12 | const imageHolderDiv = document.querySelector("#imageholder");
13 |
14 | // Log the elements to confirm that the querySelectors worked.
15 | console.log(submitButton);
16 | console.log(queryField);
17 | console.log(imageHolderDiv);
18 |
19 | submitButton.addEventListener("click", (e) => {
20 | let myKey = 'YOUR_API_KEY_HERE';
21 | let topic = queryField.value;
22 | console.log(topic);
23 | })
24 |
--------------------------------------------------------------------------------
/day06/starter/style.css:
--------------------------------------------------------------------------------
1 | #imageholder {
2 | display: flex;
3 | flex-wrap: wrap;
4 | justify-content: space-between;
5 | }
6 |
7 | #imageholder img {
8 | height: 250px;
9 | margin-bottom: 30px;
10 | }
11 |
--------------------------------------------------------------------------------
/day07/README.md:
--------------------------------------------------------------------------------
1 | # Day 7
2 |
3 | There is no starter code for day 7.
4 |
--------------------------------------------------------------------------------
/day08/final/secretMessageApp/.gitignore:
--------------------------------------------------------------------------------
1 | # Logs
2 | logs
3 | *.log
4 | npm-debug.log*
5 | yarn-debug.log*
6 | yarn-error.log*
7 | firebase-debug.log*
8 | firebase-debug.*.log*
9 |
10 | # Firebase cache
11 | .firebase/
12 |
13 | # Firebase config
14 |
15 | # Uncomment this if you'd like others to create their own Firebase project.
16 | # For a team working on the same Firebase project(s), it is recommended to leave
17 | # it commented so all members can deploy to the same project(s) in .firebaserc.
18 | # .firebaserc
19 |
20 | # Runtime data
21 | pids
22 | *.pid
23 | *.seed
24 | *.pid.lock
25 |
26 | # Directory for instrumented libs generated by jscoverage/JSCover
27 | lib-cov
28 |
29 | # Coverage directory used by tools like istanbul
30 | coverage
31 |
32 | # nyc test coverage
33 | .nyc_output
34 |
35 | # Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
36 | .grunt
37 |
38 | # Bower dependency directory (https://bower.io/)
39 | bower_components
40 |
41 | # node-waf configuration
42 | .lock-wscript
43 |
44 | # Compiled binary addons (http://nodejs.org/api/addons.html)
45 | build/Release
46 |
47 | # Dependency directories
48 | node_modules/
49 |
50 | # Optional npm cache directory
51 | .npm
52 |
53 | # Optional eslint cache
54 | .eslintcache
55 |
56 | # Optional REPL history
57 | .node_repl_history
58 |
59 | # Output of 'npm pack'
60 | *.tgz
61 |
62 | # Yarn Integrity file
63 | .yarn-integrity
64 |
65 | # dotenv environment variables file
66 | .env
67 |
--------------------------------------------------------------------------------
/day08/final/secretMessageApp/database.rules.json:
--------------------------------------------------------------------------------
1 | {
2 | "rules": {
3 | ".read": "now < 1620280800000", // 2021-5-6
4 | ".write": "now < 1620280800000", // 2021-5-6
5 | }
6 | }
7 |
--------------------------------------------------------------------------------
/day08/final/secretMessageApp/firebase.json:
--------------------------------------------------------------------------------
1 | {
2 | "database": {
3 | "rules": "database.rules.json"
4 | },
5 | "hosting": {
6 | "public": "public",
7 | "ignore": [
8 | "firebase.json",
9 | "**/.*",
10 | "**/node_modules/**"
11 | ]
12 | },
13 | "emulators": {
14 | "hosting": {
15 | "port": 5001
16 | },
17 | "database": {
18 | "port": 3333
19 | },
20 | "ui": {
21 | "enabled": true
22 | }
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/day08/final/secretMessageApp/public/404.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | Page Not Found
7 |
8 |
23 |
24 |
25 |
26 |
404
27 |
Page Not Found
28 |
The specified file was not found on this website. Please check the URL for mistakes and try again.
29 |
Why am I seeing this?
30 |
This page was generated by the Firebase Command-Line Interface. To modify it, edit the 404.html
file in your project's configured public
directory.
31 |
32 |
33 |
34 |
--------------------------------------------------------------------------------
/day08/final/secretMessageApp/public/css/style.css:
--------------------------------------------------------------------------------
1 | * {
2 | font-family: 'Nunito Sans', sans-serif;
3 | }
4 |
5 | :root {
6 | --shadowDark: #D9DDE6;
7 | --background: #E4E9F2;
8 | --shadowLight: #EFF5FE;
9 | }
10 |
11 | body {
12 | background: var(--background);
13 | }
14 |
15 | .hero-body {
16 | justify-content: center;
17 | }
18 |
19 | .login {
20 | border-radius: 25px;
21 | padding: 1.5rem;
22 | box-shadow: 8px 8px 15px var(--shadowDark), -8px -8px 15px var(--shadowLight);
23 | }
24 |
25 | input {
26 | background: var(--shadowDark) !important;
27 | }
28 |
29 | a {
30 | font-weight: 600;
31 | }
32 |
--------------------------------------------------------------------------------
/day08/final/secretMessageApp/public/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 | Secret Messaging App
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
28 | Secret Messaging App
29 |
30 |
31 |
32 |

33 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
--------------------------------------------------------------------------------
/day08/final/secretMessageApp/public/js/viewMessages.js:
--------------------------------------------------------------------------------
1 | const getMessages = () => {
2 | const messagesRef = firebase.database().ref();
3 | messagesRef.on('value', (snapshot) => {
4 | const data = snapshot.val();
5 | findMessage(data);
6 | });
7 | };
8 |
9 | const findMessage = (messages) => {
10 | const passcodeAttempt = document.querySelector('#passcode').value;
11 | for(message in messages) {
12 | const messageData = messages[message];
13 | if(messageData.passcode === passcodeAttempt) {
14 | renderMessageAsHtml(messageData.message);
15 | };
16 | };
17 | };
18 |
19 | const renderMessageAsHtml = (message) => {
20 | // Hide Input Form
21 | const passcodeInput = document.querySelector('#passcodeInput');
22 | passcodeInput.style.display = 'none';
23 | // Render messageas HTML
24 | const messageDiv = document.querySelector('#message');
25 | messageDiv.innerHTML = message;
26 | };
27 |
--------------------------------------------------------------------------------
/day08/final/secretMessageApp/public/js/writeMessage.js:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/google/cssi-labs/f3c445753c96e3da5cf96bd5ad538aea72446aae/day08/final/secretMessageApp/public/js/writeMessage.js
--------------------------------------------------------------------------------
/day08/final/secretMessageApp/public/viewMessages.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 | Secret Messaging App
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
View Your Messages!
23 |
24 |
25 |
26 |
36 |
37 |
38 |
39 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
--------------------------------------------------------------------------------
/day08/starter/secretMessageApp/public/css/style.css:
--------------------------------------------------------------------------------
1 | * {
2 | font-family: 'Nunito Sans', sans-serif;
3 | }
4 |
5 | :root {
6 | --shadowDark: #D9DDE6;
7 | --background: #E4E9F2;
8 | --shadowLight: #EFF5FE;
9 | }
10 |
11 | body {
12 | background: var(--background);
13 | }
14 |
15 | .hero-body {
16 | justify-content: center;
17 | }
18 |
19 | .login {
20 | border-radius: 25px;
21 | padding: 1.5rem;
22 | box-shadow: 8px 8px 15px var(--shadowDark), -8px -8px 15px var(--shadowLight);
23 | }
24 |
25 | input {
26 | background: var(--shadowDark) !important;
27 | }
28 |
29 | a {
30 | font-weight: 600;
31 | }
32 |
--------------------------------------------------------------------------------
/day08/starter/secretMessageApp/public/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 | Secret Messaging App
10 |
11 |
12 |
13 |
14 |
15 |
16 |
23 | Secret Messaging App
24 |
25 |
26 |
27 |

28 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
--------------------------------------------------------------------------------
/day08/starter/secretMessageApp/public/js/viewMessages.js:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/google/cssi-labs/f3c445753c96e3da5cf96bd5ad538aea72446aae/day08/starter/secretMessageApp/public/js/viewMessages.js
--------------------------------------------------------------------------------
/day08/starter/secretMessageApp/public/js/writeMessage.js:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/google/cssi-labs/f3c445753c96e3da5cf96bd5ad538aea72446aae/day08/starter/secretMessageApp/public/js/writeMessage.js
--------------------------------------------------------------------------------
/day08/starter/secretMessageApp/public/viewMessages.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 | Secret Messaging App
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
View Your Messages!
23 |
24 |
25 |
26 |
36 |
37 |
38 |
39 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
--------------------------------------------------------------------------------
/day09/final/secretMessageApp/database.rules.json:
--------------------------------------------------------------------------------
1 | {
2 | "rules": {
3 | ".read": "now < 1620280800000", // 2021-5-6
4 | ".write": "now < 1620280800000", // 2021-5-6
5 | }
6 | }
--------------------------------------------------------------------------------
/day09/final/secretMessageApp/firebase.json:
--------------------------------------------------------------------------------
1 | {
2 | "database": {
3 | "rules": "database.rules.json"
4 | },
5 | "hosting": {
6 | "public": "public",
7 | "ignore": [
8 | "firebase.json",
9 | "**/.*",
10 | "**/node_modules/**"
11 | ]
12 | },
13 | "emulators": {
14 | "hosting": {
15 | "port": 5001
16 | },
17 | "database": {
18 | "port": 3333
19 | },
20 | "ui": {
21 | "enabled": true
22 | }
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/day09/final/secretMessageApp/public/404.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | Page Not Found
7 |
8 |
23 |
24 |
25 |
26 |
404
27 |
Page Not Found
28 |
The specified file was not found on this website. Please check the URL for mistakes and try again.
29 |
Why am I seeing this?
30 |
This page was generated by the Firebase Command-Line Interface. To modify it, edit the 404.html
file in your project's configured public
directory.
31 |
32 |
33 |
34 |
--------------------------------------------------------------------------------
/day09/final/secretMessageApp/public/css/style.css:
--------------------------------------------------------------------------------
1 | * {
2 | font-family: 'Nunito Sans', sans-serif;
3 | }
4 |
5 | :root {
6 | --shadowDark: #D9DDE6;
7 | --background: #E4E9F2;
8 | --shadowLight: #EFF5FE;
9 | }
10 |
11 | body {
12 | background: var(--background);
13 | }
14 |
15 | .hero-body {
16 | justify-content: center;
17 | }
18 |
19 | .login {
20 | border-radius: 25px;
21 | padding: 1.5rem;
22 | box-shadow: 8px 8px 15px var(--shadowDark), -8px -8px 15px var(--shadowLight);
23 | }
24 |
25 | input {
26 | background: var(--shadowDark) !important;
27 | }
28 |
29 | a {
30 | font-weight: 600;
31 | }
--------------------------------------------------------------------------------
/day09/final/secretMessageApp/public/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 | Secret Messaging App
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
28 | Secret Messaging App
29 |
30 |
31 |
32 |

33 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
--------------------------------------------------------------------------------
/day09/final/secretMessageApp/public/js/viewMessages.js:
--------------------------------------------------------------------------------
1 | const getMessages = () => {
2 | const messagesRef = firebase.database().ref();
3 | messagesRef.on('value', (snapshot) => {
4 | const data = snapshot.val();
5 | findMessage(data);
6 | });
7 | }
8 |
9 | const findMessage = (messages) => {
10 | const passcodeAttempt = document.querySelector('#passcode').value;
11 | for(message in messages) {
12 | const messageData = messages[message];
13 | if(messageData.passcode === passcodeAttempt) {
14 | renderMessageAsHtml(messageData.message)
15 | }
16 | }
17 | }
18 |
19 | const renderMessageAsHtml = (message) => {
20 | // Hide Input Form
21 | const passcodeInput = document.querySelector('#passcodeInput');
22 | passcodeInput.style.display = 'none';
23 | // Render messageas HTML
24 | const messageDiv = document.querySelector('#message');
25 | messageDiv.innerHTML = message;
26 | }
--------------------------------------------------------------------------------
/day09/final/secretMessageApp/public/js/writeMessage.js:
--------------------------------------------------------------------------------
1 | const submitMessage = () => {
2 | const passcodeInput = document.querySelector('#passcode').value;
3 | const messageInput = document.querySelector('#message').value;
4 |
5 | firebase.database().ref().push({
6 | passcode: passcodeInput,
7 | message: messageInput
8 | });
9 | };
--------------------------------------------------------------------------------
/day09/final/secretMessageApp/public/viewMessages.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 | Secret Messaging App
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
View Your Messages!
23 |
24 |
25 |
26 |
36 |
37 |
38 |
39 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
--------------------------------------------------------------------------------
/day09/starter/secretMessageApp/.gitignore:
--------------------------------------------------------------------------------
1 | # Logs
2 | logs
3 | *.log
4 | npm-debug.log*
5 | yarn-debug.log*
6 | yarn-error.log*
7 | firebase-debug.log*
8 | firebase-debug.*.log*
9 |
10 | # Firebase cache
11 | .firebase/
12 |
13 | # Firebase config
14 |
15 | # Uncomment this if you'd like others to create their own Firebase project.
16 | # For a team working on the same Firebase project(s), it is recommended to leave
17 | # it commented so all members can deploy to the same project(s) in .firebaserc.
18 | # .firebaserc
19 |
20 | # Runtime data
21 | pids
22 | *.pid
23 | *.seed
24 | *.pid.lock
25 |
26 | # Directory for instrumented libs generated by jscoverage/JSCover
27 | lib-cov
28 |
29 | # Coverage directory used by tools like istanbul
30 | coverage
31 |
32 | # nyc test coverage
33 | .nyc_output
34 |
35 | # Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
36 | .grunt
37 |
38 | # Bower dependency directory (https://bower.io/)
39 | bower_components
40 |
41 | # node-waf configuration
42 | .lock-wscript
43 |
44 | # Compiled binary addons (http://nodejs.org/api/addons.html)
45 | build/Release
46 |
47 | # Dependency directories
48 | node_modules/
49 |
50 | # Optional npm cache directory
51 | .npm
52 |
53 | # Optional eslint cache
54 | .eslintcache
55 |
56 | # Optional REPL history
57 | .node_repl_history
58 |
59 | # Output of 'npm pack'
60 | *.tgz
61 |
62 | # Yarn Integrity file
63 | .yarn-integrity
64 |
65 | # dotenv environment variables file
66 | .env
67 |
--------------------------------------------------------------------------------
/day09/starter/secretMessageApp/database.rules.json:
--------------------------------------------------------------------------------
1 | {
2 | "rules": {
3 | ".read": "now < 1620280800000", // 2021-5-6
4 | ".write": "now < 1620280800000", // 2021-5-6
5 | }
6 | }
--------------------------------------------------------------------------------
/day09/starter/secretMessageApp/firebase.json:
--------------------------------------------------------------------------------
1 | {
2 | "database": {
3 | "rules": "database.rules.json"
4 | },
5 | "hosting": {
6 | "public": "public",
7 | "ignore": [
8 | "firebase.json",
9 | "**/.*",
10 | "**/node_modules/**"
11 | ]
12 | },
13 | "emulators": {
14 | "hosting": {
15 | "port": 5001
16 | },
17 | "database": {
18 | "port": 3333
19 | },
20 | "ui": {
21 | "enabled": true
22 | }
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/day09/starter/secretMessageApp/public/404.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | Page Not Found
7 |
8 |
23 |
24 |
25 |
26 |
404
27 |
Page Not Found
28 |
The specified file was not found on this website. Please check the URL for mistakes and try again.
29 |
Why am I seeing this?
30 |
This page was generated by the Firebase Command-Line Interface. To modify it, edit the 404.html
file in your project's configured public
directory.
31 |
32 |
33 |
34 |
--------------------------------------------------------------------------------
/day09/starter/secretMessageApp/public/css/style.css:
--------------------------------------------------------------------------------
1 | * {
2 | font-family: 'Nunito Sans', sans-serif;
3 | }
4 |
5 | :root {
6 | --shadowDark: #D9DDE6;
7 | --background: #E4E9F2;
8 | --shadowLight: #EFF5FE;
9 | }
10 |
11 | body {
12 | background: var(--background);
13 | }
14 |
15 | .hero-body {
16 | justify-content: center;
17 | }
18 |
19 | .login {
20 | border-radius: 25px;
21 | padding: 1.5rem;
22 | box-shadow: 8px 8px 15px var(--shadowDark), -8px -8px 15px var(--shadowLight);
23 | }
24 |
25 | input {
26 | background: var(--shadowDark) !important;
27 | }
28 |
29 | a {
30 | font-weight: 600;
31 | }
--------------------------------------------------------------------------------
/day09/starter/secretMessageApp/public/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 | Secret Messaging App
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
28 | Secret Messaging App
29 |
30 |
31 |
32 |

33 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
--------------------------------------------------------------------------------
/day09/starter/secretMessageApp/public/js/viewMessages.js:
--------------------------------------------------------------------------------
1 | const getMessages = () => {
2 | const messagesRef = firebase.database().ref();
3 | messagesRef.on('value', (snapshot) => {
4 | const data = snapshot.val();
5 | findMessage(data);
6 | });
7 | }
8 |
9 | const findMessage = (messages) => {
10 | const passcodeAttempt = document.querySelector('#passcode').value;
11 | for(message in messages) {
12 | const messageData = messages[message];
13 | if(messageData.passcode === passcodeAttempt) {
14 | renderMessageAsHtml(messageData.message)
15 | }
16 | }
17 | }
18 |
19 | const renderMessageAsHtml = (message) => {
20 | // Hide Input Form
21 | const passcodeInput = document.querySelector('#passcodeInput');
22 | passcodeInput.style.display = 'none';
23 | // Render messageas HTML
24 | const messageDiv = document.querySelector('#message');
25 | messageDiv.innerHTML = message;
26 | }
--------------------------------------------------------------------------------
/day09/starter/secretMessageApp/public/js/writeMessage.js:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/google/cssi-labs/f3c445753c96e3da5cf96bd5ad538aea72446aae/day09/starter/secretMessageApp/public/js/writeMessage.js
--------------------------------------------------------------------------------
/day09/starter/secretMessageApp/public/viewMessages.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 | Secret Messaging App
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
View Your Messages!
23 |
24 |
25 |
26 |
36 |
37 |
38 |
39 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
--------------------------------------------------------------------------------
/day10/bookRecsExemplar/.firebaserc:
--------------------------------------------------------------------------------
1 | {
2 | "projects": {
3 | "default": "book-recs-1580a"
4 | }
5 | }
6 |
--------------------------------------------------------------------------------
/day10/bookRecsExemplar/.gitignore:
--------------------------------------------------------------------------------
1 | # Logs
2 | logs
3 | *.log
4 | npm-debug.log*
5 | yarn-debug.log*
6 | yarn-error.log*
7 | firebase-debug.log*
8 | firebase-debug.*.log*
9 |
10 | # Firebase cache
11 | .firebase/
12 |
13 | # Firebase config
14 |
15 | # Uncomment this if you'd like others to create their own Firebase project.
16 | # For a team working on the same Firebase project(s), it is recommended to leave
17 | # it commented so all members can deploy to the same project(s) in .firebaserc.
18 | # .firebaserc
19 |
20 | # Runtime data
21 | pids
22 | *.pid
23 | *.seed
24 | *.pid.lock
25 |
26 | # Directory for instrumented libs generated by jscoverage/JSCover
27 | lib-cov
28 |
29 | # Coverage directory used by tools like istanbul
30 | coverage
31 |
32 | # nyc test coverage
33 | .nyc_output
34 |
35 | # Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
36 | .grunt
37 |
38 | # Bower dependency directory (https://bower.io/)
39 | bower_components
40 |
41 | # node-waf configuration
42 | .lock-wscript
43 |
44 | # Compiled binary addons (http://nodejs.org/api/addons.html)
45 | build/Release
46 |
47 | # Dependency directories
48 | node_modules/
49 |
50 | # Optional npm cache directory
51 | .npm
52 |
53 | # Optional eslint cache
54 | .eslintcache
55 |
56 | # Optional REPL history
57 | .node_repl_history
58 |
59 | # Output of 'npm pack'
60 | *.tgz
61 |
62 | # Yarn Integrity file
63 | .yarn-integrity
64 |
65 | # dotenv environment variables file
66 | .env
67 |
--------------------------------------------------------------------------------
/day10/bookRecsExemplar/README.md:
--------------------------------------------------------------------------------
1 | # book-recs-exemplar
2 |
--------------------------------------------------------------------------------
/day10/bookRecsExemplar/database.rules.json:
--------------------------------------------------------------------------------
1 | {
2 | "rules": {
3 | ".read": "now < 1618639200000", // 2021-4-17
4 | ".write": "now < 1618639200000", // 2021-4-17
5 | }
6 | }
--------------------------------------------------------------------------------
/day10/bookRecsExemplar/firebase.json:
--------------------------------------------------------------------------------
1 | {
2 | "database": {
3 | "rules": "database.rules.json"
4 | },
5 | "hosting": {
6 | "public": "public",
7 | "ignore": [
8 | "firebase.json",
9 | "**/.*",
10 | "**/node_modules/**"
11 | ]
12 | },
13 | "emulators": {
14 | "auth": {
15 | "port": 1111
16 | },
17 | "database": {
18 | "port": 2222
19 | },
20 | "hosting": {
21 | "port": 3333,
22 | "headers": [
23 | { "source":"/service-worker.js", "headers": [{"key": "Cache-Control", "value": "no-cache"}] }
24 | ]},
25 | "ui": {
26 | "enabled": true
27 | }
28 | },
29 | "remoteconfig": {
30 | "template": "remoteconfig.template.json"
31 | }
32 | }
33 |
--------------------------------------------------------------------------------
/day10/bookRecsExemplar/public/404.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | Page Not Found
7 |
8 |
23 |
24 |
25 |
26 |
404
27 |
Page Not Found
28 |
The specified file was not found on this website. Please check the URL for mistakes and try again.
29 |
Why am I seeing this?
30 |
This page was generated by the Firebase Command-Line Interface. To modify it, edit the 404.html
file in your project's configured public
directory.
31 |
32 |
33 |
34 |
--------------------------------------------------------------------------------
/day10/bookRecsExemplar/public/addBook.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 | Find your next book!
9 |
10 |
11 |
12 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 | Add A Book To Your Library
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 |
A part of a series?
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
--------------------------------------------------------------------------------
/day10/bookRecsExemplar/public/css/style.css:
--------------------------------------------------------------------------------
1 | /* .survey {
2 | position: fixed;
3 | } */
4 |
5 | #coverImg {
6 | max-width: 500px;
7 | height: auto;
8 | }
9 |
10 | .field:not(:last-child) {
11 | margin-bottom: 20px;
12 | }
13 |
14 | @media screen and (min-width: 768px) {
15 | body {
16 | padding-top: calc(3.25rem + 20px);
17 | }
18 |
19 | .navbar {
20 | padding: 10px 0;
21 | position: fixed;
22 | top: 0;
23 | width: 100%;
24 | }
25 |
26 | .hero.is-fullheight {
27 | min-height: calc(100vh - 6.5rem - 40px);
28 | }
29 | }
--------------------------------------------------------------------------------
/day10/bookRecsExemplar/public/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 | Find your next book!
9 |
10 |
11 |
12 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
Find Your Next Book!
42 |
Add a Book to Your Library
43 |
44 |
![]()
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
58 |
59 |
60 |
61 |
62 |
Are you interested in a series?
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
--------------------------------------------------------------------------------
/day10/bookRecsExemplar/public/js/dbConnection.js:
--------------------------------------------------------------------------------
1 | const firebaseConfig = {
2 | apiKey: "AIzaSyDQBUs3YMBVXOQTVq4C68EKLwl0NkU6RmE",
3 | authDomain: "book-recs-1580a.firebaseapp.com",
4 | databaseURL: "https://book-recs-1580a-default-rtdb.firebaseio.com",
5 | projectId: "book-recs-1580a",
6 | storageBucket: "book-recs-1580a.appspot.com",
7 | messagingSenderId: "842740101788",
8 | appId: "1:842740101788:web:4ef31653c803f124863359",
9 | measurementId: "G-843YS38J6C"
10 | };
--------------------------------------------------------------------------------
/day10/bookRecsExemplar/public/js/script.js:
--------------------------------------------------------------------------------
1 | const handleSubmitSurvey = () => {
2 | if (!firebase.apps.length) {
3 | firebase.initializeApp(firebaseConfig);
4 | }
5 | else {
6 | firebase.app(); // if already initialized, use that one
7 | }
8 |
9 | const genre = getGenre();
10 | const series = getSeriesPref();
11 | const emotion = getEmotion();
12 | let shuffledBooks;
13 | // Get books from DB
14 | const getBookRec = firebase.database().ref('books').orderByChild('series');
15 | getBookRec.on('value', (snapshot) => {
16 | const allBooks = snapshot.val();
17 | console.log(allBooks)
18 |
19 | const allBooksArray = Object.entries(allBooks);
20 | // Filter books based on survey results
21 | const allRecommendations = allBooksArray.filter(book => {
22 | // book[0] is the title of the book, book[1] is all of the data associated with it
23 | const bookData = book[1];
24 | const bookGenre = bookData.genre;
25 | const bookEmotion = bookData.emotions;
26 |
27 | // Firebase RTBD does not support booleans, converts all text to strings
28 | // console.log(bookData.series)
29 | const seriesBoolToStr = bookData.series.toString();
30 | return seriesBoolToStr === series && bookGenre.includes(genre) && bookEmotion.includes(emotion);
31 | });
32 | shuffledBooks = shuffleBookRecs(allRecommendations);
33 | const bookRecommendation = shuffledBooks[0][1];
34 | document.getElementById('coverImg').setAttribute('src', bookRecommendation.cover_img);
35 | return shuffledBooks;
36 | })
37 | }
38 |
39 | const getGenre = () => {
40 | const genre = document.getElementById('genre').value;
41 | return genre;
42 | }
43 |
44 | const getSeriesPref = () => {
45 | const seriesSelection = document.getElementsByName('series');
46 | let series;
47 |
48 | for (let i = 0; i < seriesSelection.length; i++) {
49 | if (seriesSelection[i].checked) {
50 | series = seriesSelection[i].value;
51 | // only one radio can be logically checked, don't check the rest
52 | break;
53 | }
54 | }
55 | return series;
56 | }
57 |
58 | const getEmotion = () => {
59 | const emotion = document.getElementById('emotion').value;
60 | return emotion;
61 | }
62 |
63 | const shuffleBookRecs = (books) => {
64 | let shuffledBooks = [];
65 | for(let i = books.length; i > 0; i--) {
66 | const randomNum = Math.random()
67 | const randomFloat = randomNum * books.length
68 | const randomIdx = Math.floor(randomFloat)
69 | shuffledBooks.push(books[randomIdx])
70 | books.splice(randomIdx, 1)
71 | }
72 | console.log(shuffledBooks)
73 | return shuffledBooks;
74 | }
75 |
76 | const handleAddBook = () => {
77 | const title = document.getElementById('title').value;
78 | const author = document.getElementById('author').value;
79 | const cover = document.getElementById('cover').value;
80 | const emotions = document.getElementById('emotions').value;
81 | const genres = document.getElementById('genres').value
82 | const series = getSeriesPref();
83 |
84 | const emotionsArray = emotions.split(',');
85 | const genresArray = genres.split(',')
86 |
87 | firebase.database().ref('books').push({
88 | author: author,
89 | title: title,
90 | cover_img: cover,
91 | emotions: emotionsArray,
92 | genre: genresArray,
93 | series: series
94 | });
95 | }
--------------------------------------------------------------------------------
/day10/bookRecsExemplar/remoteconfig.template.json:
--------------------------------------------------------------------------------
1 | {}
--------------------------------------------------------------------------------
/day10/bookSearchExemplar/.firebaserc:
--------------------------------------------------------------------------------
1 | {
2 | "projects": {
3 | "default": "book-recs-1580a"
4 | }
5 | }
6 |
--------------------------------------------------------------------------------
/day10/bookSearchExemplar/.gitignore:
--------------------------------------------------------------------------------
1 | # Logs
2 | logs
3 | *.log
4 | npm-debug.log*
5 | yarn-debug.log*
6 | yarn-error.log*
7 | firebase-debug.log*
8 | firebase-debug.*.log*
9 |
10 | # Firebase cache
11 | .firebase/
12 |
13 | # Firebase config
14 |
15 | # Uncomment this if you'd like others to create their own Firebase project.
16 | # For a team working on the same Firebase project(s), it is recommended to leave
17 | # it commented so all members can deploy to the same project(s) in .firebaserc.
18 | # .firebaserc
19 |
20 | # Runtime data
21 | pids
22 | *.pid
23 | *.seed
24 | *.pid.lock
25 |
26 | # Directory for instrumented libs generated by jscoverage/JSCover
27 | lib-cov
28 |
29 | # Coverage directory used by tools like istanbul
30 | coverage
31 |
32 | # nyc test coverage
33 | .nyc_output
34 |
35 | # Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
36 | .grunt
37 |
38 | # Bower dependency directory (https://bower.io/)
39 | bower_components
40 |
41 | # node-waf configuration
42 | .lock-wscript
43 |
44 | # Compiled binary addons (http://nodejs.org/api/addons.html)
45 | build/Release
46 |
47 | # Dependency directories
48 | node_modules/
49 |
50 | # Optional npm cache directory
51 | .npm
52 |
53 | # Optional eslint cache
54 | .eslintcache
55 |
56 | # Optional REPL history
57 | .node_repl_history
58 |
59 | # Output of 'npm pack'
60 | *.tgz
61 |
62 | # Yarn Integrity file
63 | .yarn-integrity
64 |
65 | # dotenv environment variables file
66 | .env
67 |
--------------------------------------------------------------------------------
/day10/bookSearchExemplar/README.md:
--------------------------------------------------------------------------------
1 | # book-search-exemplar
2 |
--------------------------------------------------------------------------------
/day10/bookSearchExemplar/database.rules.json:
--------------------------------------------------------------------------------
1 | {
2 | "rules": {
3 | ".read": "now < 1618639200000", // 2021-4-17
4 | ".write": "now < 1618639200000", // 2021-4-17
5 | }
6 | }
--------------------------------------------------------------------------------
/day10/bookSearchExemplar/firebase.json:
--------------------------------------------------------------------------------
1 | {
2 | "database": {
3 | "rules": "database.rules.json"
4 | },
5 | "hosting": {
6 | "public": "public",
7 | "ignore": [
8 | "firebase.json",
9 | "**/.*",
10 | "**/node_modules/**"
11 | ]
12 | },
13 | "emulators": {
14 | "auth": {
15 | "port": 1111
16 | },
17 | "functions": {
18 | "port": 2222
19 | },
20 | "database": {
21 | "port": 3333
22 | },
23 | "hosting": {
24 | "port": 4444,
25 | "headers": [
26 | { "source":"/service-worker.js", "headers": [{"key": "Cache-Control", "value": "no-cache"}] }
27 | ]},
28 | "ui": {
29 | "enabled": true
30 | }
31 | }
32 | }
33 |
--------------------------------------------------------------------------------
/day10/bookSearchExemplar/public/404.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | Page Not Found
7 |
8 |
23 |
24 |
25 |
26 |
404
27 |
Page Not Found
28 |
The specified file was not found on this website. Please check the URL for mistakes and try again.
29 |
Why am I seeing this?
30 |
This page was generated by the Firebase Command-Line Interface. To modify it, edit the 404.html
file in your project's configured public
directory.
31 |
32 |
33 |
34 |
--------------------------------------------------------------------------------
/day10/bookSearchExemplar/public/css/style.css:
--------------------------------------------------------------------------------
1 | #coverImg {
2 | max-width: 500px;
3 | height: auto;
4 | margin-left: 22%;
5 | }
6 |
7 | .navbar {
8 | position: fixed;
9 | left: 0;
10 | top: 0;
11 | z-index: 2;
12 | background-color: white;
13 | justify-content: space-around;
14 | width: 100%;
15 | border-bottom: 1px solid lightgray;
16 | }
17 | .navbar-menu {
18 | flex-grow: 0.5;
19 | justify-content: center;
20 | }
21 | .navbar-menu .navbar-item {
22 | flex-grow: 1;
23 | justify-content: center;
24 | }
25 | .navbar-menu .navbar-item .control {
26 | width: 50%;
27 | }
28 | .body-columns {
29 | margin-top: 10vh;
30 | }
31 | .card {
32 | margin-top: 5rem;
33 | }
34 | .card .header {
35 | padding: 5px 10px;
36 | }
37 | .card-footer .columns {
38 | width: 100%;
39 | }
40 | .card-footer .columns input {
41 | border: none;
42 | border-radius: 0;
43 | box-shadow: none;
44 | }
45 | .card-footer .columns .column:last-child {
46 | display: flex;
47 | align-items: center;
48 | }
49 | .card-footer .columns .column:last-child button {
50 | border: none;
51 | }
52 | .footer {
53 | margin-top: 10vh;
54 | padding: 2rem 1.5rem;
55 | }
56 |
57 | /* @media screen and (max-width: 786px){
58 | .navbar {
59 | justify-content: space-between;
60 | }
61 | } */
--------------------------------------------------------------------------------
/day10/bookSearchExemplar/public/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | Find a Book
7 |
8 |
9 |
10 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
29 |
30 |
31 |
32 |
33 |
34 |
44 |
45 |
46 |
47 |
SEARCH A BOOK!
48 |
49 |
50 |
51 |
52 |
53 |
54 |
61 |
62 |
63 |
75 |
76 |
77 |
78 |
92 |
93 |
94 |
95 |
--------------------------------------------------------------------------------
/day10/bookSearchExemplar/public/js/dbConnection.js:
--------------------------------------------------------------------------------
1 | const firebaseConfig = {
2 | apiKey: "AIzaSyDQBUs3YMBVXOQTVq4C68EKLwl0NkU6RmE",
3 | authDomain: "book-recs-1580a.firebaseapp.com",
4 | databaseURL: "https://book-recs-1580a-default-rtdb.firebaseio.com",
5 | projectId: "book-recs-1580a",
6 | storageBucket: "book-recs-1580a.appspot.com",
7 | messagingSenderId: "842740101788",
8 | appId: "1:842740101788:web:4ef31653c803f124863359",
9 | measurementId: "G-843YS38J6C"
10 | };
11 |
--------------------------------------------------------------------------------
/day10/bookSearchExemplar/public/js/script.js:
--------------------------------------------------------------------------------
1 | let search = document.getElementById('search');
2 | search.addEventListener("keyup", function(event) {
3 | // On Enter keystroke
4 | if (event.keyCode === 13) {
5 | // // Cancel the default action, if needed
6 | // event.preventDefault();
7 | if (!firebase.apps.length) {
8 | firebase.initializeApp(firebaseConfig);
9 | }
10 | else {
11 | firebase.app(); // if already initialized, use that one
12 | }
13 |
14 | // Capture the search string, convert to lowercase
15 | const searchStr = search.value.toLowerCase();
16 |
17 | const bookList = firebase.database().ref('books');
18 | bookList.on('value', (snapshot) => {
19 | const books = snapshot.val();
20 | const bookArray = Object.entries(books);
21 | const findBookByTitle = bookArray.find(arr => {
22 | const bookTitle = arr[1].title;
23 | const bookTitleLowercase = bookTitle.toLowerCase();
24 | console.log(searchStr, bookTitle)
25 | return searchStr === bookTitleLowercase;
26 | })
27 | const imgEle = document.getElementById('coverImg');
28 | const message = document.getElementById('bookContent');
29 | console.log(findBookByTitle)
30 | if(!findBookByTitle) {
31 | imgEle.setAttribute('src', 'https://media.giphy.com/media/14uQ3cOFteDaU/giphy.gif');
32 | message.innerHTML = `Sorry we weren't able to find that title! Try searching for another one.`;
33 | message.classList.add('has-text-centered')
34 | }
35 | else {
36 | const bookInfo = findBookByTitle[1];
37 | imgEle.setAttribute('src', bookInfo.cover_img);
38 | const formattedHTML = formatHTML(bookInfo);
39 | message.innerHTML = formattedHTML;
40 | }
41 | });
42 | }
43 | });
44 |
45 | const formatHTML = (info) => {
46 | let innerHTML = '';
47 | innerHTML += `Author: ${info.author}`;
48 | innerHTML += `
`;
49 | innerHTML += `Title: ${info.title}`;
50 | innerHTML += `
`;
51 | innerHTML += `Purchase This Book`
52 | return innerHTML;
53 | }
--------------------------------------------------------------------------------
/day11/final/firebaseNotes/.firebaserc:
--------------------------------------------------------------------------------
1 | {
2 | "projects": {
3 | "default": "to-do-list-2a702"
4 | }
5 | }
6 |
--------------------------------------------------------------------------------
/day11/final/firebaseNotes/.gitignore:
--------------------------------------------------------------------------------
1 | # Logs
2 | logs
3 | *.log
4 | npm-debug.log*
5 | yarn-debug.log*
6 | yarn-error.log*
7 | firebase-debug.log*
8 | firebase-debug.*.log*
9 |
10 | # Firebase cache
11 | .firebase/
12 |
13 | # Firebase config
14 |
15 | # Uncomment this if you'd like others to create their own Firebase project.
16 | # For a team working on the same Firebase project(s), it is recommended to leave
17 | # it commented so all members can deploy to the same project(s) in .firebaserc.
18 | # .firebaserc
19 |
20 | # Runtime data
21 | pids
22 | *.pid
23 | *.seed
24 | *.pid.lock
25 |
26 | # Directory for instrumented libs generated by jscoverage/JSCover
27 | lib-cov
28 |
29 | # Coverage directory used by tools like istanbul
30 | coverage
31 |
32 | # nyc test coverage
33 | .nyc_output
34 |
35 | # Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
36 | .grunt
37 |
38 | # Bower dependency directory (https://bower.io/)
39 | bower_components
40 |
41 | # node-waf configuration
42 | .lock-wscript
43 |
44 | # Compiled binary addons (http://nodejs.org/api/addons.html)
45 | build/Release
46 |
47 | # Dependency directories
48 | node_modules/
49 |
50 | # Optional npm cache directory
51 | .npm
52 |
53 | # Optional eslint cache
54 | .eslintcache
55 |
56 | # Optional REPL history
57 | .node_repl_history
58 |
59 | # Output of 'npm pack'
60 | *.tgz
61 |
62 | # Yarn Integrity file
63 | .yarn-integrity
64 |
65 | # dotenv environment variables file
66 | .env
67 |
--------------------------------------------------------------------------------
/day11/final/firebaseNotes/database.rules.json:
--------------------------------------------------------------------------------
1 | {
2 | "rules": {
3 | ".read": true,
4 | ".write": true
5 | }
6 | }
7 |
--------------------------------------------------------------------------------
/day11/final/firebaseNotes/firebase.json:
--------------------------------------------------------------------------------
1 | {
2 | "database": {
3 | "rules": "database.rules.json"
4 | },
5 | "hosting": {
6 | "public": "public",
7 | "ignore": [
8 | "firebase.json",
9 | "**/.*",
10 | "**/node_modules/**"
11 | ]
12 | },
13 | "emulators": {
14 | "auth": {
15 | "port": 8111
16 | },
17 | "database": {
18 | "port": 8112
19 | },
20 | "hosting": {
21 | "port": 8113
22 | },
23 | "ui": {
24 | "enabled": true
25 | }
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/day11/final/firebaseNotes/public/404.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | Page Not Found
7 |
8 |
23 |
24 |
25 |
26 |
404
27 |
Page Not Found
28 |
The specified file was not found on this website. Please check the URL for mistakes and try again.
29 |
Why am I seeing this?
30 |
This page was generated by the Firebase Command-Line Interface. To modify it, edit the 404.html
file in your project's configured public
directory.
31 |
32 |
33 |
34 |
--------------------------------------------------------------------------------
/day11/final/firebaseNotes/public/css/writeNote.css:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/google/cssi-labs/f3c445753c96e3da5cf96bd5ad538aea72446aae/day11/final/firebaseNotes/public/css/writeNote.css
--------------------------------------------------------------------------------
/day11/final/firebaseNotes/public/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | Fire Notes
7 |
8 |
9 |
10 |
11 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 | Welcome to 🔥Fire Notes📝!
39 |
40 |
41 | Log in to view your notes or create a new one.
42 |
43 |
44 |
45 |
46 | Sign In
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
--------------------------------------------------------------------------------
/day11/final/firebaseNotes/public/js/signIn.js:
--------------------------------------------------------------------------------
1 | const signIn = () => {
2 | var provider = new firebase.auth.GoogleAuthProvider();
3 | // console.log(provider)
4 | firebase.auth()
5 | .signInWithPopup(provider)
6 | .then((result) => {
7 | /** @type {firebase.auth.OAuthCredential} */
8 | var credential = result.credential;
9 | var token = credential.accessToken;
10 |
11 | // The signed-in user info.
12 | var user = result.user;
13 | window.location = 'writeNote.html';
14 | }).catch((error) => {
15 | // Handle Errors here.
16 | var errorCode = error.code;
17 | var errorMessage = error.message;
18 | // The email of the user's account used.
19 | var email = error.email;
20 | // The firebase.auth.AuthCredential type that was used.
21 | var credential = error.credential;
22 | const err = {
23 | errorCode,
24 | errorMessage,
25 | email,
26 | credential
27 | };
28 | console.log(err);
29 | });
30 | }
--------------------------------------------------------------------------------
/day11/final/firebaseNotes/public/js/writeNote.js:
--------------------------------------------------------------------------------
1 | let googleUser;
2 |
3 | window.onload = (event) => {
4 | // Use this to retain user state between html pages.
5 | firebase.auth().onAuthStateChanged(function(user) {
6 | if (user) {
7 | console.log('Logged in as: ' + user.displayName);
8 | googleUser = user;
9 | } else {
10 | window.location = 'index.html'; // If not logged in, navigate back to login page.
11 | }
12 | });
13 | };
14 |
15 | const handleNoteSubmit = () => {
16 | // 1. Capture the form data
17 | const noteTitle = document.querySelector('#noteTitle');
18 | const noteText = document.querySelector('#noteText');
19 | // 2. Format the data and write it to our database
20 | firebase.database().ref(`users/${googleUser.uid}`).push({
21 | title: noteTitle.value,
22 | text: noteText.value
23 | })
24 | // 3. Clear the form so that we can write a new note
25 | .then(() => {
26 | noteTitle.value = "";
27 | noteText.value = "";
28 | });
29 | };
--------------------------------------------------------------------------------
/day11/final/firebaseNotes/public/writeNote.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | Fire Notes
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
What's on your mind?
30 |
31 | “The most beautiful things are those that madness prompts and reason writes."
32 |
33 |
34 | —Andre Gide
35 |
36 |
37 | to view your notes.
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 |
--------------------------------------------------------------------------------
/day11/starter/firebaseNotes/public/css/writeNote.css:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/google/cssi-labs/f3c445753c96e3da5cf96bd5ad538aea72446aae/day11/starter/firebaseNotes/public/css/writeNote.css
--------------------------------------------------------------------------------
/day11/starter/firebaseNotes/public/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | Fire Notes
7 |
8 |
9 |
10 |
11 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 | Welcome to 🔥Fire Notes📝!
38 |
39 |
40 | Log in to view your notes or create a new one.
41 |
42 |
43 |
44 |
45 | Sign In
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
--------------------------------------------------------------------------------
/day11/starter/firebaseNotes/public/js/signIn.js:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/google/cssi-labs/f3c445753c96e3da5cf96bd5ad538aea72446aae/day11/starter/firebaseNotes/public/js/signIn.js
--------------------------------------------------------------------------------
/day11/starter/firebaseNotes/public/js/writeNote.js:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/google/cssi-labs/f3c445753c96e3da5cf96bd5ad538aea72446aae/day11/starter/firebaseNotes/public/js/writeNote.js
--------------------------------------------------------------------------------
/day11/starter/firebaseNotes/public/writeNote.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | Fire Notes
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
What's on your mind?
30 |
31 | “The most beautiful things are those that madness prompts and reason writes."
32 |
33 |
34 | —Andre Gide
35 |
36 |
37 | to view your notes.
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 |
--------------------------------------------------------------------------------
/day12/final/firebaseNotes/.firebaserc:
--------------------------------------------------------------------------------
1 | {
2 | "projects": {
3 | "default": "to-do-list-2a702"
4 | }
5 | }
6 |
--------------------------------------------------------------------------------
/day12/final/firebaseNotes/.gitignore:
--------------------------------------------------------------------------------
1 | # Logs
2 | logs
3 | *.log
4 | npm-debug.log*
5 | yarn-debug.log*
6 | yarn-error.log*
7 | firebase-debug.log*
8 | firebase-debug.*.log*
9 |
10 | # Firebase cache
11 | .firebase/
12 |
13 | # Firebase config
14 |
15 | # Uncomment this if you'd like others to create their own Firebase project.
16 | # For a team working on the same Firebase project(s), it is recommended to leave
17 | # it commented so all members can deploy to the same project(s) in .firebaserc.
18 | # .firebaserc
19 |
20 | # Runtime data
21 | pids
22 | *.pid
23 | *.seed
24 | *.pid.lock
25 |
26 | # Directory for instrumented libs generated by jscoverage/JSCover
27 | lib-cov
28 |
29 | # Coverage directory used by tools like istanbul
30 | coverage
31 |
32 | # nyc test coverage
33 | .nyc_output
34 |
35 | # Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
36 | .grunt
37 |
38 | # Bower dependency directory (https://bower.io/)
39 | bower_components
40 |
41 | # node-waf configuration
42 | .lock-wscript
43 |
44 | # Compiled binary addons (http://nodejs.org/api/addons.html)
45 | build/Release
46 |
47 | # Dependency directories
48 | node_modules/
49 |
50 | # Optional npm cache directory
51 | .npm
52 |
53 | # Optional eslint cache
54 | .eslintcache
55 |
56 | # Optional REPL history
57 | .node_repl_history
58 |
59 | # Output of 'npm pack'
60 | *.tgz
61 |
62 | # Yarn Integrity file
63 | .yarn-integrity
64 |
65 | # dotenv environment variables file
66 | .env
67 |
--------------------------------------------------------------------------------
/day12/final/firebaseNotes/database.rules.json:
--------------------------------------------------------------------------------
1 | {
2 | "rules": {
3 | ".read": true,
4 | ".write": true
5 | }
6 | }
7 |
--------------------------------------------------------------------------------
/day12/final/firebaseNotes/firebase.json:
--------------------------------------------------------------------------------
1 | {
2 | "database": {
3 | "rules": "database.rules.json"
4 | },
5 | "hosting": {
6 | "public": "public",
7 | "ignore": [
8 | "firebase.json",
9 | "**/.*",
10 | "**/node_modules/**"
11 | ]
12 | },
13 | "emulators": {
14 | "auth": {
15 | "port": 8111
16 | },
17 | "database": {
18 | "port": 8112
19 | },
20 | "hosting": {
21 | "port": 8113
22 | },
23 | "ui": {
24 | "enabled": true
25 | }
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/day12/final/firebaseNotes/public/404.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | Page Not Found
7 |
8 |
23 |
24 |
25 |
26 |
404
27 |
Page Not Found
28 |
The specified file was not found on this website. Please check the URL for mistakes and try again.
29 |
Why am I seeing this?
30 |
This page was generated by the Firebase Command-Line Interface. To modify it, edit the 404.html
file in your project's configured public
directory.
31 |
32 |
33 |
34 |
--------------------------------------------------------------------------------
/day12/final/firebaseNotes/public/css/cards.css:
--------------------------------------------------------------------------------
1 | input::placeholder {
2 | color: antiquewhite;
3 | }
4 |
5 | .navbar {
6 | background: var(--card-bg);
7 | }
8 |
9 | /* Card start*/
10 | .card {
11 | overflow: hidden;
12 | background: yellow;
13 | /* color: var(--bg); */
14 | }
15 |
16 | .card.large {
17 | border-radius: 5px;
18 | }
19 |
20 | .title.no-padding {
21 | margin-bottom: 0 !important;
22 | }
23 |
24 | .footer {
25 | background: white;
26 | }
27 |
28 | .footer a:hover {
29 | color: crimson;
30 | }
31 |
32 | .fa {
33 | color: ghostwhite;
34 | margin: 10px
35 | }
--------------------------------------------------------------------------------
/day12/final/firebaseNotes/public/css/writeNote.css:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/google/cssi-labs/f3c445753c96e3da5cf96bd5ad538aea72446aae/day12/final/firebaseNotes/public/css/writeNote.css
--------------------------------------------------------------------------------
/day12/final/firebaseNotes/public/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | Fire Notes
7 |
8 |
9 |
10 |
11 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 | Welcome to 🔥Fire Notes📝!
39 |
40 |
41 | Log in to view your notes or create a new one.
42 |
43 |
44 |
45 |
46 | Sign In
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
--------------------------------------------------------------------------------
/day12/final/firebaseNotes/public/js/signIn.js:
--------------------------------------------------------------------------------
1 | const signIn = () => {
2 | var provider = new firebase.auth.GoogleAuthProvider();
3 | // console.log(provider)
4 | firebase.auth()
5 | .signInWithPopup(provider)
6 | .then((result) => {
7 | /** @type {firebase.auth.OAuthCredential} */
8 | var credential = result.credential;
9 | var token = credential.accessToken;
10 |
11 | // The signed-in user info.
12 | var user = result.user;
13 | window.location = 'writeNote.html';
14 | }).catch((error) => {
15 | // Handle Errors here.
16 | var errorCode = error.code;
17 | var errorMessage = error.message;
18 | // The email of the user's account used.
19 | var email = error.email;
20 | // The firebase.auth.AuthCredential type that was used.
21 | var credential = error.credential;
22 | const err = {
23 | errorCode,
24 | errorMessage,
25 | email,
26 | credential
27 | };
28 | console.log(err);
29 | });
30 | }
--------------------------------------------------------------------------------
/day12/final/firebaseNotes/public/js/viewNotes.js:
--------------------------------------------------------------------------------
1 | window.onload = (event) => {
2 | // Use this to retain user state between html pages.
3 | firebase.auth().onAuthStateChanged(function(user) {
4 | if (user) {
5 | console.log('Logged in as: ' + user.displayName);
6 | const googleUserId = user.uid;
7 | getNotes(googleUserId);
8 | } else {
9 | // If not logged in, navigate back to login page.
10 | window.location = 'index.html';
11 | };
12 | });
13 | };
14 |
15 | const getNotes = (userId) => {
16 | const notesRef = firebase.database().ref(`users/${userId}`);
17 | notesRef.on('value', (snapshot) => {
18 | const data = snapshot.val();
19 | renderDataAsHtml(data);
20 | });
21 | };
22 |
23 | const renderDataAsHtml = (data) => {
24 | let cards = ``;
25 | for(const noteItem in data) {
26 | const note = data[noteItem];
27 | // For each note create an HTML card
28 | cards += createCard(note)
29 | };
30 | // Inject our string of HTML into our viewNotes.html page
31 | document.querySelector('#app').innerHTML = cards;
32 | };
33 |
34 | const createCard = (note) => {
35 | let innerHTML = "";
36 | innerHTML += ``
37 | innerHTML += `
`
38 | innerHTML += ``
43 | innerHTML += `
`
44 | innerHTML += `
`
45 | innerHTML += `${note.text}`
46 | innerHTML += `
`
47 | innerHTML += `
`
48 | innerHTML += `
`
49 | innerHTML += `
`
50 | return innerHTML;
51 | };
--------------------------------------------------------------------------------
/day12/final/firebaseNotes/public/js/writeNote.js:
--------------------------------------------------------------------------------
1 | let googleUser;
2 |
3 | window.onload = (event) => {
4 | // Use this to retain user state between html pages.
5 | firebase.auth().onAuthStateChanged(function(user) {
6 | if (user) {
7 | console.log('Logged in as: ' + user.displayName);
8 | googleUser = user;
9 | } else {
10 | window.location = 'index.html'; // If not logged in, navigate back to login page.
11 | }
12 | });
13 | };
14 |
15 | const handleNoteSubmit = () => {
16 | // 1. Capture the form data
17 | const noteTitle = document.querySelector('#noteTitle');
18 | const noteText = document.querySelector('#noteText');
19 | // 2. Format the data and write it to our database
20 | firebase.database().ref(`users/${googleUser.uid}`).push({
21 | title: noteTitle.value,
22 | text: noteText.value
23 | })
24 | // 3. Clear the form so that we can write a new note
25 | .then(() => {
26 | noteTitle.value = "";
27 | noteText.value = "";
28 | });
29 | }
--------------------------------------------------------------------------------
/day12/final/firebaseNotes/public/viewNotes.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | Welcome to Firebase Hosting
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
28 |
29 |
30 |
31 |
32 |
Some of Your Greatest Ideas Started Here
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
50 |
51 |
52 |
--------------------------------------------------------------------------------
/day12/final/firebaseNotes/public/writeNote.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | Fire Notes
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
What's on your mind?
30 |
31 | “The most beautiful things are those that madness prompts and reason writes."
32 |
33 |
34 | —Andre Gide
35 |
36 |
37 | to view your notes.
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 |
--------------------------------------------------------------------------------
/day12/starter/firebaseNotes/.firebaserc:
--------------------------------------------------------------------------------
1 | {
2 | "projects": {
3 | "default": "to-do-list-2a702"
4 | }
5 | }
6 |
--------------------------------------------------------------------------------
/day12/starter/firebaseNotes/.gitignore:
--------------------------------------------------------------------------------
1 | # Logs
2 | logs
3 | *.log
4 | npm-debug.log*
5 | yarn-debug.log*
6 | yarn-error.log*
7 | firebase-debug.log*
8 | firebase-debug.*.log*
9 |
10 | # Firebase cache
11 | .firebase/
12 |
13 | # Firebase config
14 |
15 | # Uncomment this if you'd like others to create their own Firebase project.
16 | # For a team working on the same Firebase project(s), it is recommended to leave
17 | # it commented so all members can deploy to the same project(s) in .firebaserc.
18 | # .firebaserc
19 |
20 | # Runtime data
21 | pids
22 | *.pid
23 | *.seed
24 | *.pid.lock
25 |
26 | # Directory for instrumented libs generated by jscoverage/JSCover
27 | lib-cov
28 |
29 | # Coverage directory used by tools like istanbul
30 | coverage
31 |
32 | # nyc test coverage
33 | .nyc_output
34 |
35 | # Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
36 | .grunt
37 |
38 | # Bower dependency directory (https://bower.io/)
39 | bower_components
40 |
41 | # node-waf configuration
42 | .lock-wscript
43 |
44 | # Compiled binary addons (http://nodejs.org/api/addons.html)
45 | build/Release
46 |
47 | # Dependency directories
48 | node_modules/
49 |
50 | # Optional npm cache directory
51 | .npm
52 |
53 | # Optional eslint cache
54 | .eslintcache
55 |
56 | # Optional REPL history
57 | .node_repl_history
58 |
59 | # Output of 'npm pack'
60 | *.tgz
61 |
62 | # Yarn Integrity file
63 | .yarn-integrity
64 |
65 | # dotenv environment variables file
66 | .env
67 |
--------------------------------------------------------------------------------
/day12/starter/firebaseNotes/database.rules.json:
--------------------------------------------------------------------------------
1 | {
2 | "rules": {
3 | ".read": true,
4 | ".write": true
5 | }
6 | }
7 |
--------------------------------------------------------------------------------
/day12/starter/firebaseNotes/firebase.json:
--------------------------------------------------------------------------------
1 | {
2 | "database": {
3 | "rules": "database.rules.json"
4 | },
5 | "hosting": {
6 | "public": "public",
7 | "ignore": [
8 | "firebase.json",
9 | "**/.*",
10 | "**/node_modules/**"
11 | ]
12 | },
13 | "emulators": {
14 | "auth": {
15 | "port": 8111
16 | },
17 | "database": {
18 | "port": 8112
19 | },
20 | "hosting": {
21 | "port": 5000
22 | },
23 | "ui": {
24 | "enabled": true
25 | }
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/day12/starter/firebaseNotes/public/404.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | Page Not Found
7 |
8 |
23 |
24 |
25 |
26 |
404
27 |
Page Not Found
28 |
The specified file was not found on this website. Please check the URL for mistakes and try again.
29 |
Why am I seeing this?
30 |
This page was generated by the Firebase Command-Line Interface. To modify it, edit the 404.html
file in your project's configured public
directory.
31 |
32 |
33 |
34 |
--------------------------------------------------------------------------------
/day12/starter/firebaseNotes/public/css/cards.css:
--------------------------------------------------------------------------------
1 | input::placeholder {
2 | color: antiquewhite;
3 | }
4 |
5 | .navbar {
6 | background: var(--card-bg);
7 | }
8 |
9 | /* Card start*/
10 | .card {
11 | overflow: hidden;
12 | background: yellow;
13 | /* color: var(--bg); */
14 | }
15 |
16 | .card.large {
17 | border-radius: 5px;
18 | }
19 |
20 | .title.no-padding {
21 | margin-bottom: 0 !important;
22 | }
23 |
24 | .footer {
25 | background: white;
26 | }
27 |
28 | .footer a:hover {
29 | color: crimson;
30 | }
31 |
32 | .fa {
33 | color: ghostwhite;
34 | margin: 10px
35 | }
--------------------------------------------------------------------------------
/day12/starter/firebaseNotes/public/css/writeNote.css:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/google/cssi-labs/f3c445753c96e3da5cf96bd5ad538aea72446aae/day12/starter/firebaseNotes/public/css/writeNote.css
--------------------------------------------------------------------------------
/day12/starter/firebaseNotes/public/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | Fire Notes
7 |
8 |
9 |
10 |
11 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 | Welcome to 🔥Fire Notes📝!
39 |
40 |
41 | Log in to view your notes or create a new one.
42 |
43 |
44 |
45 |
46 | Sign In
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
--------------------------------------------------------------------------------
/day12/starter/firebaseNotes/public/js/signIn.js:
--------------------------------------------------------------------------------
1 | const signIn = () => {
2 | var provider = new firebase.auth.GoogleAuthProvider();
3 | // console.log(provider)
4 | firebase.auth()
5 | .signInWithPopup(provider)
6 | .then((result) => {
7 | /** @type {firebase.auth.OAuthCredential} */
8 | var credential = result.credential;
9 | var token = credential.accessToken;
10 |
11 | // The signed-in user info.
12 | var user = result.user;
13 | window.location = 'writeNote.html';
14 | }).catch((error) => {
15 | // Handle Errors here.
16 | var errorCode = error.code;
17 | var errorMessage = error.message;
18 | // The email of the user's account used.
19 | var email = error.email;
20 | // The firebase.auth.AuthCredential type that was used.
21 | var credential = error.credential;
22 | const err = {
23 | errorCode,
24 | errorMessage,
25 | email,
26 | credential
27 | };
28 | console.log(err);
29 | });
30 | }
--------------------------------------------------------------------------------
/day12/starter/firebaseNotes/public/js/viewNotes.js:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/google/cssi-labs/f3c445753c96e3da5cf96bd5ad538aea72446aae/day12/starter/firebaseNotes/public/js/viewNotes.js
--------------------------------------------------------------------------------
/day12/starter/firebaseNotes/public/js/writeNote.js:
--------------------------------------------------------------------------------
1 | let googleUser;
2 |
3 | window.onload = (event) => {
4 | // Use this to retain user state between html pages.
5 | firebase.auth().onAuthStateChanged(function(user) {
6 | if (user) {
7 | console.log('Logged in as: ' + user.displayName);
8 | googleUser = user;
9 | } else {
10 | window.location = 'index.html'; // If not logged in, navigate back to login page.
11 | }
12 | });
13 | };
14 |
15 | const handleNoteSubmit = () => {
16 | // 1. Capture the form data
17 | const noteTitle = document.querySelector('#noteTitle');
18 | const noteText = document.querySelector('#noteText');
19 | // 2. Format the data and write it to our database
20 | firebase.database().ref(`users/${googleUser.uid}`).push({
21 | title: noteTitle.value,
22 | text: noteText.value
23 | })
24 | // 3. Clear the form so that we can write a new note
25 | .then(() => {
26 | noteTitle.value = "";
27 | noteText.value = "";
28 | });
29 | }
--------------------------------------------------------------------------------
/day12/starter/firebaseNotes/public/viewNotes.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | Welcome to Firebase Hosting
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
28 |
29 |
30 |
31 |
32 |
Some of Your Greatest Ideas Started Here
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
50 |
51 |
52 |
53 |
--------------------------------------------------------------------------------
/day12/starter/firebaseNotes/public/writeNote.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | Fire Notes
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
What's on your mind?
30 |
31 | “The most beautiful things are those that madness prompts and reason writes."
32 |
33 |
34 | —Andre Gide
35 |
36 |
37 | to view your notes.
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 |
--------------------------------------------------------------------------------
/day13/final/firebaseNotes/.firebaserc:
--------------------------------------------------------------------------------
1 | {
2 | "projects": {
3 | "default": "to-do-list-2a702"
4 | }
5 | }
6 |
--------------------------------------------------------------------------------
/day13/final/firebaseNotes/.gitignore:
--------------------------------------------------------------------------------
1 | # Logs
2 | logs
3 | *.log
4 | npm-debug.log*
5 | yarn-debug.log*
6 | yarn-error.log*
7 | firebase-debug.log*
8 | firebase-debug.*.log*
9 |
10 | # Firebase cache
11 | .firebase/
12 |
13 | # Firebase config
14 |
15 | # Uncomment this if you'd like others to create their own Firebase project.
16 | # For a team working on the same Firebase project(s), it is recommended to leave
17 | # it commented so all members can deploy to the same project(s) in .firebaserc.
18 | # .firebaserc
19 |
20 | # Runtime data
21 | pids
22 | *.pid
23 | *.seed
24 | *.pid.lock
25 |
26 | # Directory for instrumented libs generated by jscoverage/JSCover
27 | lib-cov
28 |
29 | # Coverage directory used by tools like istanbul
30 | coverage
31 |
32 | # nyc test coverage
33 | .nyc_output
34 |
35 | # Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
36 | .grunt
37 |
38 | # Bower dependency directory (https://bower.io/)
39 | bower_components
40 |
41 | # node-waf configuration
42 | .lock-wscript
43 |
44 | # Compiled binary addons (http://nodejs.org/api/addons.html)
45 | build/Release
46 |
47 | # Dependency directories
48 | node_modules/
49 |
50 | # Optional npm cache directory
51 | .npm
52 |
53 | # Optional eslint cache
54 | .eslintcache
55 |
56 | # Optional REPL history
57 | .node_repl_history
58 |
59 | # Output of 'npm pack'
60 | *.tgz
61 |
62 | # Yarn Integrity file
63 | .yarn-integrity
64 |
65 | # dotenv environment variables file
66 | .env
67 |
--------------------------------------------------------------------------------
/day13/final/firebaseNotes/database.rules.json:
--------------------------------------------------------------------------------
1 | {
2 | "rules": {
3 | ".read": true,
4 | ".write": true
5 | }
6 | }
7 |
--------------------------------------------------------------------------------
/day13/final/firebaseNotes/firebase.json:
--------------------------------------------------------------------------------
1 | {
2 | "database": {
3 | "rules": "database.rules.json"
4 | },
5 | "hosting": {
6 | "public": "public",
7 | "ignore": [
8 | "firebase.json",
9 | "**/.*",
10 | "**/node_modules/**"
11 | ]
12 | },
13 | "emulators": {
14 | "auth": {
15 | "port": 8115
16 | },
17 | "database": {
18 | "port": 8116
19 | },
20 | "hosting": {
21 | "port": 8117
22 | },
23 | "ui": {
24 | "enabled": true
25 | }
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/day13/final/firebaseNotes/public/404.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | Page Not Found
7 |
8 |
23 |
24 |
25 |
26 |
404
27 |
Page Not Found
28 |
The specified file was not found on this website. Please check the URL for mistakes and try again.
29 |
Why am I seeing this?
30 |
This page was generated by the Firebase Command-Line Interface. To modify it, edit the 404.html
file in your project's configured public
directory.
31 |
32 |
33 |
34 |
--------------------------------------------------------------------------------
/day13/final/firebaseNotes/public/css/cards.css:
--------------------------------------------------------------------------------
1 | input::placeholder {
2 | color: antiquewhite;
3 | }
4 |
5 | .navbar {
6 | background: var(--card-bg);
7 | }
8 |
9 | /* Card start*/
10 | .card {
11 | overflow: hidden;
12 | background: yellow;
13 | /* color: var(--bg); */
14 | }
15 |
16 | .card.large {
17 | border-radius: 5px;
18 | }
19 |
20 | .title.no-padding {
21 | margin-bottom: 0 !important;
22 | }
23 |
24 | .footer {
25 | background: white;
26 | }
27 |
28 | .footer a:hover {
29 | color: crimson;
30 | }
31 |
32 | .fa {
33 | color: ghostwhite;
34 | margin: 10px
35 | }
--------------------------------------------------------------------------------
/day13/final/firebaseNotes/public/css/writeNote.css:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/google/cssi-labs/f3c445753c96e3da5cf96bd5ad538aea72446aae/day13/final/firebaseNotes/public/css/writeNote.css
--------------------------------------------------------------------------------
/day13/final/firebaseNotes/public/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | Fire Notes
7 |
8 |
9 |
10 |
11 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 | Welcome to 🔥Fire Notes📝!
39 |
40 |
41 | Log in to view your notes or create a new one.
42 |
43 |
44 |
45 |
46 | Sign In
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
--------------------------------------------------------------------------------
/day13/final/firebaseNotes/public/js/signIn.js:
--------------------------------------------------------------------------------
1 | const signIn = () => {
2 | var provider = new firebase.auth.GoogleAuthProvider();
3 | // console.log(provider)
4 | firebase.auth()
5 | .signInWithPopup(provider)
6 | .then((result) => {
7 | /** @type {firebase.auth.OAuthCredential} */
8 | var credential = result.credential;
9 | var token = credential.accessToken;
10 |
11 | // The signed-in user info.
12 | var user = result.user;
13 | window.location = 'writeNote.html';
14 | }).catch((error) => {
15 | // Handle Errors here.
16 | var errorCode = error.code;
17 | var errorMessage = error.message;
18 | // The email of the user's account used.
19 | var email = error.email;
20 | // The firebase.auth.AuthCredential type that was used.
21 | var credential = error.credential;
22 | const err = {
23 | errorCode,
24 | errorMessage,
25 | email,
26 | credential
27 | };
28 | console.log(err);
29 | });
30 | }
--------------------------------------------------------------------------------
/day13/final/firebaseNotes/public/js/viewNotes.js:
--------------------------------------------------------------------------------
1 | let googleUserId;
2 |
3 | window.onload = (event) => {
4 | // Use this to retain user state between html pages.
5 | firebase.auth().onAuthStateChanged(function(user) {
6 | if (user) {
7 | console.log('Logged in as: ' + user.displayName);
8 | googleUserId = user.uid;
9 | getNotes(googleUserId);
10 | } else {
11 | // If not logged in, navigate back to login page.
12 | window.location = 'index.html';
13 | };
14 | });
15 | };
16 |
17 | const getNotes = (userId) => {
18 | const notesRef = firebase.database().ref(`users/${userId}`);
19 | notesRef.on('value', (snapshot) => {
20 | const data = snapshot.val();
21 | renderDataAsHtml(data);
22 | });
23 | };
24 |
25 | const renderDataAsHtml = (data) => {
26 | let cards = ``;
27 | for(const noteItem in data) {
28 | const note = data[noteItem];
29 | // For each note create an HTML card
30 | cards += createCard(note, noteItem)
31 | };
32 | // Inject our string of HTML into our viewNotes.html page
33 | document.querySelector('#app').innerHTML = cards;
34 | };
35 |
36 | const editNote = (noteId) => {
37 | const editNoteModal = document.querySelector('#editNoteModal');
38 | const notesRef = firebase.database().ref(`users/${googleUserId}`);
39 | notesRef.on('value', (snapshot) => {
40 | const data = snapshot.val();
41 | const noteDetails = data[noteId];
42 | document.querySelector('#editNoteId').value = noteId;
43 | document.querySelector('#editTitleInput').value = noteDetails.title;
44 | document.querySelector('#editTextInput').value = noteDetails.text;
45 | });
46 |
47 | editNoteModal.classList.toggle('is-active');
48 | };
49 |
50 | const deleteNote = (noteId) => {
51 | firebase.database().ref(`users/${googleUserId}/${noteId}`).remove();
52 | }
53 |
54 | const saveEditedNote = () => {
55 | const noteId = document.querySelector('#editNoteId').value;
56 | const noteTitle = document.querySelector('#editTitleInput').value;
57 | const noteText = document.querySelector('#editTextInput').value;
58 | const noteEdits = {
59 | title: noteTitle,
60 | text: noteText
61 | };
62 | firebase.database().ref(`users/${googleUserId}/${noteId}`).update(noteEdits);
63 | closeEditModal();
64 | }
65 |
66 | const closeEditModal = () => {
67 | const editNoteModal = document.querySelector('#editNoteModal');
68 | editNoteModal.classList.toggle('is-active');
69 | };
70 |
71 | const createCard = (note, noteId) => {
72 | let innerHTML = "";
73 | innerHTML += ``
74 | innerHTML += `
`
75 | innerHTML += ``
80 | innerHTML += `
`
81 | innerHTML += `
`
82 | innerHTML += `${note.text}`
83 | innerHTML += `
`
84 | innerHTML += `
`
85 | innerHTML += ``
89 | innerHTML += `
`
90 | innerHTML += `
`
91 |
92 | return innerHTML;
93 | };
94 |
--------------------------------------------------------------------------------
/day13/final/firebaseNotes/public/js/writeNote.js:
--------------------------------------------------------------------------------
1 | let googleUser;
2 |
3 | window.onload = (event) => {
4 | // Use this to retain user state between html pages.
5 | firebase.auth().onAuthStateChanged(function(user) {
6 | if (user) {
7 | console.log('Logged in as: ' + user.displayName);
8 | googleUser = user;
9 | } else {
10 | window.location = 'index.html'; // If not logged in, navigate back to login page.
11 | }
12 | });
13 | };
14 |
15 | const handleNoteSubmit = () => {
16 | // 1. Capture the form data
17 | const noteTitle = document.querySelector('#noteTitle');
18 | const noteText = document.querySelector('#noteText');
19 | // 2. Format the data and write it to our database
20 | firebase.database().ref(`users/${googleUser.uid}`).push({
21 | title: noteTitle.value,
22 | text: noteText.value
23 | })
24 | // 3. Clear the form so that we can write a new note
25 | .then(() => {
26 | noteTitle.value = "";
27 | noteText.value = "";
28 | });
29 | }
--------------------------------------------------------------------------------
/day13/final/firebaseNotes/public/viewNotes.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | Welcome to Firebase Hosting
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
28 |
29 |
30 |
31 |
32 |
Some of Your Greatest Ideas Started Here
33 |
34 |
35 |
36 |
37 |
38 |
39 |
55 |
56 |
57 |
58 |
68 |
69 |
70 |
71 |
--------------------------------------------------------------------------------
/day13/final/firebaseNotes/public/writeNote.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | Fire Notes
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
What's on your mind?
30 |
31 | “The most beautiful things are those that madness prompts and reason writes."
32 |
33 |
34 | —Andre Gide
35 |
36 |
37 | to view your notes.
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 |
--------------------------------------------------------------------------------
/day13/starter/firebaseNotes/.firebaserc:
--------------------------------------------------------------------------------
1 | {
2 | "projects": {
3 | "default": "to-do-list-2a702"
4 | }
5 | }
6 |
--------------------------------------------------------------------------------
/day13/starter/firebaseNotes/.gitignore:
--------------------------------------------------------------------------------
1 | # Logs
2 | logs
3 | *.log
4 | npm-debug.log*
5 | yarn-debug.log*
6 | yarn-error.log*
7 | firebase-debug.log*
8 | firebase-debug.*.log*
9 |
10 | # Firebase cache
11 | .firebase/
12 |
13 | # Firebase config
14 |
15 | # Uncomment this if you'd like others to create their own Firebase project.
16 | # For a team working on the same Firebase project(s), it is recommended to leave
17 | # it commented so all members can deploy to the same project(s) in .firebaserc.
18 | # .firebaserc
19 |
20 | # Runtime data
21 | pids
22 | *.pid
23 | *.seed
24 | *.pid.lock
25 |
26 | # Directory for instrumented libs generated by jscoverage/JSCover
27 | lib-cov
28 |
29 | # Coverage directory used by tools like istanbul
30 | coverage
31 |
32 | # nyc test coverage
33 | .nyc_output
34 |
35 | # Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
36 | .grunt
37 |
38 | # Bower dependency directory (https://bower.io/)
39 | bower_components
40 |
41 | # node-waf configuration
42 | .lock-wscript
43 |
44 | # Compiled binary addons (http://nodejs.org/api/addons.html)
45 | build/Release
46 |
47 | # Dependency directories
48 | node_modules/
49 |
50 | # Optional npm cache directory
51 | .npm
52 |
53 | # Optional eslint cache
54 | .eslintcache
55 |
56 | # Optional REPL history
57 | .node_repl_history
58 |
59 | # Output of 'npm pack'
60 | *.tgz
61 |
62 | # Yarn Integrity file
63 | .yarn-integrity
64 |
65 | # dotenv environment variables file
66 | .env
67 |
--------------------------------------------------------------------------------
/day13/starter/firebaseNotes/database.rules.json:
--------------------------------------------------------------------------------
1 | {
2 | "rules": {
3 | ".read": true,
4 | ".write": true
5 | }
6 | }
7 |
--------------------------------------------------------------------------------
/day13/starter/firebaseNotes/firebase.json:
--------------------------------------------------------------------------------
1 | {
2 | "database": {
3 | "rules": "database.rules.json"
4 | },
5 | "hosting": {
6 | "public": "public",
7 | "ignore": [
8 | "firebase.json",
9 | "**/.*",
10 | "**/node_modules/**"
11 | ]
12 | },
13 | "emulators": {
14 | "auth": {
15 | "port": 8111
16 | },
17 | "database": {
18 | "port": 8112
19 | },
20 | "hosting": {
21 | "port": 5000
22 | },
23 | "ui": {
24 | "enabled": true
25 | }
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/day13/starter/firebaseNotes/public/404.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | Page Not Found
7 |
8 |
23 |
24 |
25 |
26 |
404
27 |
Page Not Found
28 |
The specified file was not found on this website. Please check the URL for mistakes and try again.
29 |
Why am I seeing this?
30 |
This page was generated by the Firebase Command-Line Interface. To modify it, edit the 404.html
file in your project's configured public
directory.
31 |
32 |
33 |
34 |
--------------------------------------------------------------------------------
/day13/starter/firebaseNotes/public/css/cards.css:
--------------------------------------------------------------------------------
1 | input::placeholder {
2 | color: antiquewhite;
3 | }
4 |
5 | .navbar {
6 | background: var(--card-bg);
7 | }
8 |
9 | /* Card start*/
10 | .card {
11 | overflow: hidden;
12 | background: yellow;
13 | /* color: var(--bg); */
14 | }
15 |
16 | .card.large {
17 | border-radius: 5px;
18 | }
19 |
20 | .title.no-padding {
21 | margin-bottom: 0 !important;
22 | }
23 |
24 | .footer {
25 | background: white;
26 | }
27 |
28 | .footer a:hover {
29 | color: crimson;
30 | }
31 |
32 | .fa {
33 | color: ghostwhite;
34 | margin: 10px
35 | }
--------------------------------------------------------------------------------
/day13/starter/firebaseNotes/public/css/writeNote.css:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/google/cssi-labs/f3c445753c96e3da5cf96bd5ad538aea72446aae/day13/starter/firebaseNotes/public/css/writeNote.css
--------------------------------------------------------------------------------
/day13/starter/firebaseNotes/public/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | Fire Notes
7 |
8 |
9 |
10 |
11 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 | Welcome to 🔥Fire Notes📝!
39 |
40 |
41 | Log in to view your notes or create a new one.
42 |
43 |
44 |
45 |
46 | Sign In
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
--------------------------------------------------------------------------------
/day13/starter/firebaseNotes/public/js/signIn.js:
--------------------------------------------------------------------------------
1 | const signIn = () => {
2 | var provider = new firebase.auth.GoogleAuthProvider();
3 | // console.log(provider)
4 | firebase.auth()
5 | .signInWithPopup(provider)
6 | .then((result) => {
7 | /** @type {firebase.auth.OAuthCredential} */
8 | var credential = result.credential;
9 | var token = credential.accessToken;
10 |
11 | // The signed-in user info.
12 | var user = result.user;
13 | window.location = 'writeNote.html';
14 | }).catch((error) => {
15 | // Handle Errors here.
16 | var errorCode = error.code;
17 | var errorMessage = error.message;
18 | // The email of the user's account used.
19 | var email = error.email;
20 | // The firebase.auth.AuthCredential type that was used.
21 | var credential = error.credential;
22 | const err = {
23 | errorCode,
24 | errorMessage,
25 | email,
26 | credential
27 | };
28 | console.log(err);
29 | });
30 | }
--------------------------------------------------------------------------------
/day13/starter/firebaseNotes/public/js/viewNotes.js:
--------------------------------------------------------------------------------
1 | window.onload = (event) => {
2 | // Use this to retain user state between html pages.
3 | firebase.auth().onAuthStateChanged(function(user) {
4 | if (user) {
5 | console.log('Logged in as: ' + user.displayName);
6 | const googleUserId = user.uid;
7 | getNotes(googleUserId);
8 | } else {
9 | // If not logged in, navigate back to login page.
10 | window.location = 'index.html';
11 | };
12 | });
13 | };
14 |
15 | const getNotes = (userId) => {
16 | const notesRef = firebase.database().ref(`users/${userId}`);
17 | notesRef.on('value', (snapshot) => {
18 | const data = snapshot.val();
19 | renderDataAsHtml(data);
20 | });
21 | };
22 |
23 | const renderDataAsHtml = (data) => {
24 | let cards = ``;
25 | for(const noteItem in data) {
26 | const note = data[noteItem];
27 | // For each note create an HTML card
28 | cards += createCard(note)
29 | };
30 | // Inject our string of HTML into our viewNotes.html page
31 | document.querySelector('#app').innerHTML = cards;
32 | };
33 |
34 | const createCard = (note) => {
35 | let innerHTML = "";
36 | innerHTML += ``
37 | innerHTML += `
`
38 | innerHTML += ``
43 | innerHTML += `
`
44 | innerHTML += `
`
45 | innerHTML += `${note.text}`
46 | innerHTML += `
`
47 | innerHTML += `
`
48 | innerHTML += `
`
49 | innerHTML += `
`
50 | return innerHTML;
51 | };
--------------------------------------------------------------------------------
/day13/starter/firebaseNotes/public/js/writeNote.js:
--------------------------------------------------------------------------------
1 | let googleUser;
2 |
3 | window.onload = (event) => {
4 | // Use this to retain user state between html pages.
5 | firebase.auth().onAuthStateChanged(function(user) {
6 | if (user) {
7 | console.log('Logged in as: ' + user.displayName);
8 | googleUser = user;
9 | } else {
10 | window.location = 'index.html'; // If not logged in, navigate back to login page.
11 | }
12 | });
13 | };
14 |
15 | const handleNoteSubmit = () => {
16 | // 1. Capture the form data
17 | const noteTitle = document.querySelector('#noteTitle');
18 | const noteText = document.querySelector('#noteText');
19 | // 2. Format the data and write it to our database
20 | firebase.database().ref(`users/${googleUser.uid}`).push({
21 | title: noteTitle.value,
22 | text: noteText.value
23 | })
24 | // 3. Clear the form so that we can write a new note
25 | .then(() => {
26 | noteTitle.value = "";
27 | noteText.value = "";
28 | });
29 | }
--------------------------------------------------------------------------------
/day13/starter/firebaseNotes/public/viewNotes.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | Welcome to Firebase Hosting
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
28 |
29 |
30 |
31 |
32 |
Some of Your Greatest Ideas Started Here
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
50 |
51 |
52 |
--------------------------------------------------------------------------------
/day13/starter/firebaseNotes/public/writeNote.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | Fire Notes
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
What's on your mind?
30 |
31 | “The most beautiful things are those that madness prompts and reason writes."
32 |
33 |
34 | —Andre Gide
35 |
36 |
37 | to view your notes.
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 |
--------------------------------------------------------------------------------