<commit_before>var accessToken = "";


function setupLogin(afterLogin) {
  accessToken = localStorage.githubAccessToken;

  var code = getQueryParams("code");
  var clientId = escape("b08a834d3b797794e83f");

  $("#login").on("click", function(e) {
    e.preventDefault();
    window.location = "https://github.com/login/oauth/authorize?" + "client_id=" + clientId + "&scope=repo&state=totallyrandomstring";
  });

  // If there is no code or accessToken, have the user login.
  if(code === null && accessToken === undefined) {
    $("#login").fadeIn();
  }
  // If there is an access token, the user is logged in.
  else if(accessToken !== undefined) {
    loggedIn(afterLogin);
  }
  // If we have a code, automatically log the user in.
  else {
    $.get("/login?code=" + code)
    .done(function(data) {
      accessToken = escape(data.access_token);
      
      if(data.access_token === undefined) {
        showAlert("danger", "<strong>Failed</strong> to login.");
        $("#login").fadeIn();
        return;
      }

      localStorage.githubAccessToken = accessToken;
      loggedIn(afterLogin);
    })
    .fail(function(data) {
      showAlert("danger", "<strong>Failed</strong> to login.");
      $("#login").fadeIn();
    })
  }
}

function getAvatar(fail, succeed) {
  $.get("/avatar?access_token=" + accessToken)
  .done(function(data) {
    $("#avatar").attr("src", data.avatar);
    $("#loginName").text(data.login);

    $("#loggedIn").fadeIn();
    succeed();
  })
  .fail(function(data) {
    $("#writerDiv").hide();
    localStorage.removeItem("githubAccessToken");
    fail();
  })
}

function loggedIn(afterLogin) {
  getAvatar(setupLogin, function() {
    $("#showStatusBtn").fadeIn();
    $("#showWriterBtn").fadeIn();
    setupLogout();
    afterLogin();
  });
}

function setupLogout() {
  $("#logout").on("click", function(e) {
    e.preventDefault();
    localStorage.removeItem("githubAccessToken");
    window.location = "/";
  });
}<commit_msg>Fixed a styling issue with the navbar.<commit_after>var accessToken = "";


function setupLogin(afterLogin) {
  accessToken = localStorage.githubAccessToken;

  var code = getQueryParams("code");
  var clientId = escape("b08a834d3b797794e83f");

  $("#login").on("click", function(e) {
    e.preventDefault();
    window.location = "https://github.com/login/oauth/authorize?" + "client_id=" + clientId + "&scope=repo&state=totallyrandomstring";
  });

  // If there is no code or accessToken, have the user login.
  if(code === null && accessToken === undefined) {
    $("#login").fadeIn();
  }
  // If there is an access token, the user is logged in.
  else if(accessToken !== undefined) {
    loggedIn(afterLogin);
  }
  // If we have a code, automatically log the user in.
  else {
    $.get("/login?code=" + code)
    .done(function(data) {
      accessToken = escape(data.access_token);
      
      if(data.access_token === undefined) {
        showAlert("danger", "<strong>Failed</strong> to login.");
        $("#login").fadeIn();
        return;
      }

      localStorage.githubAccessToken = accessToken;
      loggedIn(afterLogin);
    })
    .fail(function(data) {
      showAlert("danger", "<strong>Failed</strong> to login.");
      $("#login").fadeIn();
    })
  }
}

function getAvatar(fail, succeed) {
  $.get("/avatar?access_token=" + accessToken)
  .done(function(data) {
    $("#avatar").attr("src", data.avatar);
    $("#loginName").text(data.login);

    $("#loggedIn").fadeIn();
    succeed();
  })
  .fail(function(data) {
    $("#writerDiv").hide();
    localStorage.removeItem("githubAccessToken");
    fail();
  })
}

function loggedIn(afterLogin) {
  getAvatar(setupLogin, function() {
    $("#showStatusBtn").css("display", "block").fadeIn();
    $("#showWriterBtn").css("display", "block").fadeIn();
    setupLogout();
    afterLogin();
  });
}

function setupLogout() {
  $("#logout").on("click", function(e) {
    e.preventDefault();
    localStorage.removeItem("githubAccessToken");
    window.location = "/";
  });
}
{'fraction_non_alphanumeric': 0.18838421444527179, 'fraction_numerical': 0.006949615289153636, 'mean_word_length': 3.5382882882882885, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 11, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6172455', 'n_tokens_mistral': 1295, 'n_tokens_neox': 1284, 'n_words': 236}