<commit_before>var $nexusForm = $('.js_nexus_form'),
  $modalAlert = $('#nexus-alert-modal'),
  $modalAlertError = $('#nexus-alert-modal-error'),
  $btnAlertOk = $modalAlert.find('#js_nexus_btn_alert_ok'),
  $btnAlertError = $modalAlertError.find('#js_nexus_btn_alert_ok-error'),
  $textAreaDescription = $('#company-detail-text'),
  formKey = '<KEY>',
	errorDescriptionID = 'nexus-contact-char-count';

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

  if(localhost.test(host)){
    formKey = '<KEY>';
  }
}

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

  e.preventDefault();
  $('button', $nexusForm).prop('disabled',true);
  if(3000 < charCount) {
    showMsgError('#nexus-alert-modal-error',  charCount);
    return false;
  }
  $.ajax({
    dataType: 'jsonp',
    url: "https://getsimpleform.com/messages/ajax?form_api_token="+formKey,
    data: $nexusForm.serialize()
  }).done(function() {
		//callback shows the 'thank you message'
    showMsgSuccess('#nexus-alert-modal');
  });
  return false; //to stop the form from submitting
});

function showMsgSuccess($modalAlert){
  // Show message
  $($modalAlert).modal();
  $nexusForm.trigger("reset");//clear on success
  $('button', $nexusForm).prop('disabled',false);
}

function showMsgError(id, charCount){
  $('#nexus-text-overflow-message').append('<span id="'+errorDescriptionID+'"> Current count is '+charCount+'</span>');
  $(id).modal();
}

function initListeners() {
	$btnAlertOk.on('click', function () {
		$modalAlert.modal('hide');
	});

	$btnAlertError.on('click', function () {
		$modalAlertError.modal('hide');

		$('#' + errorDescriptionID).remove();
		$('button', $nexusForm).attr('disabled', false);
	});
}

checkKey(formKey);

initListeners();

<commit_msg>fix redirection emails on nexus form<commit_after>var $nexusForm = $('.js_nexus_form'),
  $modalAlert = $('#nexus-alert-modal'),
  $modalAlertError = $('#nexus-alert-modal-error'),
  $btnAlertOk = $modalAlert.find('#js_nexus_btn_alert_ok'),
  $btnAlertError = $modalAlertError.find('#js_nexus_btn_alert_ok-error'),
  $textAreaDescription = $('#company-detail-text'),
  formKey = '<KEY>',
	errorDescriptionID = 'nexus-contact-char-count';

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

  if(localhost.test(host)){
    formKey = '<KEY>';
  }
}

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

  e.preventDefault();
  $('button', $nexusForm).prop('disabled',true);
  if(3000 < charCount) {
    showMsgError('#nexus-alert-modal-error',  charCount);
    return false;
  }
  $.ajax({
    dataType: 'jsonp',
    url: "https://getsimpleform.com/messages/ajax?form_api_token="+formKey,
    data: $nexusForm.serialize()
  }).done(function() {
		//callback shows the 'thank you message'
    showMsgSuccess('#nexus-alert-modal');
  });
  return false; //to stop the form from submitting
});

function showMsgSuccess($modalAlert){
  // Show message
  $($modalAlert).modal();
  $nexusForm.trigger("reset");//clear on success
  $('button', $nexusForm).prop('disabled',false);
}

function showMsgError(id, charCount){
  $('#nexus-text-overflow-message').append('<span id="'+errorDescriptionID+'"> Current count is '+charCount+'</span>');
  $(id).modal();
}

function initListeners() {
	$btnAlertOk.on('click', function () {
		$modalAlert.modal('hide');
	});

	$btnAlertError.on('click', function () {
		$modalAlertError.modal('hide');

		$('#' + errorDescriptionID).remove();
		$('button', $nexusForm).attr('disabled', false);
	});
}

checkKey(formKey);

initListeners();


{'fraction_non_alphanumeric': 0.1984508547008547, 'fraction_numerical': 0.005876068376068376, 'mean_word_length': 4.963375796178344, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 11, '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': '7237182', 'n_tokens_mistral': 1288, 'n_tokens_neox': 1254, 'n_words': 209}