<commit_before>(function(window, document, io){
  
  // if io has been defined in the top window (for dev reasons)
  var io = window.top.io || io;
  // var socket = io.connect(document.location.origin);
  
  // get a socket - and listen for logging
  var getSocket = function(){
    var socket = io.connect(document.location.origin)
    socket.on('hello', function(message){
      console.log("Server said:" + message);
    });
    return socket;
  }
  
	
	var ArenaView = function(elements){
		this.els = elements;
		this.transport = getSocket();
		
		this.emit('arena');
    
    this.on('backgroundtop', function(color){
      elements.top.style.backgroundColor = color
    });
    
    
    var ctx = elements.canvas.getContext('2d');
    ctx.fillStyle="red"
    this.on('updatePlayer', function(id,x,y){
      // *5 for debug
      ctx.fillRect(x*5,y*5,2,2);
    })
	};
	
	
	var PlayerView = function(elements){
		this.els = elements;
		this.transport = getSocket();
		
		this.emit('player');
		
		var player = this;
		// link up the ui
		this.els.left.addEventListener('click', function(){
		  player.emit('left');
		})
		this.els.right.addEventListener('click', function(){
		  player.emit('right');
		})
	};
	
	
	
	/* 
   Link up the models to the transport

   This means that the models don't have to have
   transport code in them,  calling this.on(…) will
   defer to the transport.  Also - the functions 
   will be called in the context of the object
   which is handy.
 */
	var transportPrototypes = function(){
	  this.prototype.on = function(event,fn){
      var _this = this;
      this.transport.on(event, function(){
        fn.apply(_this,arguments);
      });
    };
    this.prototype.emit = function(){
      this.transport.emit.apply(this.transport,arguments);
    };
	}
	transportPrototypes.call(PlayerView);
	transportPrototypes.call(ArenaView);
	
	
	window.ArenaView = ArenaView;
	window.PlayerView = PlayerView;
	
	window.el = function(id){
    return document.getElementById(id);
  }
	
})(window, document, io);<commit_msg>tabs -> 2 spaces<commit_after>(function(window, document, io){
  
  // if io has been defined in the top window (for dev reasons)
  var io = window.top.io || io;
  // var socket = io.connect(document.location.origin);
  
  // get a socket - and listen for logging
  var getSocket = function(){
    var socket = io.connect(document.location.origin)
    socket.on('hello', function(message){
      console.log("Server said:" + message);
    });
    return socket;
  }
  
  
  var ArenaView = function(elements){
    this.els = elements;
    this.transport = getSocket();
    
    this.emit('arena');
    
    this.on('backgroundtop', function(color){
      elements.top.style.backgroundColor = color
    });
    
    
    var ctx = elements.canvas.getContext('2d');
    ctx.fillStyle="red"
    this.on('updatePlayer', function(id,x,y){
      // *5 for debug
      ctx.fillRect(x*5,y*5,2,2);
    })
  };
  
  
  var PlayerView = function(elements){
    this.els = elements;
    this.transport = getSocket();
    
    this.emit('player');
    
    var player = this;
    // link up the ui
    this.els.left.addEventListener('click', function(){
      player.emit('left');
    })
    this.els.right.addEventListener('click', function(){
      player.emit('right');
    })
  };
  
  
  
  /* 
   Link up the models to the transport

   This means that the models don't have to have
   transport code in them,  calling this.on(…) will
   defer to the transport.  Also - the functions 
   will be called in the context of the object
   which is handy.
 */
  var transportPrototypes = function(){
    this.prototype.on = function(event,fn){
      var _this = this;
      this.transport.on(event, function(){
        fn.apply(_this,arguments);
      });
    };
    this.prototype.emit = function(){
      this.transport.emit.apply(this.transport,arguments);
    };
  }
  transportPrototypes.call(PlayerView);
  transportPrototypes.call(ArenaView);
  
  
  window.ArenaView = ArenaView;
  window.PlayerView = PlayerView;
  
  window.el = function(id){
    return document.getElementById(id);
  }
  
})(window, document, io);
{'fraction_non_alphanumeric': 0.13682189150264043, 'fraction_numerical': 0.0031204992798847817, 'mean_word_length': 2.822935779816514, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 4, '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': '758139', 'n_tokens_mistral': 1329, 'n_tokens_neox': 1272, 'n_words': 309}