<commit_before>extend layout

block header
  script(type="text/javascript", src="/chat/client.js")
  script(src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js")

block content
  textarea(rows=20, cols=39, readonly)#messages.messages
  input(type="text", name="username")#chat.newmessage
  input(type="submit", value="Send")#fire.send
  script.
    var $chat = $('#chat');
    $('#fire').on('click',null, function() {
      client.publish('/room1', {text: "#{user}: " + $chat.val()});$chat.val('');
      $('#messages').scrollTop($('#messages')[0].scrollHeight);
    });

    $chat.keyup(function(e){
      var code = (e.keyCode ? e.keyCode : e.which);
      if(code == 13) { 
        client.publish('/room1', {text: "#{user}: " + $chat.val()});$chat.val('');
        $('#messages').scrollTop($('#messages')[0].scrollHeight);
      }
    });

    var client = new Faye.Client('/chat');			

    var subscription = client.subscribe('/room1', function(message) {
      $("textarea#messages").val($("textarea#messages").val() + message.text + "\n");
      $("textarea#messages").scrollTop($('#messages')[0].scrollHeight);
    });

    setInterval(function() {
      $.get("/users/#{user}");
      $.get("/users", function(data) {
        $("#onlineusers").text("");
        for (var i in data) {
          $("#onlineusers").append("<p>" + data[i] + "</p>");
        }
      }, "json");
    }, 3000);

block sidebar
  .widget
    h1 Online Users:
    div#onlineusers


<commit_msg>Added support for time<commit_after>extend layout

block header
  script(type="text/javascript", src="/chat/client.js")
  script(src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js")

block content
  textarea(rows=20, cols=39, readonly)#messages.messages
  input(type="text", name="username")#chat.newmessage
  input(type="submit", value="Send")#fire.send
  script.
    var $chat = $('#chat');
    $('#fire').on('click',null, function() {
      var now = new Date().getHours() + ":" + new Date().getMinutes() + ":" + new Date().getSeconds();
       client.publish('/room1', {text: "#{user}: " + $chat.val(), timestamp: now});$chat.val('');
      $('#messages').scrollTop($('#messages')[0].scrollHeight);
    });

    $chat.keyup(function(e){
      var code = (e.keyCode ? e.keyCode : e.which);
      if(code == 13) { 
        var now = new Date().getHours() + ":" + new Date().getMinutes() + ":" + new Date().getSeconds();
        client.publish('/room1', {text: "#{user}: " + $chat.val(), timestamp: now});$chat.val('');
        $('#messages').scrollTop($('#messages')[0].scrollHeight);
      }
    });

    var client = new Faye.Client('/chat');			

    var subscription = client.subscribe('/room1', function(message) {
      $("textarea#messages").val($("textarea#messages").val() + "[" + message.timestamp + "] " + message.text + "\n");
      $("textarea#messages").scrollTop($('#messages')[0].scrollHeight);
    });

    setInterval(function() {
      $.get("/users/#{user}");
      $.get("/users", function(data) {
        $("#onlineusers").text("");
        for (var i in data) {
          $("#onlineusers").append("<p>" + data[i] + "</p>");
        }
      }, "json");
    }, 3000);

block sidebar
  .widget
    h1 Online Users:
    div#onlineusers



{'fraction_non_alphanumeric': 0.23845918679302966, 'fraction_numerical': 0.012228676245796393, 'mean_word_length': 3.333774834437086, 'pattern_counts': {'":': 4, '<': 7, '<?xml version=': 0, '>': 7, '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': '180223', 'n_tokens_mistral': 1085, 'n_tokens_neox': 1049, 'n_words': 172}