Skip to content

Instantly share code, notes, and snippets.

@danro
Forked from ryanb/github_tree_slider.js
Created September 29, 2011 21:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save danro/1252002 to your computer and use it in GitHub Desktop.
Save danro/1252002 to your computer and use it in GitHub Desktop.
This is how GitHub's new AJAX file browser works.
GitHub.TreeSlider = function () {
if (window.history && window.history.pushState) {
function a() {
if (e.sliding) {
e.sliding = false;
$(".frame-right").hide();
$(".frame-loading:visible").removeClass("frame-loading")
}
}
if (!($("#slider").length == 0 || !GitHub.shouldSlide)) if (!navigator.userAgent.match(/(iPod|iPhone|iPad)/)) {
window.history.replaceState({
path: this.pathFromURL(location.pathname)
}, "");
var e = this;
$(".frames a.js-slide-to, .breadcrumb a").live("click", function (b) {
if (b.which == 2 || b.metaKey || b.ctrlKey) return true;
else {
e.clickHandler(b);
return false
}
});
$(window).bind("popstate", function (b) {
e.popStateHandler(b.originalEvent)
});
$(".frames .frame").live("webkitTransitionEnd", a).live("transitionend", a)
}
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment