Repository navigation
Expand file tree
/
Copy pathfcc-progress.js
More file actions
404 lines (394 loc) · 17.6 KB
/
Copy pathfcc-progress.js
File metadata and controls
404 lines (394 loc) · 17.6 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
// ==UserScript==
// @name Get FCC Progress
// @namespace http://tampermonkey.net/
// @version 0.1
// @description try to take over the world!
// @author David Cohen
// @match https://www.freecodecamp.org/*
// @match https://www.freecodecamp.com/*
// @grant GM_registerMenuCommand
// @grant GM_setClipboard
// ==/UserScript==
(function() {
function sanitizeText(text) {
return text.split('').map(char => char.toLowerCase()).filter(char => /[a-z]/.test(char)).join('');
}
Set.prototype.intersection = function(setB) {
var intersection = new Set();
for (var elem of setB) {
if (this.has(elem)) {
intersection.add(elem);
}
}
return intersection;
}
const sections = [
[
"HTML5 and CSS",
[
"Learn How freeCodeCamp Works",
"Say Hello to HTML Elements",
"Headline with the h2 Element",
"Inform with the Paragraph Element",
"Uncomment HTML",
"Comment out HTML",
"Fill in the Blank with Placeholder Text",
"Delete HTML Elements",
"Change the Color of Text",
"Join a freeCodeCamp Study Group in Your City",
"Become a Supporter",
"Use CSS Selectors to Style Elements",
"Use a CSS Class to Style an Element",
"Style Multiple Elements with a CSS Class",
"Change the Font Size of an Element",
"Set the Font Family of an Element",
"Import a Google Font",
"Specify How Fonts Should Degrade",
"Add Images to your Website",
"Size your Images",
"Add Borders Around your Elements",
"Add Rounded Corners with a Border Radius",
"Make Circular Images with a Border Radius",
"Link to External Pages with Anchor Elements",
"Nest an Anchor Element within a Paragraph",
"Make Dead Links using the Hash Symbol",
"Turn an Image into a Link",
"Create a Bulleted Unordered List",
"Create an Ordered List",
"Create a Text Field",
"Add Placeholder Text to a Text Field",
"Create a Form Element",
"Add a Submit Button to a Form",
"Use HTML5 to Require a Field",
"Create a Set of Radio Buttons",
"Create a Set of Checkboxes",
"Check Radio Buttons and Checkboxes by Default",
"Nest Many Elements within a Single Div Element",
"Give a Background Color to a Div Element",
"Set the ID of an Element",
"Use an ID Attribute to Style an Element",
"Adjusting the Padding of an Element",
"Adjust the Margin of an Element",
"Add a Negative Margin to an Element",
"Add Different Padding to Each Side of an Element",
"Add Different Margins to Each Side of an Element",
"Use Clockwise Notation to Specify the Padding of an Element",
"Use Clockwise Notation to Specify the Margin of an Element",
"Style the HTML Body Element",
"Inherit Styles from the Body Element",
"Prioritize One Style Over Another",
"Override Styles in Subsequent CSS",
"Override Class Declarations by Styling ID Attributes",
"Override Class Declarations with Inline Styles",
"Override All Other Styles by using Important",
"Use Hex Code for Specific Colors",
"Use Hex Code to Mix Colors",
"Use Abbreviated Hex Code",
"Use RGB values to Color Elements",
"Use RGB to Mix Colors"
]
],
[
"Responsive Design with Bootstrap",
[
"Use Responsive Design with Bootstrap Fluid Containers",
"Make Images Mobile Responsive",
"Center Text with Bootstrap",
"Create a Bootstrap Button",
"Create a Block Element Bootstrap Button",
"Taste the Bootstrap Button Color Rainbow",
"Call out Optional Actions with Button Info",
"Warn your Users of a Dangerous Action",
"Use the Bootstrap Grid to Put Elements Side By Side",
"Ditch Custom CSS for Bootstrap",
"Use Spans for Inline Elements",
"Create a Custom Heading",
"Add Font Awesome Icons to our Buttons",
"Add Font Awesome Icons to all of our Buttons",
"Responsively Style Radio Buttons",
"Responsively Style Checkboxes",
"Style Text Inputs as Form Controls",
"Line up Form Elements Responsively with Bootstrap",
"Create a Bootstrap Headline",
"House our page within a Bootstrap Container Fluid Div",
"Create a Bootstrap Row",
"Split your Bootstrap Row",
"Create Bootstrap Wells",
"Add Elements within your Bootstrap Wells",
"Apply the Default Bootstrap Button Style",
"Create a Class to Target with jQuery Selectors",
"Add ID Attributes to Bootstrap Elements",
"Label Bootstrap Wells",
"Give Each Element a Unique ID",
"Label Bootstrap Buttons",
"Use Comments to Clarify Code"
]
],
[
"jQuery",
[
"Learn how Script Tags and Document Ready Work",
"Target HTML Elements with Selectors Using jQuery",
"Target Elements by Class Using jQuery",
"Target Elements by ID Using jQuery",
"Delete your jQuery Functions",
"Target the same element with multiple jQuery Selectors",
"Remove Classes from an element with jQuery",
"Change the CSS of an Element Using jQuery",
"Disable an Element Using jQuery",
"Change Text Inside an Element Using jQuery",
"Remove an Element Using jQuery",
"Use appendTo to Move Elements with jQuery",
"Clone an Element Using jQuery",
"Target the Parent of an Element Using jQuery",
"Target the Children of an Element Using jQuery",
"Target a Specific Child of an Element Using jQuery",
"Target Even Numbered Elements Using jQuery",
"Use jQuery to Modify the Entire Page"
]
],
[
"Basic Front End Development Projects",
[
"Get Set for our Front End Development Projects",
"Build a Tribute Page",
"Build a Personal Portfolio Webpage"
]
],
[
"Basic JavaScript",
[
"Comment your JavaScript Code",
"Declare JavaScript Variables",
"Storing Values with the Assignment Operator",
"Initializing Variables with the Assignment Operator",
"Understanding Uninitialized Variables",
"Understanding Case Sensitivity in Variables",
"Add Two Numbers with JavaScript",
"Subtract One Number from Another with JavaScript",
"Multiply Two Numbers with JavaScript",
"Divide One Number by Another with JavaScript",
"Increment a Number with JavaScript",
"Decrement a Number with JavaScript",
"Create Decimal Numbers with JavaScript",
"Multiply Two Decimals with JavaScript",
"Divide one Decimal by Another with JavaScript",
"Finding a Remainder in JavaScript",
"Compound Assignment With Augmented Addition",
"Compound Assignment With Augmented Subtraction",
"Compound Assignment With Augmented Multiplication",
"Compound Assignment With Augmented Division",
"Convert Celsius to Fahrenheit",
"Declare String Variables",
"Escaping Literal Quotes in Strings",
"Quoting Strings with Single Quotes",
"Escape Sequences in Strings",
"Concatenating Strings with Plus Operator",
"Concatenating Strings with the Plus Equals Operator",
"Constructing Strings with Variables",
"Appending Variables to Strings",
"Find the Length of a String",
"Use Bracket Notation to Find the First Character in a String",
"Understand String Immutability",
"Use Bracket Notation to Find the Nth Character in a String",
"Use Bracket Notation to Find the Last Character in a String",
"Use Bracket Notation to Find the Nth-to-Last Character in a String",
"Word Blanks",
"Store Multiple Values in one Variable using JavaScript Arrays",
"Nest one Array within Another Array",
"Access Array Data with Indexes",
"Modify Array Data With Indexes",
"Access Multi-Dimensional Arrays With Indexes",
"Manipulate Arrays With push()",
"Manipulate Arrays With pop()",
"Manipulate Arrays With shift()",
"Manipulate Arrays With unshift()",
"Shopping List",
"Write Reusable JavaScript with Functions",
"Passing Values to Functions with Arguments",
"Global Scope and Functions",
"Local Scope and Functions",
"Global vs. Local Scope in Functions",
"Return a Value from a Function with Return",
"Assignment with a Returned Value",
"Stand in Line",
"Understanding Boolean Values",
"Use Conditional Logic with If Statements",
"Comparison with the Equality Operator",
"Comparison with the Strict Equality Operator",
"Comparison with the Inequality Operator",
"Comparison with the Strict Inequality Operator",
"Comparison with the Greater Than Operator",
"Comparison with the Greater Than Or Equal To Operator",
"Comparison with the Less Than Operator",
"Comparison with the Less Than Or Equal To Operator",
"Comparisons with the Logical And Operator",
"Comparisons with the Logical Or Operator",
"Introducing Else Statements",
"Introducing Else If Statements",
"Logical Order in If Else Statements",
"Chaining If Else Statements",
"Golf Code",
"Selecting from many options with Switch Statements",
"Adding a default option in Switch statements",
"Multiple Identical Options in Switch Statements",
"Replacing If Else Chains with Switch",
"Returning Boolean Values from Functions",
"Return Early Pattern for Functions",
"Counting Cards",
"Build JavaScript Objects",
"Accessing Objects Properties with the Dot Operator",
"Accessing Objects Properties with Bracket Notation",
"Accessing Objects Properties with Variables",
"Updating Object Properties",
"Add New Properties to a JavaScript Object",
"Delete Properties from a JavaScript Object",
"Using Objects for Lookups",
"Testing Objects for Properties",
"Manipulating Complex Objects",
"Accessing Nested Objects",
"Accessing Nested Arrays",
"Iterate with JavaScript For Loops",
"Iterate Odd Numbers With a For Loop",
"Count Backwards With a For Loop",
"Iterate Through an Array with a For Loop",
"Nesting For Loops",
"Iterate with JavaScript While Loops",
"Profile Lookup",
"Generate Random Fractions with JavaScript",
"Generate Random Whole Numbers with JavaScript",
"Generate Random Whole Numbers within a Range",
"Sift through Text with Regular Expressions",
"Find Numbers with Regular Expressions",
"Find Whitespace with Regular Expressions",
"Invert Regular Expression Matches with JavaScript"
]
],
[
"Object Oriented and Functional Programming",
[
"Declare JavaScript Objects as Variables",
"Construct JavaScript Objects with Functions",
"Make Instances of Objects with a Constructor Function",
"Make Unique Objects by Passing Parameters to our Constructor",
"Make Object Properties Private",
"Iterate over Arrays with map",
"Condense arrays with reduce",
"Filter Arrays with filter",
"Sort Arrays with sort",
"Reverse Arrays with reverse",
"Concatenate Arrays with concat",
"Split Strings with split",
"Join Strings with join"
]
],
[
"Basic Algorithm Scripting",
[
"Get Set for our Algorithm Challenges",
"Reverse a String",
"Factorialize a Number",
"Check for Palindromes",
"Find the Longest Word in a String",
"Title Case a Sentence",
"Return Largest Numbers in Arrays",
"Confirm the Ending",
"Repeat a string repeat a string",
"Truncate a string",
"Chunky Monkey",
"Slasher Flick",
"Mutations",
"Falsy Bouncer",
"Seek and Destroy",
"Where do I belong",
"Caesars Cipher"
]
],
[
"JSON APIs and Ajax",
[
"Trigger Click Events with jQuery",
"Change Text with Click Events",
"Get JSON with the jQuery getJSON Method",
"Convert JSON Data to HTML",
"Render Images from Data Sources",
"Prefilter JSON",
"Get Geo-location Data"
]
],
[
"Intermediate Front End Development Projects",
[
"Build a Random Quote Machine",
"Show the Local Weather",
"Build a Wikipedia Viewer",
"Use the Twitch.tv JSON API"
]
],
[
"Intermediate Algorithm Scripting",
[
"Sum All Numbers in a Range",
"Diff Two Arrays",
"Roman Numeral Converter",
"Wherefore art thou",
"Search and Replace",
"Pig Latin",
"DNA Pairing",
"Missing letters",
"Boo who",
"Sorted Union",
"Convert HTML Entities",
"Spinal Tap Case",
"Sum All Odd Fibonacci Numbers",
"Sum All Primes",
"Smallest Common Multiple",
"Finders Keepers",
"Drop it",
"Steamroller",
"Binary Agents",
"Everything Be True",
"Arguments Optional"
]
],
[
"Advanced Algorithm Scripting",
[
"Validate US Telephone Numbers",
"Record Collection",
"Symmetric Difference",
"Exact Change",
"Inventory Update",
"No repeats please",
"Make a Person",
"Map the Debris",
"Pairwise"
]
],
[
"Advanced Front End Development Projects",
[
"Build a JavaScript Calculator",
"Build a Pomodoro Clock",
"Build a Tic Tac Toe Game",
"Build a Simon Game"
]
]
];
// total complete over all sections
const arrComplete = Array.from(document.querySelectorAll('body > div:nth-child(10) > div.col-md-12 > div > table > tbody > tr > td:nth-child(1)')).map(x => sanitizeText(x.innerText));
const setComplete = new Set(arrComplete);
const allSectionsProgress = sections.map(section => {
const assignments = section[1].map(sanitizeText);
// this is the important part...
const sectionProgress = setComplete.intersection(assignments).size;
// expressed as a percentage:
return `${Math.round(100 * sectionProgress / assignments.length)}%`;
});
function copyProgressRow(){
// join w/ tab to copy text suitable for pasting into a spreadsheet
const row = allSectionsProgress.join('\t');
GM_setClipboard(row, { type: 'text', mimetype: 'text/plain'});
}
GM_registerMenuCommand("Copy Student Progress", copyProgressRow);
})();