PageSourceSearch

https://goai.ru/mail.js

js goai.ru collected 2026-10-06 07:05:43 UTC 5,459 bytes, 100 lines download raw bytes

1var hide = 0; // 1 - прятать форму после отправки (0 - не прятать)
2var delay = 3000; // задержка исчезновения сообщения в миллисекундах (0 - не скрывать)
3var redirect = ''; // страница, на котороую перейти после отправки (оставить пустым чтоб никуда не переходить)
4var recaptcha_site_key = ''; // ключ сайта для Recaptcha
5var success_msg = "Ваше сообщение отправлено!"; // сообщение об успешной отправке
6var error_msg = "Ошибка отправки! Попробуйте позже."; // сообщение об ошибке
7var wait_msg = 'Идет отправка...'; // сообщение об отправке (оставить пустым чтоб не показывать)
8var action = $('[src $= mail\\.js]').attr('src').replace('js','php'); // путь к скрипту отправки почты
9
10var selector = 'form', form_ids = [], cur_id = '', success_original = false;
11$(selector).each(function(indx){
12  if($(this).attr('action') === undefined){
13    $(this).attr('action', '/').attr('method', 'post');
14    cur_id = $(this).attr('id');
15    if( cur_id === undefined ) {
16      cur_id = 'form_id_'+form_ids.length;
17      $(this).attr('id', cur_id);
18    }else if(form_ids.indexOf(cur_id) !== -1){
19  		cur_id = cur_id+'_'+form_ids.length;
20  		$(this).attr('id', cur_id);
21  	}
22  	form_ids.push(cur_id);
23    $(this).find('.g-recaptcha').attr('data-sitekey', recaptcha_site_key);
24  }
25});
26
27$(function(){
28  $(selector+'[action = "/"]').submit(function(e) {
29
30    cur_id = '#'+$(this).attr('id');
31    if($(cur_id).attr('data-hide') !== undefined){ hide = parseInt($(cur_id).attr('data-hide')); }
32    if($(cur_id).attr('data-delay') !== undefined){ delay = parseInt($(cur_id).attr('data-delay')); }
33    cur_success = $(cur_id).siblings('.w-form-done').text().trim();
34    if(cur_success !== 'Thank you! Your submission has been received!'){ success_msg = cur_success; success_original = true; }
35    cur_error = $(cur_id).siblings('.w-form-fail').text().trim();
36    if(cur_error !== 'Oops! Something went wrong while submitting the form'){ error_msg = cur_error; }
37    cur_wait = $(cur_id).find('[data-wait]').attr('data-wait'); if(cur_wait !== 'Please wait...'){ wait_msg = cur_wait; }
38    cur_redirect = $(cur_id).attr('data-redirect'); if(cur_redirect !== undefined){ redirect = cur_redirect; }
39    cur_action = $(cur_id).attr('action'); if(cur_action !== '/'){ action = cur_action; }
40    submit_div = $(cur_id).find('[type = submit]');
41    submit_txt = submit_div.attr('value');
42    if(wait_msg !== ''){ submit_div.attr('value', wait_msg); }
43    if($(cur_id).attr('data-send') !== undefined){ $('<input type="hidden" name="sendto" value="'+$(cur_id).attr('data-send')+'">').prependTo(cur_id); }
44    $('<input type="hidden" name="Форма" value="'+$(cur_id).attr('data-name')+'">').prependTo(cur_id);
45    $('<input type="hidden" name="Страница" value="'+document.location.href+'">').prependTo(cur_id);
46    $('<input type="hidden" name="required_fields">').prependTo(cur_id);
47    required_fields = '';
48    $(cur_id).find('[required=required]').each(function(){
49      required_fields = required_fields + ',' + $(this).attr('name');
50    });
51    $(cur_id).find('[name=required_fields]').val(required_fields);
52    e.preventDefault();
53    var formData = new FormData($(cur_id)[0]);
54    $.ajax({
55      url: action,
56      type: 'POST',
57      processData: false,
58      contentType: false,
59      data: formData
60    })
61    .done(function( result ) {
62      if(result == 'success'){
63        if(redirect !== '' && redirect !== '/-') { document.location.href = redirect; return(true); }
64        $(cur_id).siblings('.w-form-fail').hide();
65        replay_class = '.w-form-done';
66        replay_msg = success_msg;
67      } else {
68        $(cur_id).siblings('.w-form-done').hide();
69        result === 'ERROR_REQUIRED' ? replay_msg = 'Не заполнено обязательное поле!' : replay_msg = error_msg;
70        result === 'ERROR_RECAPTCHA' ? replay_msg = 'Подтвердите, что вы не робот!' : replay_msg = error_msg;
71        replay_class = '.w-form-fail';
72      }
73      replay_div = $(cur_id).siblings(replay_class);
74      if( !success_original ) replay_div.find('div').text(replay_msg);
75      replay_div.show();
76      if(hide){$(cur_id).hide();}
77      submit_div.attr('value', submit_txt);
78      if(delay !== 0) { replay_div.delay(delay).fadeOut(); }
79      if(result == 'success'){$(cur_id).trigger("reset");}
80  });
81  });
82  $('textarea').val('');
83});
84
85$('.w-form [data-name]').each(function(indx){$(this).attr('name', $(this).attr('data-name'));});
86
87$('label[for^=file]').each(function() {
88  file_id = $(this).attr('for');
89  $(this).after('<input name="file[]" type="file" id="' + file_id + '" multiple style="display:none;">');
90  $(this).siblings('div[for]').each(function(){
91    $(this).hide();
92    $(this).attr('data-pattern', $(this).text());
93  });
94  $('input#' + file_id).change(function() {
95    file_name = $(this).val().replace('C:\\fakepath\\', "");
96    file_text = $(this).siblings('div[for]').attr('data-pattern').replace('%file%', file_name);
97    if(file_text.trim() === '') file_text = 'Файл прикреплен.';
98    $(this).siblings('div[for]').text(file_text).show();
99  });
100});

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.