var projectOwner = null;
var projectSlug = null;
var alreadyStarred = false;

var KEY_TAB = 9;

$(function() {
    // setup star button
    var increment = alreadyStarred ? -1 : 1;
    $('.btn-star').click(function() {
        var starred = $(this).find('.starred');
        starred.html(' ' + (parseInt(starred.text()) + increment).toString());
        $.ajax('/' + projectOwner + '/' + projectSlug + '/star/' + (increment > 0));

        var icon = $('#icon-star');
        if (increment > 0) {
            icon.removeClass('fa-star-o').addClass('fa-star');
        } else {
            icon.removeClass('fa-star').addClass('fa-star-o');
        }

        increment *= -1;
    });

    $('body').keydown(function(event) {
        var target = $(event.target);
        if (target.is('body')) {
            switch (event.keyCode) {
                case KEY_TAB:
                    event.preventDefault();
                    var navBar = $('.project-navbar');
                    var activeTab = navBar.find('li.active');
                    console.log(activeTab);
                    var nextTab = activeTab.next();
                    console.log(nextTab);
                    if (nextTab.is('li')) {
                        window.location = nextTab.find('a').attr('href');
                    } else {
                        window.location = navBar.find('li:first').find('a').attr('href');
                    }
                    break;
                default:
                    break;
            }
        }
    });
});

var projectOwner = null;
var projectSlug = null;
var alreadyStarred = false;

$(function() {
    // setup star button
    var increment = alreadyStarred ? -1 : 1;
    $('.btn-star').click(function() {
        var starred = $(this).find('.starred');
        starred.html(' ' + (parseInt(starred.text()) + increment).toString());
        $.ajax('/' + projectOwner + '/' + projectSlug + '/star/' + (increment > 0));

        var icon = $('#icon-star');
        if (increment > 0) {
            icon.removeClass('fa-star-o').addClass('fa-star');
        } else {
            icon.removeClass('fa-star').addClass('fa-star-o');
        }

        increment *= -1;
    });
});

--- 
+++ 
@@ -1,6 +1,8 @@
 var projectOwner = null;
 var projectSlug = null;
 var alreadyStarred = false;
+
+var KEY_TAB = 9;
 
 $(function() {
     // setup star button
@@ -19,4 +21,27 @@
 
         increment *= -1;
     });
+
+    $('body').keydown(function(event) {
+        var target = $(event.target);
+        if (target.is('body')) {
+            switch (event.keyCode) {
+                case KEY_TAB:
+                    event.preventDefault();
+                    var navBar = $('.project-navbar');
+                    var activeTab = navBar.find('li.active');
+                    console.log(activeTab);
+                    var nextTab = activeTab.next();
+                    console.log(nextTab);
+                    if (nextTab.is('li')) {
+                        window.location = nextTab.find('a').attr('href');
+                    } else {
+                        window.location = navBar.find('li:first').find('a').attr('href');
+                    }
+                    break;
+                default:
+                    break;
+            }
+        }
+    });
 });
Add tab navigation to project page

Signed-off-by: Walker Crouse <a52c6ce3cf7a08dcbb27377aa79f9b994b446d4c@hotmail.com>
