3 $('a[rel=tooltip]').tooltip({
9 function parseRSS(url, callback) {
11 url: 'http://ajax.googleapis.com/ajax/services/feed/load?v=1.0&num=10&callback=?&q=' + encodeURIComponent(url),
13 success: function(data) {
14 callback(data.responseData.feed);
21 $(document).ready(function() {
22 function filterPath(string) {
25 .replace(/(index|default).[a-zA-Z]{3,4}$/,'')
28 var locationPath = filterPath(location.pathname);
29 var scrollElem = scrollableElement('html', 'body');
31 $('a[href*=#]').each(function() {
32 var thisPath = filterPath(this.pathname) || locationPath;
33 if ( locationPath == thisPath
34 && (location.hostname == this.hostname || !this.hostname)
35 && this.hash.replace(/#/,'') ) {
36 var $target = $(this.hash), target = this.hash;
38 var targetOffset = $target.offset().top;
39 $(this).click(function(event) {
40 event.preventDefault();
41 $(scrollElem).animate({scrollTop: targetOffset}, 400, function() {
42 location.hash = target;
49 // use the first element that is "scrollable"
50 function scrollableElement(els) {
51 for (var i = 0, argLength = arguments.length; i <argLength; i++) {
52 var el = arguments[i],
53 $scrollElement = $(el);
54 if ($scrollElement.scrollTop()> 0) {
57 $scrollElement.scrollTop(1);
58 var isScrollable = $scrollElement.scrollTop()> 0;
59 $scrollElement.scrollTop(0);
76 // fix sub nav on scroll
80 navHeight = $('.navbar').first().height(),
81 subnavHeight = $('.subnav').first().height(),
82 subnavTop = $('.subnav').length && $('.subnav').offset().top - navHeight,
83 marginTop = parseInt($body.css('margin-top'), 10);
88 $win.on('scroll', processScroll);
90 function processScroll() {
91 var i, scrollTop = $win.scrollTop();
93 if (scrollTop >= subnavTop && !isFixed) {
95 $nav.addClass('subnav-fixed');
96 $body.css('margin-top', marginTop + subnavHeight + 'px');
97 } else if (scrollTop <= subnavTop && isFixed) {
99 $nav.removeClass('subnav-fixed');
100 $body.css('margin-top', marginTop + 'px');