Skip to content

Commit 280cfcc

Browse files
committed
Merge remote-tracking branch 'upstream/gh-pages' into gh-pages
2 parents 3b52334 + d5f2a3e commit 280cfcc

10 files changed

Lines changed: 589 additions & 42 deletions

File tree

html/lesson1/tutorial.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -306,7 +306,7 @@ Add this underneath the ordered list about why we like owls.
306306

307307
Some characters have special meaning in HTML. For instance, we use < and > to make HTML tags, and we use " to wrap our attributes. But what if we wanted to use those characters in our page?
308308

309-
One way is to use **HTML entities**. These have an ampersand, a name, then a semicolon. Here's the HTML entity for a quote character: `&quot`.
309+
One way is to use **HTML entities**. These have an ampersand, a name, then a semicolon. Here's the HTML entity for a quote character: `&quot;`.
310310

311311
You can also use a numerical format to produce special characters. [Here's a list](http://htmlandcssbook.com/extras/html-escape-codes/) of some common entities.
312312

html/lesson6/tutorial.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ Download the files required to begin working through the tutorial from [here](ht
106106
```
107107
Hi I'm Ada Lovelace - http://codebar.github.io/tutorials/html/lesson3/example.html
108108
Grace Hopper - http://codebar.github.io/tutorials/html/lesson4/example.html
109-
Anita Borg - Where are we and where are we going. - http://codebar.github.io/tutorials/html/lesson4/example.html
109+
Anita Borg - Where are we and where are we going. - http://codebar.github.io/tutorials/html/lesson5/example.html
110110
Grace Hopper on Letterman - http://codebar.github.io/tutorials/html/lesson6/assets/images/grace-letterman.mp4
111111
112112
```

index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ <h2>JavaScript</h2>
5151
<ul>
5252
<li><a href="js/lesson1/tutorial.html">Lesson 1 - Introduction to JavaScript</a></li>
5353
<li><a href="js/lesson2/tutorial.html">Lesson 2 - Beginning JavaScript</a></li>
54-
<li><a href="js/lesson3/tutorial.html">Lesson 3 - Introduction to JQuery</a></li>
54+
<li><a href="js/lesson3/tutorial.html">Lesson 3 - Introduction to jQuery</a></li>
5555
<li><a href="js/lesson4/tutorial.html">Lesson 4 - HTTP Requests, AJAX and APIs</a></li>
5656
<li><a href="js/lesson5/tutorial.html">Lesson 5 - HTTP Requests, AJAX and APIs (part 2)</a></li>
5757
<li><a href="js/lesson6/tutorial.html">Lesson 6 - Drawing in Canvas</a></li>

js/lesson3/tutorial.md

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -82,15 +82,15 @@ $('input').val("");
8282

8383
##Adding content
8484

85-
There are many different ways you can add content. You can use **append** to add something to the end to an element, or **prepend** to add to the beginning to an element.
85+
There are many different ways you can add content. You can use **append** to add something to the end of an element, or **prepend** to add to the beginning of an element.
8686

8787
```js
8888
$('#container').append("<div>I love jQuery!</div>")
8989
```
9090

9191
You can also use `replaceWith()` to substitute an element entirely with some new content.
9292

93-
Try this out in your browser.
93+
Open the index.html of the files provided in your browser and try this out in the JavaScript console:
9494

9595
```js
9696
$('#container').replaceWith("<div>I love jQuery!</div>")
@@ -115,6 +115,7 @@ $(document).on('click','.done', function() {
115115
alert("Click event");
116116
});
117117
```
118+
This function makes a JavaScript alert pop up when a user clicks on any element which has the class ".done".
118119

119120
Although these two examples do the same thing there are some differences.
120121

@@ -148,13 +149,13 @@ $(document).ready(function() {
148149
});
149150
```
150151

151-
Make a note of this. Wrapping your event listeners and other code within this make's sure they are executed only after all the DOM elements are loaded and ready. You should **always** use it or else your bindings won't work and the functions will run when you are loading the page.
152+
Make a note of this. Wrapping your event listeners and other code within this makes sure they are executed only after all the DOM elements are loaded and ready. You should **always** use it or else your bindings won't work and the functions will run before all elements on the page have loaded. So it might try to listen for events on elements that don't even exist yet and then you'll get lots of errors.
152153

153154
#Exercise 1: Build a wish list
154155

155156
Using jQuery and JavaScript functions, we will build a small todo list.
156157

157-
Download the files required to begin working through the example [here](https://gist.github.com/despo/309f684b7a6e002aaf1f) or alternatively checkout with git.
158+
If you haven't yet, download the files required to begin working through the example [here](https://gist.github.com/despo/309f684b7a6e002aaf1f) or alternatively checkout with git.
158159

159160
```bash
160161
git clone https://gist.github.com/309f684b7a6e002aaf1f.git wishlist
@@ -165,7 +166,7 @@ Move the files under your Github page folder, in a new directory `wishlist`. Als
165166
```bash
166167
git commit -m "message"
167168
```
168-
169+
If you don't know how to use git yet, just ignore the above for now or [look at our git tutorial](http://tutorials.codebar.io/version-control/introduction/tutorial.html).
169170

170171
##Functionality
171172
- add wishes to the list by clicking the Add button
@@ -205,9 +206,11 @@ After adding the item to the list:
205206
1. Empty the text field after adding the item to the list.
206207
2. Use jQuery's `focus()` method to place the cursor back in the text field after clicking the button.
207208

209+
If you don't know how to use the focus() method, try searching for it in the [jQuery documentation](http://api.jquery.com/). There are some code examples illustrating how to use it.
210+
208211
###Label items
209212

210-
To label items, update the html of the list item being added to the list, so it includes a label.
213+
To label items as "pending" or "done", add the below html code to the html for the new list item that you wrote at the beginning of the tutorial.
211214

212215
`<span class='label pending'>Pending</span>`
213216

@@ -221,6 +224,8 @@ When we click on the Pending label, we want to set items to complete. We will do
221224

222225
> Use `$(this)` to access the element that the event was triggered from.
223226
227+
Let's go through this step by step.
228+
224229
Try this in the console:
225230

226231
First of all, bind a **click** event to the span we've added using its class with the `on()` function. As `<li>` is the parent node of the <span> element, we can access it using `parent()` (which is equivalent to `parentNode`
@@ -230,10 +235,11 @@ that we've used in the previous lesson).
230235
var parent_node = $(this).parent();
231236
```
232237

233-
> Use `attr()` to set the class attribute to `completed` or alternatively `addClass()`
238+
> Use `attr()` or `addClass()` to set the class attribute to `completed`
234239
235240
> Use `remove()` to remove an element from the DOM
236241
242+
When you now click on the red label "pending", it should change to the green label "completed".
237243

238244
###Show the total task count
239245

@@ -274,7 +280,7 @@ Have a look at our [**Wish List**](../../examples/wishlist/index.html).
274280
https://gist.github.com/ab21d29aa1ea8fbbbb0e.git
275281
```
276282

277-
Move the files under your Github page folder, in a directory colorpicker.
283+
if you're using git, move the files under your Github page folder, in a directory colorpicker.
278284
Don't forget to commit each task you complete! That way it will be easier to retrace your steps if something goes wrong!
279285

280286
##Functionality
@@ -376,7 +382,7 @@ random_position = Math.floor( Math.random() * colors.length )
376382

377383
> Use the `array[index]` notation to retrieve the colors at the random position.
378384
379-
Set `.preview`'s background color, to the random color code.
385+
Set `.preview`'s background color to the random color code.
380386

381387
##Bonus
382388

js/lesson4/tutorial.md

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,11 +123,17 @@ First, let's create a function that does the AJAX call to the GitHub API.
123123
```js
124124
function getGithubInfo(username) {
125125
var xhr = new XMLHttpRequest();
126-
xhr.open(...);
126+
// open and then send the request
127127

128128
return xhr;
129129
}
130130
```
131+
> Set the async parameter to false so the call is synchronous.
132+
This means the browser will wait for the call to the GitHub API to finish before continuing.
133+
134+
> Otherwise you can set it to true and add the extra methods to handle the changes in `readyState` of the request.
135+
136+
> See [Mozilla Developer Network (MDN)](https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest/onreadystatechange) for more details.
131137
132138
**Note** We want `getGithubInfo(username)` to return us the entire response, so we can check for the status and handle it when necessary.
133139

@@ -174,8 +180,11 @@ The `showUser(user)` function should:
174180
3. Add an image in `#profile .avatar`. To do that, you can use the `avatar_url`
175181
from the response.
176182

183+
> Once you have parsed the response, try using `console.log()` to see what the object looks like in the browser console.
184+
177185
> Don't forget to call `showUser()` from the function handling the keypress!
178186
187+
179188
##Publish to Github
180189

181190
Link to your Github User Finder from `index` and push your changes to Github.

0 commit comments

Comments
 (0)