This commit is contained in:
C9 2012-09-12 21:17:14 -04:00
commit 28b5be76c5
37 changed files with 1717 additions and 1437 deletions

View file

@ -1,17 +1,33 @@
$(function() {
hljs.initHighlighting();
var editor;
$(function() {
this.isApi = location.href.indexOf("/api") >= 0;
if (!this.isApi) {
hljs.initHighlighting();
editor = ace.edit("ace_editor_demo");
var javascriptMode = require("ace/mode/javascript").Mode;
editor.getSession().setMode(new javascriptMode());
}
$("ul.menu-list li").click(function(e) {
if (e.target.tagName === "LI") {
console.log($(this).find("a"));
window.location = $(this).find("a").attr("href");
}
else if (e.target.tagName === "P") {
var anchor = $(e.target).siblings();
window.location = anchor.attr("href");
}
});
var tabs = $("#tabnav"),
tab_a_selector = "a";
var firstLoad = true;
var firstLoad = true;
var _self = this;
tabs.find(tab_a_selector).click(function(e) {
if (_self.isApi || $(this).attr("href").indexOf("/api/") >= 0) {
window.location = $(this).attr("href");
}
e.preventDefault();
if ($(this).attr("href") === "/")
return;
@ -39,7 +55,8 @@
}, 400);
}
}
$(this).tab("show");
var state = {};
@ -47,10 +64,12 @@
$.bbq.pushState(state);
});
$(window).on("hashchange", function(e) {
tabs.each(function() {
var idx = $.bbq.getState("nav") || "about";
$(this).find(tab_a_selector + "[href='#" + idx + "']").triggerHandler('click');
});
}).trigger("hashchange");
});
if (!this.isApi) {
$(window).on("hashchange", function(e) {
tabs.each(function() {
var idx = $.bbq.getState("nav") || "about";
$(this).find(tab_a_selector + "[href='#" + idx + "']").triggerHandler('click');
});
}).trigger("hashchange");
}
});