<commit_before>/**
 * Validate contact us form
 */
var $contactForm = $('.js_contact_form'),
	formKey = '<KEY>',
	$textAreaDescription = $('#message-detail-text');

var $modalAlert = $('#contact-alert-modal'),
	$modalAlertError = $('#contact-alert-modal-error'),
	$btnAlertOk = $modalAlert.find('#js_contact_btn_alert_ok'),
	$btnAlertError = $modalAlertError.find('#js_contact_btn_alert_ok-error'),
	errorDescriptionID = 'char-count';

/*set new key for localhost*/
function checkKey() {
	var localhost = /(localhost:4000)+/ig,
		host = window.location.host;

	if(localhost.test(host)){
		formKey = '892e0c5e4c169c6128c7342614608330';
	}
}

$contactForm.submit(function(e){
	var charCount = $textAreaDescription.val().length;

	e.preventDefault();
	$('button', $contactForm).prop('disabled',true);

	if(3000 <= charCount) {
		showMsgError('#contact-alert-modal-error',  charCount);
		return false;
	}

	$.ajax({
		dataType: 'jsonp',
		url: "https://getsimpleform.com/messages/ajax?form_api_token="+formKey,
		data: $contactForm.serialize()
	}).done(function() {
		//callback shows the 'thank you message'
		showMsgSuccess('#contact-alert-modal');
	});
	return false; //to stop the form from submitting
});
function showMsgSuccess($modalAlert){
	// Show message<commit_msg>mod: char count check<commit_after>/**
 * Validate contact us form
 */
var $contactForm = $('.js_contact_form'),
	formKey = '<KEY>',
	$textAreaDescription = $('#message-detail-text');

var $modalAlert = $('#contact-alert-modal'),
	$modalAlertError = $('#contact-alert-modal-error'),
	$btnAlertOk = $modalAlert.find('#js_contact_btn_alert_ok'),
	$btnAlertError = $modalAlertError.find('#js_contact_btn_alert_ok-error'),
	errorDescriptionID = 'char-count';

/*set new key for localhost*/
function checkKey() {
	var localhost = /(localhost:4000)+/ig,
		host = window.location.host;

	if(localhost.test(host)){
		formKey = '892e0c5e4c169c6128c7342614608330';
	}
}

$contactForm.submit(function(e){
	var charCount = $textAreaDescription.val().length;

	e.preventDefault();
	$('button', $contactForm).prop('disabled',true);

	if(3000 < charCount) {
		showMsgError('#contact-alert-modal-error',  charCount);
		return false;
	}

	$.ajax({
		dataType: 'jsonp',
		url: "https://getsimpleform.com/messages/ajax?form_api_token="+formKey,
		data: $contactForm.serialize()
	}).done(function() {
		//callback shows the 'thank you message'
		showMsgSuccess('#contact-alert-modal');
	});
	return false; //to stop the form from submitting
});
function showMsgSuccess($modalAlert){
	// Show message
{'fraction_non_alphanumeric': 0.17483339866718933, 'fraction_numerical': 0.026656213249705997, 'mean_word_length': 5.543589743589743, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 5, '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': '7308363', 'n_tokens_mistral': 917, 'n_tokens_neox': 852, 'n_words': 158}