<commit_before>var userTitle = "MESH USERS";
var counter = 0;

$(document).ready(function(){
  var socket = io();
  var names = ["David", "Tom"]
  socket.emit("join", names.pop());

  var ready = true;

  $("#name").focus().fadeIn(1000);
  $("form").submit(function(event){
    event.preventDefault();
  });

  $("#send").click(function(){
    var company = $("#company").val();
    var market = $("#market").val();
    var shareAmount = $("#share-amount").val();
    var price = $("#price").val();
    socket.emit("message", company, market, shareAmount, price);
    $("#msg").val("");
  });

  $("#send-comment").click(function(event){
    event.preventDefault();
    var comment = $("#new-comment").val();
    var ticketID = $('#comment-ticket').val();
    socket.emit("comment", comment, ticketID);
    $("#msg").val("");
  });

  socket.on("update", function(user){
    socket.emit("user-list", name);
    if(ready === true) {
      $("#users").html("<li>" + name + "</li>");
    }
  });

  socket.on("update", function(msg) {
    if(ready) {
      $("#msgs").append("<li>" + msg + "</li>");
    }
  });

  socket.on("update-disconnect", function(user) {
    socket.emit("user-list", name);
    if(ready === true) {
      $("#users").html("<li>" + name + "</li>");
    }
  });

  socket.on("update-disconnect", function(user) {
    if(ready === true) {
      $("#msgs").append("<li>" + user + "</li>");
    }
  })

  socket.on("comment", function(who, comment, ticketID) { 
    if(ready) { 
      if(comment != null) { 
        $("#comments").append("<li>" + comment + "</li>");
      }
    }
  });

  socket.on("chat", function(who, company, market, shareAmount, price){
    if(ready) {
      if (company != null) {
        $("#msgs").append("<li id='ticket" + counter + "\'>" +


          "<section class='col-md-6' id='newsfeed-box'>" +
            "<h3 class='share-title'>" + company + "</h3>" +
            "<h6 class='share-market'>" + market +  "</h3>" +
            "<h6 class='share-amount'>" + shareAmount + "@" + price + "</h6>" +
            "<img class='share-person' src='images/james-may.png'>" +
            "<section class='col-md-12 bottom-share-menu'>" +
              "<section class='col-md-4'>" +
                "<img class='share-icons' src='images/comment-01.png'>" +
              "</section>" +
              "<section class='col-md-4'>" +
                "<img class='share-icons' src='images/accept-01.png'>" +
              "</section>" +
              "<section class='col-md-4'>" +
                "<img class='share-icons' src='images/deny-01.png'>" +
              "</section>" +
            "</section>" +
          "</section>" +

          "<form id='3' class='form-inline'>" +
            "<input type='text' class='input' placeholder='Comment' id='new-comment'>" +
            "<input type='hidden' value=" + "ticket" + counter + "id='comment-ticket'" + ">" +
            "<button type='button' name='send' id='send-comment' value='Send' class='btn btn-success'>Comment</button>" + 
          "</form>" +

          "</li>");
        $('#ticket' + counter).fadeIn();
        counter += 1;
      }
    }
  });

  socket.on("disconnect", function(){
    $("#msgs").append("<li><strong><span class='text-warning'>The server is not available</span></strong></li>");
    $("#msg").attr("disabled", "disabled");
    $("#send").attr("disabled", "disabled");
  });
<commit_msg>Updated socketHandlers to handle comments<commit_after>var userTitle = "MESH USERS";
var counter = 0;

$(document).ready(function(){
  var socket = io();
  var names = ["David", "Tom"]
  socket.emit("join", names.pop());

  var ready = true;

  $("#name").focus().fadeIn(1000);
  $("form").submit(function(event){
    event.preventDefault();
  });

  $("#send").click(function(){
    var company = $("#company").val();
    var market = $("#market").val();
    var shareAmount = $("#share-amount").val();
    var price = $("#price").val();
    socket.emit("message", company, market, shareAmount, price);
    $("#msg").val("");
  });

  $("body").on('click', '#send-comment', function(event){
    event.preventDefault();
    var comment = $("#new-comment").val();
    var ticketID = this.value;
    console.log(ticketID);
    socket.emit("comment", comment, ticketID);
    $("#msg").val("");
  });

  socket.on("update", function(user){
    socket.emit("user-list", name);
    if(ready === true) {
      $("#users").html("<li>" + name + "</li>");
    }
  });

  socket.on("update", function(msg) {
    if(ready) {
      $("#msgs").append("<li>" + msg + "</li>");
    }
  });

  socket.on("update-disconnect", function(user) {
    socket.emit("user-list", name);
    if(ready === true) {
      $("#users").html("<li>" + name + "</li>");
    }
  });

  socket.on("update-disconnect", function(user) {
    if(ready === true) {
      $("#msgs").append("<li>" + user + "</li>");
    }
  })

  socket.on("comment", function(who, comment, ticketID) { 
    if(ready) { 
      if(comment != null) { 
        $("#ticket" + ticketID).append("<li>" + comment + "</li>");
      }
    }
  });

  socket.on("chat", function(who, company, market, shareAmount, price){
    if(ready) {
      if (company != null) {
        $("#msgs").append("<li id='ticket" + counter + "\'>" +


          "<section class='col-md-6' id='newsfeed-box'>" +
            "<h3 class='share-title'>" + company + "</h3>" +
            "<h6 class='share-market'>" + market +  "</h3>" +
            "<h6 class='share-amount'>" + shareAmount + "@" + price + "</h6>" +
            "<img class='share-person' src='images/james-may.png'>" +
            "<section class='col-md-12 bottom-share-menu'>" +
              "<section class='col-md-4'>" +
                "<img class='share-icons' src='images/comment-01.png'>" +
              "</section>" +
              "<section class='col-md-4'>" +
                "<img class='share-icons' src='images/accept-01.png'>" +
              "</section>" +
              "<section class='col-md-4'>" +
                "<img class='share-icons' src='images/deny-01.png'>" +
              "</section>" +
            "</section>" +
          "</section>" +

          "<form id='3' class='form-inline'>" +
            "<input type='text' class='input' placeholder='Comment' id='new-comment'>" +
            "<input type='hidden' value='ticket" + counter + "\'" +  "id='comment-ticket'" + ">" +
            "<button type='button' name='send' id='send-comment' value='" + counter + "\'" + "class='btn btn-success'>Comment</button>" + 
          "</form>" +

          "</li>");
        $('#ticket' + counter).fadeIn();
        counter += 1;
      }
    }
  });

  socket.on("disconnect", function(){
    $("#msgs").append("<li><strong><span class='text-warning'>The server is not available</span></strong></li>");
    $("#msg").attr("disabled", "disabled");
    $("#send").attr("disabled", "disabled");
  });

{'fraction_non_alphanumeric': 0.24811921296296297, 'fraction_numerical': 0.007233796296296296, 'mean_word_length': 2.6005208333333334, 'pattern_counts': {'":': 0, '<': 91, '<?xml version=': 0, '>': 91, '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': '5973269', 'n_tokens_mistral': 2208, 'n_tokens_neox': 2201, 'n_words': 386}