<commit_before>var selected_projects = [];

$(document).ready(function() {

window.addEventListener("load", function(event) {
  console.log("page loaded!");
  var state = history.state;
  console.log("state");
  console.log(state);
    if (state) {
    selected_projects = state["selected_projects"];
    for (i = 0; i < selected_projects.length; i++) {
      selectProject(selected_projects[i]);

      // @TODO: may want to re-visit to see why once I move the following to toggleProject, first page behaves super weird
      selectedCheckBox = ("permit_selected_").concat(selected_projects[i]).replace("-", "_");
      document.getElementById(selectedCheckBox).checked = true;
      alert("finish popstate in load");
    }
  }
});
$("#new_permit_submit").click(function(e){
    alert("before preventing default");
     e.preventDefault();
     alert("before saving projects");
     saveProjects();
     alert("before submiting");
     $('#new_permit').submit();
 });
// $("#new_permit").submit(function(e) {
//   e.preventDefault();
//   //alert("about to submit");
//   saveProjects();
//   //return true;
//   $(this).trigger('submit');
// });

  // trigger when user clicks any of the "select a project" buttons
  $ (".project").each(function(i) {

    // just focus on the button the user clicked
    $(this).click(function() {

      // get the id of the clicked button button, which will tell us what kind of project the user picked
      clickedButton = $(this).attr("id");

      // add in selected_projects array
      proj_index = selected_projects.indexOf(clickedButton);
      if (proj_index == -1) {<commit_msg>Add more debugging alerts<commit_after>var selected_projects = [];

$(document).ready(function() {

window.addEventListener("load", function(event) {
  console.log("page loaded!");
  var state = history.state;
  history.state = null;
  console.log("state after setting history.state");
  console.log(state);
  history.replaceState(null, null, null);
  console.log("state after replacing state");
  console.log(state);
    if (state) {
    selected_projects = state["selected_projects"];
    for (i = 0; i < selected_projects.length; i++) {
      selectProject(selected_projects[i]);

      // @TODO: may want to re-visit to see why once I move the following to toggleProject, first page behaves super weird
      selectedCheckBox = ("permit_selected_").concat(selected_projects[i]).replace("-", "_");
      document.getElementById(selectedCheckBox).checked = true;
      alert("finish popstate in load");
      //History.Adapter.trigger(window,'popstate');
    }
  }
});
$("#new_permit_submit").click(function(e){
    alert("before preventing default");
     e.preventDefault();
     alert("before saving projects");
     saveProjects();
     alert("before submiting");
     $('#new_permit').submit();
 });
// $("#new_permit").submit(function(e) {
//   e.preventDefault();
//   //alert("about to submit");
//   saveProjects();
//   //return true;
//   $(this).trigger('submit');
// });

  // trigger when user clicks any of the "select a project" buttons
  $ (".project").each(function(i) {

    // just focus on the button the user clicked
    $(this).click(function() {

      // get the id of the clicked button button, which will tell us what kind of project the user picked
      clickedButton = $(this).attr("id");

      // add in selected_projects array
      proj_index = selected_projects.indexOf(clickedButton);
      if (proj_index == -1) {
{'fraction_non_alphanumeric': 0.15813686026451984, 'fraction_numerical': 0.0011500862564692352, 'mean_word_length': 3.5897097625329817, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 3, 'https://': 0, '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': '2871896', 'n_tokens_mistral': 991, 'n_tokens_neox': 980, 'n_words': 263}