<commit_before>function UI(){
	var colorDispensors = {}
	this.getColorDispensor = function(context){
		if(!colorDispensors[context]){
			colorDispensors[context] = new colorDispensor();
		}
		return colorDispensors[context];
	}
	
	var last_line = null;
	
	if(!readonly){
		IO.socket.on('connect', function(){
			$('#message').attr('disabled', false).focus();
		});
	}
	
	this.appendMessages = function(data){
		var messages = data.messages;
		for(var i=0; i<messages.length; i++){
			this.appendMessage(messages[i]);
		}
	}

	this.update_connection_status = function(text){
		$('#connection_status').text(text);
	};
	
	this.appendMessage = function(data){
		if(last_line && last_line.from.id == data.from.id){
			this.appendMessageText(data.msg, last_line.msg_container)
		}else{
			var line = $('<tr>'),
			    nick = $('<td>'),
			    msg_container  = $('<td>');
		
			nick.text(data.from.name);
			nick.addClass('name');
			nick.css('color', UI.getColorDispensor('users').colorFor(data.from.id))
			
			this.appendMessageText(data.msg, msg_container)

			line.append(nick, msg_container);
			line.addClass('line');

			data.line = line;		
			data.msg_container = msg_container;
			last_line = data;
	
			$('#message_list').append(line);
		}
		var message_list = $('#message_list');
		
		if(message_list.height() > message_list.parent().height()){
			message_list.css({'position':'static'})
		}
	}
	
	this.systemMessage = function(msg){
		this.appendMessage({from:{name: "System"}, msg:msg});		
	}
	
	this.linkify = function(inputText){
		var replacePattern1 = /(\b(https?|ftp):\/\/[-A-Z0-9+&@#\/%?=~_|!:,.;]*[-A-Z0-9+&@#\/%=~_|])/gim;
		var replacedText = inputText.replace(replacePattern1, '<a href="$1" target="_blank">$1</a>');
		var replacePattern2 = /(^|[^\/])(www\.[\S]+(\b|$))/gim;
		var replacedText = replacedText.replace(replacePattern2, '$1<a href="http://$2" target="_blank">$2</a>');
		var replacePattern3 = /(\w+@[a-zA-Z_]+?\.[a-zA-Z]{2,6})/gim;
		var replacedText = replacedText.replace(replacePattern3, '<a href="mailto:$1">$1</a>');
    return replacedText
	}
<commit_msg>bug fix: Fixed the message list positioning on window resize<commit_after>function UI(){
	var colorDispensors = {}
	this.getColorDispensor = function(context){
		if(!colorDispensors[context]){
			colorDispensors[context] = new colorDispensor();
		}
		return colorDispensors[context];
	}
	
	var last_line = null;
	
	$(document).ready(function(){
		var resize_timer;
		$(window).resize(function(){
			if(resize_timer) clearTimeout(resize_timer);
			resize_timer = setTimeout(UI.positionMessageList, 100);
		});
	});	
	
	if(!readonly){
		IO.socket.on('connect', function(){
			$('#message').attr('disabled', false).focus();
		});
	}
	
	this.appendMessages = function(data){
		var messages = data.messages;
		for(var i=0; i<messages.length; i++){
			this.appendMessage(messages[i]);
		}
	}

	this.update_connection_status = function(text){
		$('#connection_status').text(text);
	};
	
	this.appendMessage = function(data){
		if(last_line && last_line.from.id == data.from.id){
			this.appendMessageText(data.msg, last_line.msg_container)
		}else{
			var line = $('<tr>'),
			    nick = $('<td>'),
			    msg_container  = $('<td>');
		
			nick.text(data.from.name);
			nick.addClass('name');
			nick.css('color', UI.getColorDispensor('users').colorFor(data.from.id))
			
			this.appendMessageText(data.msg, msg_container)

			line.append(nick, msg_container);
			line.addClass('line');

			data.line = line;		
			data.msg_container = msg_container;
			last_line = data;
	
			$('#message_list').append(line);
		}
		
		this.positionMessageList();
	}
	
	this.systemMessage = function(msg){
		this.appendMessage({from:{name: "System"}, msg:msg});		
	}
	
	this.positionMessageList = function(){
		var message_list = $('#message_list');
		var taller = message_list.height() > message_list.parent().height();
		
		message_list.css({'position':(taller ? 'static' : 'absolute')})
	}
	
	this.linkify = function(inputText){
		var replacePattern1 = /(\b(https?|ftp):\/\/[-A-Z0-9+&@#\/%?=~_|!:,.;]*[-A-Z0-9+&@#\/%=~_|])/gim;
		var replacedText = inputText.replace(replacePattern1, '<a href="$1" target="_blank">$1</a>');
		var replacePattern2 = /(^|[^\/])(www\.[\S]+(\b|$))/gim;
		var replacedText = replacedText.replace(replacePattern2, '$1<a href="http://$2" target="_blank">$2</a>');
		var replacePattern3 = /(\w+@[a-zA-Z_]+?\.[a-zA-Z]{2,6})/gim;
		var replacedText = replacedText.replace(replacePattern3, '<a href="mailto:$1">$1</a>');
    return replacedText
	}

{'fraction_non_alphanumeric': 0.20903083700440528, 'fraction_numerical': 0.00947136563876652, 'mean_word_length': 4.438323353293413, 'pattern_counts': {'":': 0, '<': 23, '<?xml version=': 0, '>': 23, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, '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': '7354188', 'n_tokens_mistral': 1823, 'n_tokens_neox': 1620, 'n_words': 235}