PageSourceSearch

https://ochkarik.ru/local/components/opticvision/forms/templates/optician-reviews/script.js?17858343602604

js ochkarik.ru collected 2026-10-02 02:56:39 UTC 2,604 bytes, 69 lines download raw bytes

1(() => {
2    const initProductReviewsPhoneAgreements = () => {
3        document
4            .querySelectorAll('form.js-form-handler')
5            .forEach((form) => {
6                const action = form.querySelector('input[name="action"]');
7
8                if (
9                    !action
10                    || (action.value !== 'opticianReview' && action.value !== 'specialistReview')
11                    || form.dataset.productReviewsPhoneAgreementsInitialized
12                ) {
13                    return;
14                }
15
16                const phone = form.querySelector('input[name="phone"]');
17                const showOnPhoneItems = form.querySelectorAll('[data-show-onphone]');
18
19                if (!phone || showOnPhoneItems.length === 0) {
20                    return;
21                }
22
23                form.dataset.productReviewsPhoneAgreementsInitialized = '1';
24
25                const removeError = (input) => {
26                    input.classList.remove('_form-error');
27                    input.parentElement?.classList.remove('_form-error');
28                    input.parentElement?.querySelector('.form__error')?.remove();
29                };
30
31                const updateItemsState = () => {
32                    const hasPhone = phone.value.replace(/\D/g, '').length > 1;
33
34                    showOnPhoneItems.forEach((item) => {
35                        const inputs = item.querySelectorAll('input, textarea, select');
36
37                        item.style.display = hasPhone ? '' : 'none';
38
39                        inputs.forEach((input) => {
40                            if (hasPhone) {
41                                input.setAttribute('data-required', '');
42                                return;
43                            }
44
45                            input.removeAttribute('data-required');
46
47                            if (input.type === 'checkbox' || input.type === 'radio') {
48                                input.checked = false;
49                            }
50
51                            removeError(input);
52                        });
53                    });
54                };
55
56                phone.addEventListener('input', updateItemsState);
57                phone.addEventListener('change', updateItemsState);
58                form.addEventListener('reset', () => setTimeout(updateItemsState, 0));
59
60                updateItemsState();
61            });
62    };
63
64    if (document.readyState === 'loading') {
65        document.addEventListener('DOMContentLoaded', initProductReviewsPhoneAgreements);
66    } else {
67        initProductReviewsPhoneAgreements();
68    }
69})();

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.