<commit_before>

var mandatoryColor = '#E0E0E0';
var optionalColor = '#e7e7e7';
var errorColor = '#f78778';

$(document).ready(function()
{

});


function sendMessage(postID,blockID,emailIndication,subjectIndication)
{	
	var message = new Object()
	message.postID = postID;
	message.blockID = blockID;
	message.email = $('#contactEmail_' + postID + '_' + blockID).val();
	message.subject = $('#contactSubject_' + postID + '_' + blockID).val();
	message.content = $('#contactContent_' + postID + '_' + blockID).val();
	
	var error = false;
	
	if ( !validateEmail(message.email) )
	{
		setBackgroundColor($('#contactEmail_' + postID + '_' + blockID),errorColor);
		error = true;
	}
	
	if (message.subject == subjectIndication || message.subject == "")
	{
		message.subject = "";
	}
	
	if (message.content == "")
	{
		setBackgroundColor($('#contactContent_' + postID + '_' + blockID),errorColor);
		error = true;
	}
	
	
	if (!error)
	{
		$('#contactFields_' + postID + '_' + blockID).hide();
		$('#formsending_' + postID + '_' + blockID).show();
		
		Post('/contact',message,sendMessageCallback,errorCallback);			
	}
	
}


var sendMessageCallback = function(data)
{
	var res = data;
	
	$( "div[id^='formsending_']" ).each(function( index )
	{	
		if ($(this).is(":visible"))
		{	
			var id = $(this).attr('id');
			
			var elements = id.split('_');
			
			if(res.success)
			{
				elements.splice(0,1,"formsent");
				var idSent = elements.join("_");
				idSent = "#" + idSent;
							
				$(idSent).show();
			}
			else
			{
				elements.splice(0,1,"formerror");
				var idError = elements.join("_");
				idError = "#" + idError;
							
				$(idError).show();			
			}
			
			$(this).hide();	
		}
	});
}



function postComment(nameIndication,emailIndication,websiteIndication,twitterIndication)
{
	var comment = new Object()
	comment.postID = $('#postID').val();
	comment.answerComID = $('#answerComID').val();
	comment.name = $('#commentName').val();
	comment.email = $('#commentEmail').val();
	comment.content = $('#commentContent').val();

	comment.website = $('#commentWebsite').val();
	comment.twitter = $('#commentTwitter').val();
	
	comment.emailOnAnswer = $('#comEmailOnAnswer').is(":checked");
	comment.remember = $('#comRemember').is(":checked");
	
	
	
	var error = false;
	
	
	if (comment.name == "" || comment.name == nameIndication)
	{
		setBackgroundColor($('#commentName'),errorColor);
		error = true;
	}
	
	if (comment.email == emailIndication || comment.email == "")
	{
		comment.email = "";
	}
	else if ( !validateEmail(comment.email) )
	{
		setBackgroundColor($('#commentEmail'),errorColor);
		error = true;
	}

	// check valid website
	if (comment.website == websiteIndication || comment.website == "")
	{
		comment.website = "";
	}

	// limit # of characters
	if (comment.twitter == twitterIndication || comment.twitter == "")
	{
		comment.website = "";
	}


	
	if (comment.content == "")
	{
		setBackgroundColor($('#commentContent'),errorColor);
		error = true;
	}
	
	if (!error)
	{
		$('#fields').hide();
		$('#formsending').show();
		
		Post('/comment',comment,postCommentCallback,errorCallback);			
	}
}


var postCommentCallback = function(data)
{
	var res = data;

	$('#formsending').hide();
		<commit_msg>Fixed issue in function-blog.js (comment.website was deleted by mistake)<commit_after>

var mandatoryColor = '#E0E0E0';
var optionalColor = '#e7e7e7';
var errorColor = '#f78778';

$(document).ready(function()
{

});


function sendMessage(postID,blockID,emailIndication,subjectIndication)
{	
	var message = new Object()
	message.postID = postID;
	message.blockID = blockID;
	message.email = $('#contactEmail_' + postID + '_' + blockID).val();
	message.subject = $('#contactSubject_' + postID + '_' + blockID).val();
	message.content = $('#contactContent_' + postID + '_' + blockID).val();
	
	var error = false;
	
	if ( !validateEmail(message.email) )
	{
		setBackgroundColor($('#contactEmail_' + postID + '_' + blockID),errorColor);
		error = true;
	}
	
	if (message.subject == subjectIndication || message.subject == "")
	{
		message.subject = "";
	}
	
	if (message.content == "")
	{
		setBackgroundColor($('#contactContent_' + postID + '_' + blockID),errorColor);
		error = true;
	}
	
	
	if (!error)
	{
		$('#contactFields_' + postID + '_' + blockID).hide();
		$('#formsending_' + postID + '_' + blockID).show();
		
		Post('/contact',message,sendMessageCallback,errorCallback);			
	}
	
}


var sendMessageCallback = function(data)
{
	var res = data;
	
	$( "div[id^='formsending_']" ).each(function( index )
	{	
		if ($(this).is(":visible"))
		{	
			var id = $(this).attr('id');
			
			var elements = id.split('_');
			
			if(res.success)
			{
				elements.splice(0,1,"formsent");
				var idSent = elements.join("_");
				idSent = "#" + idSent;
							
				$(idSent).show();
			}
			else
			{
				elements.splice(0,1,"formerror");
				var idError = elements.join("_");
				idError = "#" + idError;
							
				$(idError).show();			
			}
			
			$(this).hide();	
		}
	});
}



function postComment(nameIndication,emailIndication,websiteIndication,twitterIndication)
{
	var comment = new Object()
	comment.postID = $('#postID').val();
	comment.answerComID = $('#answerComID').val();
	comment.name = $('#commentName').val();
	comment.email = $('#commentEmail').val();
	comment.content = $('#commentContent').val();

	comment.website = $('#commentWebsite').val();
	comment.twitter = $('#commentTwitter').val();
	
	comment.emailOnAnswer = $('#comEmailOnAnswer').is(":checked");
	comment.remember = $('#comRemember').is(":checked");
	
	
	
	var error = false;
	
	
	if (comment.name == "" || comment.name == nameIndication)
	{
		setBackgroundColor($('#commentName'),errorColor);
		error = true;
	}
	
	if (comment.email == emailIndication || comment.email == "")
	{
		comment.email = "";
	}
	else if ( !validateEmail(comment.email) )
	{
		setBackgroundColor($('#commentEmail'),errorColor);
		error = true;
	}

	// check valid website
	if (comment.website == websiteIndication || comment.website == "")
	{
		comment.website = "";
	}

	// limit # of characters
	if (comment.twitter == twitterIndication || comment.twitter == "")
	{
		comment.twitter = "";
	}


	
	if (comment.content == "")
	{
		setBackgroundColor($('#commentContent'),errorColor);
		error = true;
	}
	
	if (!error)
	{
		$('#fields').hide();
		$('#formsending').show();
		
		Post('/comment',comment,postCommentCallback,errorCallback);			
	}
}


var postCommentCallback = function(data)
{
	var res = data;

	$('#formsending').hide();
		
{'fraction_non_alphanumeric': 0.19791506975318104, 'fraction_numerical': 0.00459911083857121, 'mean_word_length': 3.9200603318250375, 'pattern_counts': {'":': 6, '<': 3, '<?xml version=': 0, '>': 3, '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': '3309197', 'n_tokens_mistral': 2445, 'n_tokens_neox': 2138, 'n_words': 360}