Skip to content

Commit f834ce1

Browse files
committed
apply new syntax highlighting and improve formatting to the majority of existing content, moving the content of overview pages to index pages. making some very minor tweaks to content along the way
1 parent e13547f commit f834ce1

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

63 files changed

+1641
-4435
lines changed

Rules

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ class Nanoc3::Filter
1616
class CodeBlocks < Nanoc3::Filter
1717
LANGUAGES = { "ruby" => "ruby", "sql" => "sql", "javascript" => "javascript",
1818
"css" => "css", "plain" => "plain", "erb" => "ruby; html-script: true",
19-
"html" => "xml", "xml" => "xml", "shell" => "plain", "yaml" => "yaml" }
19+
"markup" => "xml", "xml" => "xml", "shell" => "plain", "yaml" => "yaml" }
2020

2121
def run(content, params={})
2222
@string = content.dup

content/ajax/ajax-overview.md

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
11
---
22
chapter : ajax
3-
section : 1
4-
title : Overview
5-
attribution: jQuery Fundamentals
63
---
74
## Overview
85

@@ -18,7 +15,7 @@ code continues to execute while the request is being processed, so it’s
1815
imperative that a callback be used to handle the response.
1916

2017
jQuery provides Ajax support that abstracts away painful browser differences.
21-
It offers both a full-featured $.ajax() method, and simple convenience methods
18+
It offers both a full-featured `$.ajax()` method, and simple convenience methods
2219
such as `$.get()`, `$.getScript()`, `$.getJSON()`, `$.post()`, and
2320
`$().load()`.
2421

content/ajax/dex.md

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,29 @@
11
---
22
title: Ajax
3+
chapter: Ajax
4+
section : 1
5+
attribution: jQuery Fundamentals
36
---
4-
Ajax is more than just a cleaning product
7+
The XMLHttpRequest method (XHR) allows browsers to communicate with the server
8+
without requiring a page reload. This method, also known as Ajax (Asynchronous
9+
JavaScript and XML), allows for web pages that provide rich, interactive
10+
experiences.
11+
12+
Ajax requests are triggered by JavaScript code; your code sends a request to a
13+
URL, and when it receives a response, a callback function can be triggered to
14+
handle the response. Because the request is asynchronous, the rest of your
15+
code continues to execute while the request is being processed, so it’s
16+
imperative that a callback be used to handle the response.
17+
18+
jQuery provides Ajax support that abstracts away painful browser differences.
19+
It offers both a full-featured $.ajax() method, and simple convenience methods
20+
such as `$.get()`, `$.getScript()`, `$.getJSON()`, `$.post()`, and
21+
`$().load()`.
22+
23+
Most jQuery applications don’t in fact use XML, despite the name “Ajax”;
24+
instead, they transport data as plain HTML or JSON (JavaScript Object
25+
Notation).
26+
27+
In general, Ajax does not work across domains. Exceptions are services that
28+
provide JSONP (JSON with Padding) support, which allow limited cross-domain
29+
functionality.

content/assets/js/main.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
alert("foo");
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
---
2+
chapter : code-organization
3+
section: 2
4+
title: Beware Anonymous Functions
5+
attribution: jQuery Fundamentals
6+
---
7+
8+
Anonymous functions bound everywhere are a pain. They're difficult to debug,
9+
maintain, test, or reuse. Instead, use an object literal to organize and name
10+
your handlers and callbacks.
11+
<javascript>
12+
// BAD
13+
$(document).ready(function() {
14+
$('#magic').click(function(e) {
15+
$('#yayeffects').slideUp(function() {
16+
// ...
17+
});
18+
});
19+
20+
$('#happiness').load(url + ' #unicorns', function() {
21+
// ...
22+
});
23+
});
24+
25+
// BETTER
26+
var PI = {
27+
onReady : function() {
28+
$('#magic').click(PI.candyMtn);
29+
$('#happiness').load(PI.url + ' #unicorns', PI.unicornCb);
30+
},
31+
32+
candyMtn : function(e) {
33+
$('#yayeffects').slideUp(PI.slideCb);
34+
},
35+
36+
slideCb : function() { ... },
37+
38+
unicornCb : function() { ... }
39+
};
40+
41+
$(document).ready(PI.onReady);
42+
</javascript>

0 commit comments

Comments
 (0)