{"size": 1996, "ext": "js", "max_stars_repo_path": "frontend/web/js/main.js", "max_stars_repo_name": "PolinaTimofeeva/Advertising-yii", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "frontend/web/js/main.js", "max_issues_repo_name": "PolinaTimofeeva/Advertising-yii", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "frontend/web/js/main.js", "max_forks_repo_name": "PolinaTimofeeva/Advertising-yii", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": null, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 24.0481927711, "max_line_length": 64, "alphanum_fraction": 0.3957915832}
$(document).ready(function() {

    // Menu


    $('.header__burger').on('click', function() {
        $('.nav__mobile').fadeIn('fast');
        $('.nav__mobile').css({display:'flex'});
    });

    $(".nav__close").on("click", function() {
            $(".nav__mobile").fadeOut('fast');
    });


    // Modal window

    $('.modal__trigger').on('click', function() {
        $('.modal').fadeIn('fast');
        $('.modal').css({display:'flex'});
    });


    $(".modal, .modal__close").on("click", function (e) {
        if (e.target == this) {
            $(".modal").fadeOut('fast');
        };
    });



    // Ajax 

    $('#form2').on('submit', function (e) {
        $.ajax({
            url: "/site/send-form",
            type: "POST",
            data: $(this).serialize(),
            beforeSend: function() {
                $('.modal__btn').css('disabled', true);
            },
        }).done(function(r) {
             console.log(r);
            if (r.status === 'error') {
                console.log(r);
            } else {
                $('.modal__window').fadeOut('fast', function() {
                    $('.thanks__modal').fadeIn('fast');
                    $('.modal').css({display:'flex'});
                })
            }
        });
        e.preventDefault();
    })



    $('#form1').on('submit', function (e) {
        $.ajax({
            url: "/site/send-form",
            type: "POST",
            data: $(this).serialize(),
            beforeSend: function() {
                $('.footer__btn').css('disabled', true);
            },
        }).done(function(r) {
             console.log(r);
            if (r.status === 'error') {
                console.log(r);

            } else {
                $('.modal__window').fadeOut('fast', function() {
                    $('.thanks__modal').fadeIn('fast');
                    $('.modal').css({display:'flex'});
                })
            }
        });
        e.preventDefault();
    })
 

});  
