<commit_before>---
---

// Floating label headings for the contact form
$(function() {
    $("body").on("input propertychange", ".floating-label-form-group", function(e) {
        $(this).toggleClass("floating-label-form-group-with-value", !! $(e.target).val());
    }).on("focus", ".floating-label-form-group", function() {
        $(this).addClass("floating-label-form-group-with-focus");
    }).on("blur", ".floating-label-form-group", function() {
        $(this).removeClass("floating-label-form-group-with-focus");
    });
});

//jqBootstrapValidation
$(function() {
  $("input,textarea").jqBootstrapValidation({
    preventSubmit: true,
    submitError: function($form, event, errors) {
    },
    submitSuccess: function($form, event) {
    },
    filter: function() {
      return $(this).is(":visible");
    },
  });

  $("a[data-toggle=\"tab\"]").click(function(e) {
    e.preventDefault();
    $(this).tab("show");
  });
});

//Formspree
var $contactForm = $('#contactForm');
$contactForm.submit(function (e) {
  e.preventDefault();
  $.ajax({
    url: '//formspree.io/{{ site.email }}',
    method: 'POST',
    data: $(this).serialize(),
    dataType: 'json',
    beforeSend: function() {
      $('#send-button').hide();
      $('#sending').show();
    },
    success: function (data) {
      $('#sending').hide();
      $('#sent-success').show();
      $('.input-element').hide();
    },
    error: function (err) {
      $('#sending').hide();
      $('#sent-error').show();
      $('#send-button').show();
    }
  });
});<commit_msg>made contact section work with jqBootstrapValidation, Formspree and Ajax<commit_after>---
---

// Floating label headings for the contact form
$(function() {
    $("body").on("input propertychange", ".floating-label-form-group", function(e) {
        $(this).toggleClass("floating-label-form-group-with-value", !! $(e.target).val());
    }).on("focus", ".floating-label-form-group", function() {
        $(this).addClass("floating-label-form-group-with-focus");
    }).on("blur", ".floating-label-form-group", function() {
        $(this).removeClass("floating-label-form-group-with-focus");
    });
});

//jqBootstrapValidation + Formspree + Ajax
$(function() {
  $("input,textarea").jqBootstrapValidation({
    preventSubmit: true,
    submitError: function($form, event, errors) {
      console.log("submitError!")
    },
    submitSuccess: function($form, event) {
      console.log("submitSuccess!!!")
      event.preventDefault();
      $.ajax({
        url: '//formspree.io/{{ site.email }}',
        method: 'POST',
        data: $(this).serialize(),
        dataType: 'json',
        beforeSend: function() {
          $('#send-button').hide();
          $('#sending').show();
        },
        success: function (data) {
          $('#sending').hide();
          $('.input-element').fadeOut(1000, function() {
            $('#sent-success').show();
          });
       },
        error: function (err) {
          $('#sending').hide();
          $('#sent-error').show();
          $('#send-button').show();
        }
      });
    },
    filter: function() {
      return $(this).is(":visible");
    },
  });

  $("a[data-toggle=\"tab\"]").click(function(e) {
    e.preventDefault();
    $(this).tab("show");
  });
});
{'fraction_non_alphanumeric': 0.23306894447834045, 'fraction_numerical': 0.0012202562538133007, 'mean_word_length': 2.830607476635514, 'pattern_counts': {'":': 2, '<': 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': '2826381', 'n_tokens_mistral': 1027, 'n_tokens_neox': 1019, 'n_words': 157}