PageSourceSearch

https://synapseworks.ai/wp-content/themes/montserrat/js/montserrat-contact-form.js?ver=6.8.10

js synapseworks.ai collected 2026-10-05 14:44:40 UTC 3,173 bytes, 77 lines download raw bytes

1(function($){
2
3    var valid = "invalid";
4    function validateValue($value, $target, $email){
5        if ($email == true) {
6            var n = $value.indexOf("@");
7            var r = $value.lastIndexOf(".");
8            if (n < 1 || r < n + 2 || r + 2 >= $value.length) {
9                valid =  "invalid";
10            } else {
11                valid = "valid";
12            }
13            
14            if ($value == null || $value == "" || valid == "invalid") {
15                $target.addClass('visible');
16            } else {
17                $target.removeClass('visible');
18            }
19
20        } else {
21            if ($value == null || $value == "") {
22                $target.addClass('visible');
23            } else {
24                $target.removeClass('visible');
25            }
26        }
27    };
28
29    $('.montserrat-contact-form').each(function(){
30
31        var $this = $(this);
32
33        $this.find(".montserrat-contact-form-submit").click(function(event) {
34            event.preventDefault();
35            var name  = $this.find(".montserrat-contact-form-name").val();
36            var email = $this.find(".montserrat-contact-form-email").val();
37            var msg   = $this.find(".montserrat-contact-form-mgs").val();
38
39            validateValue(name, $this.find(".montserrat-contact-form-name-valid"));
40            validateValue(email, $this.find(".montserrat-contact-form-email-valid"), true);
41            validateValue(msg, $this.find(".montserrat-contact-form-msg-valid"));
42            
43            if (name != "" && email != "" && msg != "" && valid == "valid") {
44                $this.find(".sending").addClass('visible');
45                $.ajax({
46                    type: "POST",
47                    url: montserrat_contact_form_ajax.montserrat_contact_form_ajaxurl,
48                    data: {
49                        action: "montserrat_contact_form_send",
50                        name: name,
51                        email: email,
52                        mgs: msg
53                    },
54                    success: function() {
55                        $this.find(".montserrat-contact-form-submit-success").addClass('visible');
56                        $this.find(".sending").removeClass('visible');
57                        setTimeout(function(){
58                            $this.find(".montserrat-contact-form-submit-success").fadeOut(300,function(){
59                                $(this).removeClass('visible');
60                            });
61                        },3000);
62                    },
63                    error: function() {
64                        $this.find(".montserrat-contact-form-submit-error").addClass('visible');
65                        $this.find(".sending").removeClass('visible');
66                        setTimeout(function(){
67                            $this.find(".montserrat-contact-form-submit-error").fadeOut(300,function(){
68                                $(this).removeClass('visible');
69                            });
70                        },3000);
71                    }
72                })
73            }
74        });
75    });
76
77})(jQuery);

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.