Created
December 6, 2010 17:23
-
-
Save ryanb/730603 to your computer and use it in GitHub Desktop.
This is how GitHub's new AJAX file browser works.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) | |
} | |
} | |
}; |
Is GitHubs slider free for reuse on my own site?
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
nice finding! Doc to replaceState(): https://developer.mozilla.org/en/DOM/Manipulating_the_browser_history