diff --git a/docs/client/api-box.html b/docs/client/api-box.html
index d26a73a56e..89dd3918f1 100644
--- a/docs/client/api-box.html
+++ b/docs/client/api-box.html
@@ -1,6 +1,6 @@
- {{{name}}}
+ {{{name}}}
{{#if locus}}
{{locus}}
{{/if}}
diff --git a/docs/client/basic/introduction.html b/docs/client/basic/introduction.html
index 525214ad40..10251fa091 100644
--- a/docs/client/basic/introduction.html
+++ b/docs/client/basic/introduction.html
@@ -35,7 +35,7 @@ invalidations to clients.
{{> principles}}
-Learning Resources
+Learning Resources
diff --git a/docs/client/basic/sections/collections.md b/docs/client/basic/sections/collections.md
index 9384afedd5..1861561ea7 100644
--- a/docs/client/basic/sections/collections.md
+++ b/docs/client/basic/sections/collections.md
@@ -1,6 +1,6 @@
{{#template name="basicCollections"}}
-Collections
+Collections
Meteor stores data in *collections*. JavaScript objects stored in collections
are called `documents`. To get started, declare a collection with `new
diff --git a/docs/client/basic/sections/environment.md b/docs/client/basic/sections/environment.md
index e915ca69a0..3d936d5f0e 100644
--- a/docs/client/basic/sections/environment.md
+++ b/docs/client/basic/sections/environment.md
@@ -1,6 +1,6 @@
{{#template name="basicEnvironment"}}
-Environment
+Environment
{{> autoApiBox "Meteor.isClient"}}
{{> autoApiBox "Meteor.isServer"}}
diff --git a/docs/client/basic/sections/methods.md b/docs/client/basic/sections/methods.md
index 7d0a8ba5b7..f2cd2cfd55 100644
--- a/docs/client/basic/sections/methods.md
+++ b/docs/client/basic/sections/methods.md
@@ -1,5 +1,5 @@
{{#template name="basicMethods"}}
-Methods
+Methods
Methods are server functions that can be called from the client. They are
useful in situations where you want to do something more complicated than
diff --git a/docs/client/basic/sections/pubsub.md b/docs/client/basic/sections/pubsub.md
index 5a73061ad7..abdcba12f3 100644
--- a/docs/client/basic/sections/pubsub.md
+++ b/docs/client/basic/sections/pubsub.md
@@ -1,6 +1,6 @@
{{#template name="basicPubsub"}}
-Publish and subscribe
+Publish and subscribe
Meteor servers can publish sets of documents with `Meteor.publish` and clients
can subscribe to those publications with `Meteor.subscribe`. Any data the
diff --git a/docs/client/basic/sections/session.md b/docs/client/basic/sections/session.md
index cd1e74f270..c2fa070681 100644
--- a/docs/client/basic/sections/session.md
+++ b/docs/client/basic/sections/session.md
@@ -1,6 +1,6 @@
{{#template name="basicSession"}}
-Session
+Session
`Session` provides a global object on the client that you can use to
store an arbitrary set of key-value pairs. Use it to store things like
diff --git a/docs/client/basic/sections/templates.md b/docs/client/basic/sections/templates.md
index e5684c5216..bdea2576c9 100644
--- a/docs/client/basic/sections/templates.md
+++ b/docs/client/basic/sections/templates.md
@@ -1,12 +1,12 @@
{{#template name="basicTemplates"}}
-Templates
+Templates
In Meteor, you define your views in _templates_. A template is a snippet of
HTML that can also include special pieces of code to include data and change
which parts of the page are displayed.
-Defining Templates in HTML
+Defining Templates in HTML
Templates are defined in '.html' files that can be located anywhere in your
Meteor project folder except the `server`, `public`, and `private` directories.
diff --git a/docs/client/basic/sections/tracker.md b/docs/client/basic/sections/tracker.md
index 8ad0fedf89..37d823de5a 100644
--- a/docs/client/basic/sections/tracker.md
+++ b/docs/client/basic/sections/tracker.md
@@ -1,6 +1,6 @@
{{#template name="basicTracker"}}
-Tracker
+Tracker
Meteor has a simple dependency tracking system which allows it to
automatically rerun templates and other computations whenever
diff --git a/docs/client/basic/toc.html b/docs/client/basic/toc.html
index 7e92a2f464..ab79af1a16 100644
--- a/docs/client/basic/toc.html
+++ b/docs/client/basic/toc.html
@@ -1,9 +1,9 @@
-
-
-
+
+
+
Command Line Tool
File Structure
Building Mobile Apps
diff --git a/docs/client/full-api/docs.js b/docs/client/full-api/docs.js
index c245ed2715..4a5076b335 100644
--- a/docs/client/full-api/docs.js
+++ b/docs/client/full-api/docs.js
@@ -1,75 +1,9 @@
release = Meteor.release ? "0.9.4" : "(checkout)";
Meteor.startup(function () {
- //mixpanel tracking
+ // mixpanel tracking
mixpanel.track('docs');
- // returns a jQuery object suitable for setting scrollTop to
- // scroll the page, either directly for via animate()
- var scroller = function() {
- return $("html, body").stop();
- };
-
- var sections = [];
- _.each($('#main h1, #main h2, #main h3'), function (elt) {
- var classes = (elt.getAttribute('class') || '').split(/\s+/);
- if (_.indexOf(classes, "nosection") === -1)
- sections.push(elt);
- });
-
- for (var i = 0; i < sections.length; i++) {
- var classes = (sections[i].getAttribute('class') || '').split(/\s+/);
- if (_.indexOf(classes, "nosection") !== -1)
- continue;
- sections[i].prev = sections[i-1] || sections[i];
- sections[i].next = sections[i+1] || sections[i];
- $(sections[i]).waypoint({offset: 30});
- }
- var section = document.location.hash.substr(1) || sections[0].id;
- Session.set('section', section);
- if (section) {
- // WebKit will scroll down to the #id in the URL asynchronously
- // after the page is rendered, but Firefox won't.
- Meteor.setTimeout(function() {
- var elem = $('#'+section);
- if (elem.length)
- scroller().scrollTop(elem.offset().top);
- }, 0);
- }
-
- var ignore_waypoints = false;
- var lastTimeout = null;
- $('h1, h2, h3').waypoint(function (evt, dir) {
- if (!ignore_waypoints) {
- var active = (dir === "up") ? this.prev : this;
- if (active.id) {
- if (lastTimeout)
- Meteor.clearTimeout(lastTimeout);
- lastTimeout = Meteor.setTimeout(function () {
- Session.set("section", active.id);
- }, 200);
- }
- }
- });
-
- window.onhashchange = function () {
- scrollToSection(location.hash);
- };
-
- var scrollToSection = function (section) {
- if (! $(section).length)
- return;
-
- ignore_waypoints = true;
- Session.set("section", section.substr(1));
- scroller().animate({
- scrollTop: $(section).offset().top
- }, 500, 'swing', function () {
- window.location.hash = section;
- ignore_waypoints = false;
- });
- };
-
// Make external links open in a new tab.
$('a:not([href^="#"])').attr('target', '_blank');
});
diff --git a/docs/client/full-api/tableOfContents.html b/docs/client/full-api/tableOfContents.html
index c6af298e2d..7f5944dc2b 100644
--- a/docs/client/full-api/tableOfContents.html
+++ b/docs/client/full-api/tableOfContents.html
@@ -12,7 +12,7 @@
{{/if}}
{{#if type "section"}}
{{#nav_section}}
-
+
{{#if prefix}}{{prefix}}.{{/if}}{{#if instance}}{{instance}}.{{/if}}{{name}}
{{/nav_section}}
diff --git a/docs/client/links.js b/docs/client/links.js
index 40bf5e9197..b702e19009 100644
--- a/docs/client/links.js
+++ b/docs/client/links.js
@@ -1,15 +1,35 @@
-var ignoreWaypoints = false;
-var triggeredFromWaypoint = {};
+var ignoreWaypoints = true;
+var ignoreUrlChange = false;
+
+var deHash = function (hashString) {
+ return hashString.slice(1);
+};
+
+// need an actual function to only debounce inside the if statement
+var actuallyUpdateUrl = _.debounce(function (el) {
+ ignoreUrlChange = true;
+ window.location.replace("#/" + el.id);
+}, 1000);
+
+var updateUrlFromWaypoint = function (el) {
+ if (! ignoreWaypoints) {
+ actuallyUpdateUrl(el);
+ }
+};
Meteor.startup(function () {
- setTimeout(function () {
- $('.main-content [id]').waypoint(function() {
- if (! ignoreWaypoints) {
- triggeredFromWaypoint["#" + this.id] = true;
- window.location.replace("#" + this.id);
- }
+ $('.main-content [id]').each(function (i, el) {
+ if (! $("#nav [href='#/" + el.id + "']").get(0)) {
+ // only add waypoints to things that have sidebar links
+ return;
+ }
+
+ $(el).waypoint(function() {
+ updateUrlFromWaypoint(this);
}, { context: $('.main-content') });
- }, 2000);
+ });
+
+ ignoreWaypoints = false;
});
Tracker.autorun(function () {
@@ -17,8 +37,8 @@ Tracker.autorun(function () {
var current = Iron.Location.get();
// If the URL changes from a waypoint, do nothing
- if (triggeredFromWaypoint[current.hash]) {
- triggeredFromWaypoint[current.hash] = false;
+ if (ignoreUrlChange) {
+ ignoreUrlChange = false;
return;
}
@@ -41,30 +61,33 @@ Tracker.autorun(function () {
} else {
if (current.hash) {
// XXX COMPAT WITH old docs
- window.location.replace("/full/");
+ window.location.replace("/full/#/" + deHash(current.hash));
} else {
window.location.replace("/basic/");
}
}
if (current.hash) {
+ console.log("scrolling!");
Tracker.afterFlush(function () {
setTimeout(function () {
var targetLocation;
- if (current.hash === "#top") {
+ if (current.hash === "#/top") {
targetLocation = 0;
} else {
- var foundElement = $(current.hash);
+ var selector = "#" + deHash(current.hash).slice(1);
+ console.log(selector);
+ var foundElement = $(selector);
if (foundElement.get(0)) {
- targetLocation = $(".main-content").scrollTop() + foundElement.offset().top - $(".main-content").offset().top - 10;
+ targetLocation = $(".main-content").scrollTop() + foundElement.offset().top - $(".main-content").offset().top;
}
}
ignoreWaypoints = true;
$(".main-content").animate({
scrollTop: targetLocation
- }, 1000, function () {
+ }, 500, function () {
ignoreWaypoints = false;
});
}, 0);