PageSourceSearch

https://travel30.ru/js/guestbook.js

js travel30.ru collected 2026-10-02 22:29:16 UTC 3,562 bytes, 110 lines download raw bytes

1function isEmail(str) {
2   var supported = 0;
3   if (window.RegExp) {
4   var tempStr = "a";
5   var tempReg = new RegExp(tempStr);
6   if (tempReg.test(tempStr)) supported = 1;
7   }
8   if (!supported)
9   return (str.indexOf(".") > 2) && (str.indexOf("@") > 0);
10   var r1 = new RegExp("(@.*@)|(\\.\\.)|(@\\.)|(^\\.)");
11   var r2 = new
12   RegExp("^.+\\@(\\[?)[a-zA-Z0-9\\-\\.]+\\.([a-zA-Z]{2,3}|[0-9]{1,3})(\\]?)$");
13   return (!r1.test(str) && r2.test(str));
14   }
15
16$(document).ready(function() {
17    
18$('.show_guestbook_form').click(function(event) { 
19    
20        $('.guestbook_form').animate({height: 'toggle'});
21        scrollToBlock('.guestbook_form', 40, 500); 
22        
23        $('.show_guestbook_form').each(function(){
24            $(this).parent().hide(); 
25        });        
26               
27        (event.preventDefault) ? event.preventDefault() : event.returnValue = false; 
28        return false;
29    });    
30
31 $('.guestbook_form input[type="button"]').click(function(){
32
33  var my_value = false;
34  
35  $('.guestbook_form input[type="text"]').removeClass('error');
36  $('.guestbook_form textarea').removeClass('error');
37  
38  var query_name = $('#query_name').val();
39  if ((!query_name)||
40      (query_name && (query_name.search(/[À-ÿ¨¸]/) === -1) )) 
41  	{ $('#query_name').addClass("error"); my_value = true; };
42
43  var query_email = $('#query_email').val();
44  if ((!query_email) ||
45       (query_email && !isEmail(query_email))) { $('#query_email').addClass("error"); my_value = true; };
46       
47  var query_star = $('input[name="query[count_stars]"]').val();
48  if (!query_star)
49  { $('input[name="query[count_stars]"]').prev().addClass("error"); my_value = true; };
50
51  var query_message = $('#query_message').val();
52  if ((!query_message)||
53      (query_message && (query_message.search(/[À-ÿ¨¸]/) === -1) )) 
54	{ $('#query_message').addClass("error"); my_value = true; };
55
56  var query_code = $('#query_code').val();
57  if (!query_code)
58 	{ $('#query_code').addClass("error"); my_value = true; };
59
60  if (!my_value) {
61      
62      $('.guestbook_form input[type="button"]').hide();            
63      
64      $.ajax({
65                type: "POST",
66                data: $(".guestbook_form form").serialize(),
67                url: "/ajax.php?action=guestbook_add_message",
68                dataType: "text",
69                complete: function(data) {                                          
70                    
71                    if (data.responseText == 'OK') {
72                        $('.guestbook_form .guestbook_thanks').show();
73                        $('.guestbook_form form').animate({height: 'toggle'});
74                        $('.show_guestbook_form').parent().hide();                        
75                    }
76                    else
77                    {
78                        console.log(data.responseText);
79                        $('.guestbook_form input[type="button"]').show();
80                        return false;
81                    };                       
82                   
83                }              
84            });   
85      
86  };
87
88});
89
90
91$('form .stars').hover(
92     function() {
93		$(this).prevAll().andSelf().addClass('ratings_over');
94		$(this).nextAll().removeClass('ratings_vote'); 
95		},
96     function() {
97		$(this).prevAll().andSelf().removeClass('ratings_over');
98		}
99	);
100 $('form .stars').bind('click', 
101      function() {
102		 $('.stars').removeClass('ratings_over'); 	
103		 $(this).prevAll().andSelf().addClass('ratings_vote');
104		 $('#count_stars').val($('form .ratings_vote').length);                
105	 });	
106
107});
108
109
110

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.