<commit_before>var firebase = new Firebase("https://into-the-5ire.firebaseio.com/");

function addEventListeners() {

  $("#heart").hover(function(){
    $("#heart").attr("src", "img/heart_filled.png");
    console.log("filled");
  }, function(){
    $("#heart").attr("src", "img/heart_outlined.png");
    console.log("outlined");
  });

  $("#heart").click(function(){
    var key = $(this).parent().data("id");
    var currentFaves = $(this).parent().data("faves");
    var newFaves = currentFaves + 1;
    firebase.child(key).update({
      faves: newFaves
    });
  });

  $("#submit_button").click(function(){
    $("#addModal").foundation("reveal", "close");
  });

}


function updateDOM() {

  firebase.on("value", function(snapshot){
    var data = snapshot.val();
    console.log("Snapshot recieved:");
    console.log(data);
    update(data);
    console.log("Snapshot loaded into DOM");
    if(snapshot.val() == null) {
      $("#feedback-list").html("<br><h3>Be the first to add feedback!<h3>");
    }
  }, function(errorObject){
    console.log("The read failed: " + errorObject.code);
  });

  function update(data){
    $("#feedback-list").html("<br>");
    for(var fbelem in data){
      var elem = data[fbelem];
      var feedbackList =
      "<div><h3><i>" + elem.timestamp + ":</i></h3>" +
      "<h3>" + elem.fullname + " - " + elem.feedback + "</h3>" +
      "<h3>" + elem.faves + " favorites</h3>" +
      "<img id='heart' src='img/heart_outlined.png' width='5%'>" + "</div>";
      $("#feedback-list").data("id", fbelem);
      $("#feedback-list").data("faves", elem.faves);
      $("#feedback-list").append(feedbackList);
      $("#feedback-list").append("<br>");
    }
    addEventListeners();
  }

  $("#add-form").submit(function(event){
    event.preventDefault();
    console.log("Form submitted");

    var fullname = $("#name").val();
    var feedback = $("#feedback").val();
    var date = new Date();
    var timestamp = date.toLocaleDateString() + " at " + date.toLocaleTimeString();

    var JSONObj = {
      "fullname":fullname,
      "feedback":feedback,
      "timestamp":timestamp,
      "faves": 0
    };

    firebase.push(JSONObj, function(){
      console.log("Push to Firebase was successful: " + JSONObj.fullname);
    });

  });

}

$(document).ready(function(){
  updateDOM();
  addEventListeners();
  console.log("Document loaded");
});
<commit_msg>Tweaked 5ire<commit_after>var firebase = new Firebase("https://into-the-5ire.firebaseio.com/");

function update(data){
  $("#feedback-list").html("<br>");
  for(var fbelem in data){
    var elem = data[fbelem];
    var feedbackList =
    "<div><h3><i>" + elem.timestamp + ":</i></h3>" +
    "<h3>" + elem.fullname + " - " + elem.feedback + "</h3>" +
    "<h3>" + elem.faves + " favorites</h3>" +
    "<img id='heart' src='img/heart_outlined.png' width='5%'>" + "</div>";
    $("#feedback-list").data("id", fbelem);
    console.log("Key: " + $(this).data("id"));
    $("#feedback-list").data("faves", elem.faves);
    $("#feedback-list").append(feedbackList);
    $("#feedback-list").append("<br>");
  }
  addEventListeners();
}

function addEventListeners() {

  $("#heart").hover(function(){
    $("#heart").attr("src", "img/heart_filled.png");
    console.log("filled");
  }, function(){
    $("#heart").attr("src", "img/heart_outlined.png");
    console.log("outlined");
  });

  $("#heart").click(function(){
    var key = $(this).parent().data("id");
    var currentFaves = $(this).parent().data("faves");
    var newFaves = currentFaves + 1;
    firebase.child(key).update({
      "faves": newFaves
    });
  });

  $("#submit_button").click(function(){
    $("#addModal").foundation("reveal", "close");
  });

}


function updateDOM() {

  firebase.on("value", function(snapshot){
    var data = snapshot.val();
    console.log("Snapshot recieved:");
    console.log(data);
    update(data);
    console.log("Snapshot loaded into DOM");

    if(snapshot.val() == null) {
      $("#feedback-list").html("<br><h3>Be the first to add feedback!<h3>");
    }
  }, function(errorObject){
    console.log("The read failed: " + errorObject.code);
  });

  $("#add-form").submit(function(event){
    event.preventDefault();
    console.log("Form submitted");

    var fullname = $("#name").val();
    var feedback = $("#feedback").val();
    var date = new Date();
    var timestamp = date.toLocaleDateString() + " at " + date.toLocaleTimeString();

    var JSONObj = {
      "fullname":fullname,
      "feedback":feedback,
      "timestamp":timestamp,
      "faves": 0
    };

    firebase.push(JSONObj, function(){
      console.log("Push to Firebase was successful");
    });

  });

}

$(document).ready(function(){
  updateDOM();
  console.log("Document loaded");
});

{'fraction_non_alphanumeric': 0.22720603647034165, 'fraction_numerical': 0.005239991616013414, 'mean_word_length': 3.518939393939394, 'pattern_counts': {'":': 11, '<': 35, '<?xml version=': 0, '>': 35, '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': '98890', 'n_tokens_mistral': 1583, 'n_tokens_neox': 1576, 'n_words': 265}