<commit_before>$(function() {

    $("input,textarea").jqBootstrapValidation({
        preventSubmit: true,
        submitError: function($form, event, errors) {
            // additional error messages or events
        },
        submitSuccess: function($form, event) {
            event.preventDefault(); // prevent default submit behaviour
            // get values from FORM
            var firstname = $("input#firstname").val();
            var lastname = $("input#lastname").val();
            var email = $("input#email").val();
            var zip = $("input#zip").val();
            var reason = $("textarea#message").val();
            // Check for white space in name for Success/Fail message
            if (firstname.indexOf(' ') >= 0) {
                firstname = name.split(' ').slice(0, -1).join(' ');
            }
            $.ajax({
                url: "http://prelaunch.democratech.co/api/petition/sign",
                type: "POST",
                data: {
                    firstname: firstname,
                    lastname: lastname,
                    email: email,
		    postalcode: zip,
                    reason: reason
                },
                cache: false,
                success: function(e) {
		    if (e.result=="success") {
			    // Success message
			    $("#portfolioModal1").modal('show');
			    // Analytics : apparaition popup confirmation
			    ga('send', 'event', 'form', 'validation / ask to share', 'form_validated');
			    //$('#success').html("<div class='alert alert-success'>");
			    //$('#success > .alert-success').html("<button type='button' class='close' data-dismiss='alert' aria-hidden='true'>&times;")
				//.append("</button>");
			    //$('#success > .alert-success')
				//.append("<strong>Merci pour votre soutien. </strong>");
			    //$('#success > .alert-success')
			//	.append('</div>');
		    } else if (e.result=="failure") {
			    // Success message mais on affiche quand meme la popup de success
			    $("#portfolioModal1").modal('show');
			    // Analytics : apparaition popup confirmation
			    ga('send', 'event', 'form', 'error', 'form_error');
			    //$('#success').html("<div class='alert alert-danger'>");
			    //$('#success > .alert-danger').html("<button type='button' class='close' data-dismiss='alert' aria-hidden='true'>&times;")
				//.append("</button>");
			    //$('#success > .alert-danger').append("<strong>Desole " + firstname + ", il y a eu un probleme lors de la signature :( Merci de reessayer plus tard !");
			    //$('#success > .alert-danger').append('</div>');
		    }
                    //clear all fields
		    $('#contactForm').trigger("reset");
                },
                error: function(e) {
                    // Fail message
		       $("#portfolioModal2").modal('show');
                    /*$('#success').html("<div class='alert alert-danger'>");
                    $('#success > .alert-danger').html("<button type='button' class='close' data-dismiss='alert' aria-hidden='true'>&times;")
                        .append("</button>");
                    $('#success > .alert-danger').append("<strong>Desole " + firstname + ", il y a eu un probleme lors de la signature :( Merci de reessayer plus tard !");
                    $('#success > .alert-danger').append('</div>');*/<commit_msg>* reverting le fait qu'on voit la popup success a chaque fois<commit_after>$(function() {

    $("input,textarea").jqBootstrapValidation({
        preventSubmit: true,
        submitError: function($form, event, errors) {
            // additional error messages or events
        },
        submitSuccess: function($form, event) {
            event.preventDefault(); // prevent default submit behaviour
            // get values from FORM
            var firstname = $("input#firstname").val();
            var lastname = $("input#lastname").val();
            var email = $("input#email").val();
            var zip = $("input#zip").val();
            var reason = $("textarea#message").val();
            // Check for white space in name for Success/Fail message
            if (firstname.indexOf(' ') >= 0) {
                firstname = name.split(' ').slice(0, -1).join(' ');
            }
            $.ajax({
                url: "http://prelaunch.democratech.co/api/petition/sign",
                type: "POST",
                data: {
                    firstname: firstname,
                    lastname: lastname,
                    email: email,
		    postalcode: zip,
                    reason: reason
                },
                cache: false,
                success: function(e) {
		    if (e.result=="success") {
			    // Success message
			    $("#portfolioModal1").modal('show');
			    // Analytics : apparaition popup confirmation
			    ga('send', 'event', 'form', 'validation / ask to share', 'form_validated');
			    //$('#success').html("<div class='alert alert-success'>");
			    //$('#success > .alert-success').html("<button type='button' class='close' data-dismiss='alert' aria-hidden='true'>&times;")
				//.append("</button>");
			    //$('#success > .alert-success')
				//.append("<strong>Merci pour votre soutien. </strong>");
			    //$('#success > .alert-success')
			//	.append('</div>');
		    } else if (e.result=="failure") {
			    // Success message mais on affiche quand meme la popup de success
			    $("#portfolioModal2").modal('show');
			    // Analytics : apparaition popup confirmation
			    ga('send', 'event', 'form', 'error', 'form_error');
			    //$('#success').html("<div class='alert alert-danger'>");
			    //$('#success > .alert-danger').html("<button type='button' class='close' data-dismiss='alert' aria-hidden='true'>&times;")
				//.append("</button>");
			    //$('#success > .alert-danger').append("<strong>Desole " + firstname + ", il y a eu un probleme lors de la signature :( Merci de reessayer plus tard !");
			    //$('#success > .alert-danger').append('</div>');
		    }
                    //clear all fields
		    $('#contactForm').trigger("reset");
                },
                error: function(e) {
                    // Fail message
		       $("#portfolioModal2").modal('show');
                    /*$('#success').html("<div class='alert alert-danger'>");
                    $('#success > .alert-danger').html("<button type='button' class='close' data-dismiss='alert' aria-hidden='true'>&times;")
                        .append("</button>");
                    $('#success > .alert-danger').append("<strong>Desole " + firstname + ", il y a eu un probleme lors de la signature :( Merci de reessayer plus tard !");
                    $('#success > .alert-danger').append('</div>');*/
{'fraction_non_alphanumeric': 0.18487645132479905, 'fraction_numerical': 0.0017862459065197975, 'mean_word_length': 2.0320397111913358, 'pattern_counts': {'":': 0, '<': 35, '<?xml version=': 0, '>': 55, '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': '1031149', 'n_tokens_mistral': 1961, 'n_tokens_neox': 1770, 'n_words': 422}