<commit_before><head>
  <link rel="stylesheet" type="text/css" href="/css/style.css">
</head>  


<script src="/socket.io/socket.io.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.6.4/jquery.min.js"></script>
<script>
// Se declara la variable socket fuera de la funcion ready para que su ambito sea global
var socket = io.connect('/',{'forceNew': true });
$( document ).ready(function() {
    console.log( "ready!" );

    // la URL que se le pasa io.connect es / para que tome la ip local del cliente
	  
    var agentname ='';
	// on connection to server, ask for user's name with an anonymous callback
	socket.on('connect', function(){
		  // call the server-side function 'adduser' and send one parameter (value of prompt)
      agentname = prompt("Cual es tu nombre de Agente?")
		  socket.emit('addagent', agentname);
		  socket.agentname = agentname;
	});

	// listener, whenever the server emits 'updatechat', this updates the chat body
	socket.on('updatechat', function (username, data,pos,roomid) {
    if (roomid == null) {
      pos = pos;
    }
      else{
      pos = roomid;
    }
    console.log(pos);
    console.log(roomid);
    console.log(username);
    console.log(data);

    
		if (username === agentname){
		   $('#conversation' + pos).append('<p class="triangle-isosceles"> <b>'+username + ':</b> ' + data + '</p>');
	    }
	    else{
	    	$('#conversation' + pos).append('<p class="triangle-isosceles top"> <b>'+ '>>' + username + ':</b> ' + data + '</p>');
        $('#tab-' + pos).text( username ); //quita el mensaje de que el usuario esta escribiendo
	   } 
		//Getting the element's new height now
		//alert(data + '  ' + pos);
    var sHeight = $('#conversation' + pos)[0].scrollHeight;
    //Scrolling the element to the sHeight
    $('#box_conversation' + pos).scrollTop(sHeight);

    console.log(pos);
    console.log(username);
    console.log(data);
    console.log(sHeight);

	});


socket.on('istyping', function (username, data,pos,roomid) {
    
    //alert('sfsefsdf');
    if (roomid == null) {
      pos = pos;
    }
      else{
      pos = roomid;
    }
    console.log(pos);
    console.log(roomid);
    console.log(username);
    console.log(data);
    console.log('escribiendo');

    
    
       $('#tab-' + pos).text( username + ' esta escribiendo');
      // settimetodrop(username,pos);        

  });



   socket.on('newuser', function (emisor, username, roomid,pos) {<commit_msg>wfddfgdf<commit_after><head>
  <link rel="stylesheet" type="text/css" href="/css/style.css">
</head>  


<script src="/socket.io/socket.io.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.6.4/jquery.min.js"></script>
<script>
// Se declara la variable socket fuera de la funcion ready para que su ambito sea global
var socket = io.connect('/',{'forceNew': true });
$( document ).ready(function() {
    console.log( "ready!" );

    // la URL que se le pasa io.connect es / para que tome la ip local del cliente
	  
    var agentname ='';
	// on connection to server, ask for user's name with an anonymous callback
	socket.on('connect', function(){
		  // call the server-side function 'adduser' and send one parameter (value of prompt)
      agentname = prompt("Cual es tu nombre de Agente?")
		  socket.emit('addagent', agentname);
		  socket.agentname = agentname;
	});

	// listener, whenever the server emits 'updatechat', this updates the chat body
  //username de quien envia el mensaje
	socket.on('updatechat', function (username, data,pos,roomid) {
    if (roomid == null) {
      pos = pos;
    }
      else{
      pos = roomid;
    }
    console.log(pos);
    console.log(roomid);
    console.log(username);
    console.log(data);
    var strTab =  $('#tab-' + pos).text;
    $('#tab-' + pos).text(  strSlice(0, strTab.lastIndexOf("esta escribiendo")-1)); // quita el mensaje de que el usuario esta escribiendo
     
		if (username === agentname){
		   $('#conversation' + pos).append('<p class="triangle-isosceles"> <b>'+username + ':</b> ' + data + '</p>');
       
   

      }
	    else{
	    	$('#conversation' + pos).append('<p class="triangle-isosceles top"> <b>'+ '>>' + username + ':</b> ' + data + '</p>');
        
	   } 
		//Getting the element's new height now
		//alert(data + '  ' + pos);
    var sHeight = $('#conversation' + pos)[0].scrollHeight;
    //Scrolling the element to the sHeight
    $('#box_conversation' + pos).scrollTop(sHeight);

    console.log(pos);
    console.log(username);
    console.log(data);
    console.log(sHeight);

	});


socket.on('istyping', function (username, data,pos,roomid) {
    
    //alert('sfsefsdf');
    if (roomid == null) {
      pos = pos;
    }
      else{
      pos = roomid;
    }
    console.log(pos);
    console.log(roomid);
    console.log(username);
    console.log(data);
    console.log('escribiendo');

    
    
       $('#tab-' + pos).text( username + ' esta escribiendo...');
      // settimetodrop(username,pos);        

  });



   socket.on('newuser', function (emisor, username, roomid,pos) {
{'fraction_non_alphanumeric': 0.17254979294024847, 'fraction_numerical': 0.0019719976336028395, 'mean_word_length': 2.9226604795050273, 'pattern_counts': {'":': 0, '<': 35, '<?xml version=': 0, '>': 39, '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': '569602', 'n_tokens_mistral': 1709, 'n_tokens_neox': 1636, 'n_words': 416}