PageSourceSearch

https://bsaward.ru/local/templates/BlackMain2024/js/main_request.js

js bsaward.ru collected 2026-09-24 21:47:05 UTC 18,538 bytes, 577 lines download raw bytes

1$(document).ready(function(){
2
3    const mainForm = $('#reg-bs-form');
4    const mainFormSecond = $('#reg-bs-form-second');
5
6    mainFormSecond.on('click', '.form__button', (e) => {
7        e.preventDefault();
8        let newValid = true;
9        mainForm.find('input[name="name"], input[name="phone"], input[name="email"]').each(function () {
10            if ($(this).val() === '') {
11                newValid = false;
12            }
13        });
14
15        if (newValid === true) {
16            $.ajax({
17                url: "/local/templates/BlackVersion2025/include/registration/reg.php",
18                type: "POST",
19                data: mainForm.serialize(),
20                dataType: "html",
21                success: function (data) {
22                    console.log(data);
23                    if (data == 'registr') {
24                        window.location.href = "https://bsaward.ru/thanks/";
25                    }
26                }
27            });
28        }
29    })
30
31    mainForm.on('click', '.form__button', (e) => {
32        e.preventDefault();
33        let newValid = true;
34        mainForm.find('input[name="name"], input[name="phone"], input[name="email"]').each(function () {
35            if ($(this).val() === '') {
36                newValid = false;
37            }
38        });
39
40        if (newValid === true) {
41            $.ajax({
42                url: "/local/templates/BlackVersion2025/include/registration/reg.php",
43                type: "POST",
44                data: mainForm.serialize(),
45                dataType: "html",
46                success: function (data) {
47                    console.log(data);
48                    if (data == 'registr') {
49                        window.location.href = "https://bsaward.ru/thanks/";
50                    }
51                }
52            });
53        }
54    })
55
56    $('.transfer').on('click', (e) => {
57        e.preventDefault()
58        let input = $(e.currentTarget.closest('form')).find('input'),
59            inputFormOne = mainForm.find('input'),
60            inputFormSecond = mainFormSecond.find('input'),
61            obj = {};
62
63        for (const inputElement of input) {
64            if (inputElement.value) {
65                obj[inputElement.name] = inputElement.value
66            }
67        }
68
69        for (const inputElementOne of inputFormOne) {
70            if (obj[inputElementOne.name]) {
71                inputElementOne.value = obj[inputElementOne.name];
72            }
73        }
74
75        for (const inputElementSecond of inputFormSecond) {
76            if (obj[inputElementSecond.name]) {
77                inputElementSecond.value = obj[inputElementSecond.name];
78            }
79        }
80        $.fancybox.open({
81            src: '#popup-register',
82            type: 'inline'
83        });
84    });
85
86    $('[name*=phone]').inputmask('+7 (999) 999-99-99');
87    $('.bsdate').inputmask({ alias: "datetime", inputFormat: "dd.mm.yyyy", placeholder: "ää.ìì.ãããã" });
88    $('[name=birthdate]').inputmask({ alias: "datetime", inputFormat: "dd.mm.yyyy", placeholder: "ää.ìì.ãããã" });
89    $('[name=b_date]').inputmask({ alias: "datetime", inputFormat: "dd.mm.yyyy", placeholder: "ää.ìì.ãããã" });
90
91    $.fn.hasAttr = function(name) {
92        return this.attr(name) !== undefined;
93    };
94
95
96    const checkCyr = (inputField) => {
97        let regexp = /[^À-ßà-ÿ¸¨\-\sÀ-ßà-ÿ¸¨\-\sÀ-ßà-ÿ¸¨]/g;
98
99        if(inputField.val().match(regexp)) {
100            inputField.val( inputField.val().replace(regexp,'') );
101            $('.error-cyr').show();
102            inputField.addClass('error');
103        } else {
104            $('.error-cyr').hide();
105            inputField.removeClass('error');
106        }
107    }
108
109    const autoRegion = () => {
110        if($('[name=region]').val() == null) {
111            $.ajax({
112                url: "/local/scripts/request/dadata_region.php",
113                type: "POST",
114                data: '',
115                dataType: "html",
116                success: function(data) {
117                    $('[name=region]').val(data);
118                }
119            });
120        }
121    }
122
123
124    const autoCity = () => {
125        if($('[name=city]').val() == '' && window.location.href != 'https://bsaward.ru/2021/yanao/') {
126            $.ajax({
127                url: "/local/scripts/request/dadata_city.php",
128                type: "POST",
129                data: '',
130                dataType: "html",
131                success: function(data) {
132                    $('[name=city]').val(data);
133                }
134            });
135        }
136    }
137
138    $('[name=name]').on('input', function () {
139        checkCyr($(this));
140    });
141
142    $('[name=city]').on('input', function () {
143        checkCyr($(this));
144    });
145
146    $('[name=name]').on('input', function () {
147        checkCyr($(this));
148    });
149
150
151    $('[name=email]').on('keyup', function(){
152        if($(this) != '' ) {
153            $.ajax({
154                url: "/local/templates/BlackVersion2025/include/registration/email_check.php",
155                type: "POST",
156                data: 'email=' + $(this).val() + '&id=' + $('#forum_id').val(),
157                dataType: "json",
158                success: function (data) {
159                    if (data == 'true') {
160                        $('.error-email').show();
161                    } else {
162                        $('.error-email').hide();
163                    }
164
165                }
166            });
167        }
168    });
169
170    let phpEmail = $('[name=email]').val();
171
172    if(phpEmail != '') {
173        $.ajax({
174            url: "/local/templates/land2019/include/email_check_new.php",
175            type: "POST",
176            data: 'email='+$(this).val()+'&id='+$('#forum_id').val(),
177            dataType: "json",
178            success: function (data) {
179
180                if(data == 'true') {
181                    //$('input[name=email]').val('');
182                    $('.error-email').show();
183                }
184                else {
185                    $('.error-email').hide();
186                }
187
188            }
189        });
190    }
191
192    $('.personalRequest').on('click', function (){
193        $('p').each(function () {
194            $(this).removeAttr('required');
195        });
196    });
197
198    $('#lifestatus').on('change', function(){
199        $('[class *= "-status"]').each(function () {
200            $(this).hide();
201            if($(this).hasAttr('name')) $(this).removeAttr('required');
202        });
203        let getStatus = $(this).val();
204
205        if(getStatus != 'p' || getStatus != 'ip' || getStatus != 'ur') {
206            $('.personalRequest').hide();
207            $('input[name=personalRequest]').removeAttr("checked");
208
209            $('.legal, .individual').hide();
210            $('.legal, .individual').removeAttr('required');
211
212        }
213
214        $('#yanao_status').val($('#lifestatus option:checked').text());
215
216        $('.'+getStatus+'-status').each(function () {
217            $(this).show();
218            if($(this).hasAttr('name') !== false) $(this).attr('required', 'required');
219        });
220
221
222        if(getStatus == 's') {
223            $('#company-text').text('Ââåäèòå íàçâàíèå âàøåãî ó÷åáíîãî çàâåäåíèÿ');
224        } else {
225            $('#company-text').text('Íà÷íèòå ââîäèòü íàçâàíèå âàøåé êîìïàíèè è âûáåðèòå åå èç ñïèñêà èëè ââåäèòå ÈÍÍ è âûáåðèòå èç ñïèñêà');
226        }
227
228        if(getStatus == 'p')
229            $('.birthday').show();
230        else
231            $('.birthday').hide();
232
233
234        autoRegion();
235        autoCity();
236
237    });
238
239    let variant = $('.variant');
240
241    const setRequestChoice = () => {
242        $('#lifestatus option[value=p]').attr("selected", "selected");
243        $('#party').show();
244        $('[name="region"]').show();
245        $('[name="city"]').show();
246        $('[name="company_site"]').show();
247        $('#var-request').addClass('active');
248        $('#var-forum').removeClass('active');
249        $('.birthday').show();
250        $('.birthday input').attr('required', 'required');
251        $('.postament').hide();
252
253        if($(window).innerWidth() > 800) {
254            $('.request-text').show();
255            $('.forum-text').hide();
256        } else {
257            $('.request-text-mobile').show();
258            $('.forum-text-mobile').hide();
259        }
260
261        autoRegion();
262        autoCity();
263    }
264
265    const setMediaChoice = () => {
266        $('#lifestatus option[value=zh]').attr("selected", "selected");
267        $('#party').show();
268        $('[name="position"]').show();
269        $('[name="region"]').show();
270        $('[name="city"]').show();
271        $('.btstr').hide();
272        $('.postament').show();
273
274        // if($(window).innerWidth() > 800) {
275        //     $('.request-text').show();
276        //     $('.forum-text').hide();
277        // } else {
278        //     $('.request-text-mobile').show();
279        //     $('.forum-text-mobile').hide();
280        // }
281
282        autoRegion();
283        autoCity();
284    }
285
286    const setForumChoice = () => {
287        $('#lifestatus option').removeAttr("selected");
288        $('#lifestatus option:first-child').attr("selected", "selected");
289        $('#party').hide();
290        $('#party').val('');
291        $('#inn').val('');
292        $('#kpp').val('');
293        $('#party_header').val('');
294        $('#party_header_status').val('');
295
296        $('[name="region"]').hide();
297        $('[name="city"]').hide();
298        $('[name="company_site"]').hide();
299
300        $('.personalRequest').hide();
301        $('input[name=personalRequest]').removeAttr("checked");
302        $('.legal, .individual').removeAttr('required');
303        $('.legal, .individual').hide();
304        $('#var-forum').addClass('active');
305        $('#var-request').removeClass('active');
306        $('.birthday').hide();
307        $('.birthday input').removeAttr('required');
308        $('.postament').hide();
309
310
311        if($(window).innerWidth() > 800) {
312            $('.request-text').hide();
313            $('.forum-text').show();
314        } else {
315            $('.request-text-mobile').hide();
316            $('.forum-text-mobile').show();
317        }
318    }
319
320    variant.on('click', function() {
321
322        $('input[name=var]').val($(this).attr('data-var'));
323        $('.error-var').hide();
324
325        if($(this).attr('data-var') == 972) {
326            setRequestChoice();
327
328        } else {
329            setForumChoice();
330        }
331
332        return false;
333    });
334
335    const setforum = $('.setforum');
336
337    setforum.on('click', function() {
338        setForumChoice();
339    });
340
341    const setmedia = $('.setmedia');
342
343    setmedia.on('click', function() {
344        setMediaChoice();
345    });
346
347    const setrequest = $('.setrequest');
348
349    setrequest.on('click', function() {
350        setRequestChoice();
351    });
352
353    $('#reg-submit').on('click', function () {
354
355        let Validated = true;
356
357        $('#reg-bs-form [required]').each(function () {
358
359            if ($(this).attr('name') == 'var') {
360                if ($(this).val() == '') {
361                    Validated = false;
362                    $('.error-var').show();
363                } else {
364                    Validated = true;
365                    $('.error-var').hide();
366                }
367            }
368
369            if ($(this).attr('name') == 'phone2' || $(this).attr('name') == 'phone3') {
370                let str = parseInt($(this).val().replace(/\D+/g, ""));
371                str = String(str);
372                if (str.length != 11) {
373                    $(this).addClass('error');
374                    $('.error-phone').show();
375                    Validated = false;
376                } else {
377                    $('.error-phone').hide();
378                    $(this).removeClass('error');
379                    Validated = true;
380                }
381            }
382
383            if ($(this).attr('name') == 'email') {
384                if (ValidateEmail($(this).val()) == false) {
385                    Validated = false;
386                    $('.error-valid-email').show();
387                } else {
388                    Validated = true;
389                    $('.error-valid-email').hide();
390                }
391            }
392
393            if ($(this).val() == null || $(this).val().length < 1) {
394                Validated = false;
395                $(this).addClass('error');
396                $(this).next('span').show();
397            } else {
398                $(this).removeClass('error');
399                $(this).next('span').hide();
400            }
401
402
403        });
404
405
406        if (Validated == true) {
407            $('#reg-submit').hide();
408            $('#sending').show();
409
410            $.ajax({
411                url: "/local/templates/BlackVersion2025/include/registration/reg.php",
412                type: "POST",
413                data: mainForm.serialize(),
414                dataType: "html",
415                success: function (data) {
416                    console.log(data);
417                    if (data == 'registr') {
418                        if ($('#onlinepage').val() == 1) {
419                            closeModal();
420                        } else if ($('#webinar').val() == 892) {
421                            openModal('silacheck');
422                            $('input[name=email-sila-chk]').val($('#email').val());
423                            $('#sending-webinar').hide();
424                            $('.registration-check-webinar').show();
425                            $('input[name=email-sila-chk]').val($('#email').val());
426
427                            $.ajax({
428                                url: "/scripts/check_webinar_list.php",
429                                type: "POST",
430                                data: 'email=' + $('input[name=email-sila-chk]').val(),
431                                dataType: "html",
432                                success: function (data) {
433                                    console.log(data);
434
435                                    if (data != 'false') {
436                                        $('#webinar_list').html(data);
437                                    }
438
439                                }
440                            });
441
442                            $.ajax({
443                                url: "/local/templates/BlackVersion2020/include/cookie/cookiewebinar.php",
444                                type: "POST",
445                                data: 'email=' + $('#reg-bs-form input[name=email]').val(),
446                                dataType: "html",
447                                success: function (data) {
448                                }
449                            });
450
451
452                        } else {
453                            openModal('tyforreg');
454                        }
455
456                        $.ajax({
457                            url: "/local/templates/BlackVersion2020/include/cookieonline.php",
458                            type: "POST",
459                            data: '',
460                            dataType: "html",
461                            success: function (data) {
462                            }
463                        });
464
465                        mainForm[0].reset();
466                        $('#sending').hide();
467                        $('#reg-submit').show();
468                    }
469
470                    if (data == 'clon') {
471                        $('.reg-button').show();
472                        $('.registr-block').show();
473                        $('#sending').hide();
474                        $('.error-email').show();
475                    }
476
477                }
478            });
479        } else {
480            $('.registration-form').animate({
481                scrollTop: $(".error:first").offset().top
482            }, 1000);
483        }
484
485
486        return false;
487
488
489    });
490
491
492    let checkUserExist = () => {
493
494        if(ValidateEmail($('#reg-online-start').find('input').val()) == false) {
495
496            $('.error-valid-email').show();
497        } else {
498
499            // $('input[name=email-sila-chk]').val($('#reg-online-start').find('input').val());
500
501            $('.error-valid-email').hide();
502            $('.registration-check-usr').hide();
503            $('#sending-online').show();
504
505            $.ajax({
506                url: "/local/templates/BlackVersion2020/include/check/is_user_registr.php",
507                type: "POST",
508                data: 'email='+$('#reg-online-start').find('input').val(),
509                dataType: "html",
510                success: function (data) {
511
512                    if(data == 'ok') {
513                        closeModal();
514                        $('input[name=email-sila-chk]').val( $('input[name=email-online-chk]').val());
515                        $.ajax({
516                            url: "/local/templates/BlackVersion2020/include/cookieonline.php",
517                            type: "POST",
518                            data: '',
519                            dataType: "html",
520                            success: function (data) {}
521                        });
522
523                        $.ajax({
524                            url: "/scripts/check_webinar_list.php",
525                            type: "POST",
526                            data: 'email='+ $('#reg-online-start').find('input').val(),
527                            dataType: "html",
528                            success: function (data) {
529                                if(data == 'false') {
530                                    $('#webinar-button').css('display', 'none');
531                                    $('#allreadyregistr').css('display', 'inline-flex');
532                                } else {
533                                    $('#webinar_list').html(data);
534                                    $('#webinar-button').css('display', 'inline-flex');
535                                    $('#allreadyregistr').css('display', 'none');
536
537                                }
538
539                            }
540                        });
541
542
543                        window.dontshowagain = {
544                            status: true
545                        };
546                    }
547                    else {
548                        $('#email').val($('#reg-online-start').find('input').val());
549                        openModal('regfinal');
550                        $('.registration-form-subtitle').hide();
551                        $('.closemodal').hide();
552                    }
553
554                }
555            });
556        }
557
558    }
559
560    $('.registration-check-usr').on('click', checkUserExist);
561
562
563    $('.top-form input[name=name]').on("change", function(){
564        $('#reg-bs-form input[name=fio]').val($(this).val());
565    })
566
567    $('.top-form input[name=phone3]').on("change", function(){
568        $('#reg-bs-form input[name=phone2]').val($(this).val());
569    })
570
571    $('.top-form input[name=email]').on("change", function(){
572        $('#reg-bs-form input[name=email]').val($(this).val());
573    })
574
575})
576
577

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.