PageSourceSearch

https://www.livextension.com/wp-content/themes/lx16/js/form.js?v=1791597518

js livextension.com collected 2026-10-10 01:58:44 UTC 3,406 bytes, 133 lines download raw bytes

1$(document).ready(function(){
2
3$( ".ajax-form" ).submit(function( e ) {
4
5    formElem = $(this); 
6    e.preventDefault();
7
8    $('span.error').hide();
9
10    var hasError = false;
11
12    formElem.find('.requiredField, .checkfield').each(function() {
13  
14    var field = $(this);
15    var labelError = field.parents('li').find('span.error');
16
17
18
19  if( field.hasClass('requiredField') ) {
20
21        if( field.is('[type=checkbox]')){
22              if (!field.is(":checked")) {
23            labelError.show();
24            hasError = true;
25
26              }
27         }
28          else  { 
29
30      if ( $.trim($(this).val()) == '' ) {
31            labelError.show();
32            hasError = true;
33         } 
34      }
35    }
36
37
38
39   if( field.hasClass('email')) {
40    
41    
42    // var emailReg = /^([w-.]+@([w-]+.)+[w-]{2,4})?$/;
43    var  emailValid = isValidEmailAddress( jQuery.trim($(this).val()) );
44    
45    if(!emailValid) {
46    var labelError = field.parents('li').find('span.error');
47     labelError.show();
48     hasError = true;
49    }
50   }
51   
52 if ( field.hasClass('phone') ) {
53
54    var phone =   jQuery.trim($(this).val());
55
56    if ( phone == "" ) {
57            var phoneValid = true;
58            }
59        else {
60            var phoneValid = isValidPhone( phone );
61
62        }
63               
64    if ( phoneValid == false) {
65
66    var labelError = field.parents('li').find('span.error');
67     labelError.show();
68     hasError = true;
69
70        }   
71   
72   
73    }
74  });
75
76
77
78if(!hasError) {
79
80    formElem.find('li.buttons button').fadeOut('normal', function() {
81    $(this).parent().append('<img src="'+themeDir+'/images/loading.gif" alt="Loading…" height="32" width="32" />');
82   });
83  
84   var formInput = $(this).serialize();
85
86
87      jQuery.ajax({
88         type : "post",
89         dataType : "json",
90         url : $(this).attr('action'),
91         data: formInput,
92         success: function(response) {
93         
94         formElem.addClass('formdone');
95            if(response.success == 1) {
96                $('#message-sent-ok').show();
97             }
98            else {
99                $('#message-sent-error').show();
100           }
101         }
102      })  
103
104
105
106  }
107
108
109
110 
111
112   });
113   
114
115  function isValidPhone(phone){
116  phoneNumber = phone.split(" ").join("");
117
118var re = /^(\+|\+0|0)?\d{6,14}$/;
119if (phoneNumber.match(re)) {
120    return true;
121    } else {
122    return false;
123    }
124  
125
126}
127
128  function isValidEmailAddress(emailAddress) {
129      var pattern = new RegExp(/^((([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+(\.([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+)*)|((\x22)((((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(([\x01-\x08\x0b\x0c\x0e-\x1f\x7f]|\x21|[\x23-\x5b]|[\x5d-\x7e]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(\\([\x01-\x09\x0b\x0c\x0d-\x7f]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]))))*(((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(\x22)))@((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?$/i);
130      return pattern.test(emailAddress);
131  };
132
133});

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.