PageSourceSearch

https://chateaudetalu.ru/local/components/uniqtrip/forms/templates/calendar-form/script.js

js chateaudetalu.ru collected 2026-10-06 22:59:24 UTC 3,368 bytes, 98 lines download raw bytes

1$(document).ready(function () {
2
3    const modalAjaxCalendarForm = new Modal({
4        modalBtns: '[data-modal-form]',
5        modalCloseBtns: '.js-modal-form-close',
6        modals: '.js-modal-form',
7    });
8
9
10    const validatorCalendarForm = new FormValidator({
11        alerts: true,
12        events: false,
13        regex: {
14            tel: /_/,
15            time: /^([0-1][0-9]|2[0-3]):[0-5][0-9]$/,
16        },
17        texts: {
18            invalid: 'Неверно заполнено поле',
19            checked: 'Заполните поле',
20            empty: 'Заполните поле',
21            select: 'Выберите значение',
22            email: 'Неверно заполнено поле',
23            phone: 'Поле заполнено не до конца'
24        },
25    }, "#calendarForm");
26
27    $("[data-modal-form='calendar-form']").click(function (event) {
28        modalAjaxCalendarForm.openModal(event);
29
30        const modalElement = $("#calendar-form");
31        const inputs = modalElement.find('input');
32        formContent = modalElement.find('.form-content')[0];
33        formMessage = modalElement.find('.form-message')[0];
34        formMessageError = modalElement.find('.form-message-error')[0];
35
36        formMessage.classList.remove('active');
37        formMessageError.classList.remove('active');
38
39        [...inputs].forEach(input => {
40            if (input.tagName === 'TEXTAREA' && input.getAttribute('placeholder') != null) {
41                input.classList.add('changed');
42            } else {
43                if (input.value === '') {
44                    input.classList.remove('changed');
45                } else {
46                    input.classList.add('changed');
47                }
48            }
49        });
50        if (formContent) formContent.classList.add('active');
51    });
52
53    $("#calendarForm").submit(function( event ) {
54        event.preventDefault();
55
56        const form = $("#" + event.target.id);
57        const data = form.serialize();
58
59        const validatorResult = validatorCalendarForm.checkAll(this);
60
61        if (validatorResult.valid) {
62            $("#spinner-on").addClass("open-loader");
63            sendFormsCalendarForm(data);
64        }
65        return false;
66    })
67});
68
69function sendFormsCalendarForm(dataForm) {
70    let data = {};
71    data.fields = dataForm;
72    data.className = 'EventCalendarDataManager';
73
74    BX.ajax.runComponentAction('uniqtrip:forms',
75        'sendMessage', {
76        mode: 'class',
77        data: {post: data},
78    }).then(function (response) {
79      $("#spinner-on").removeClass("open-loader");
80        const modalElement = $("#calendar-form");
81        const form = modalElement.find('.modal-custom__body');
82        formContent = modalElement.find('.form-content')[0];
83        formMessage = modalElement.find('.form-message')[0];
84        formMessageError = modalElement.find('.form-message-error')[0];
85
86        if (!response.data.result) {
87            if (formMessageError) formMessageError.classList.add('active');
88            form.addClass('error-message'); //для сброса формы
89        } else {
90            if (formMessage) formMessage.classList.add('active');
91            form.addClass('message'); //для сброса формы
92        }
93
94        if (formContent) formContent.classList.add('hide');
95
96        }, function (response) {
97    });
98}

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.