PageSourceSearch

https://doctor-126.ru/netcat_template/template/domains/assets/js/main.js?v=73

js doctor-126.ru collected 2026-10-10 02:34:31 UTC 58,389 bytes, 1,760 lines download raw bytes

1/*function GetYMCID() {
2    var match = document.cookie.match('(?:^|;)\\s*_ym_uid=([^;]*)');
3    return (match) ? decodeURIComponent(match[1]) : false;
4}*/
5
6function setWidthScrollBar() {
7    let div = document.createElement("div");
8
9    div.style.position = "absolute";
10    div.style.overflowY = "scroll";
11    div.style.width = "50px";
12    div.style.height = "50px";
13
14    document.body.append(div);
15    let scrollWidth = div.offsetWidth - div.clientWidth;
16
17    div.remove();
18
19    return scrollWidth;
20}
21
22
23function setCookie(name, value, days) {
24  let expires = "";
25  if (days) {
26    const date = new Date();
27    date.setTime(date.getTime() + days * 24 * 60 * 60 * 1000);
28    expires = "; expires=" + date.toUTCString();
29  }
30  document.cookie = name + "=" + (value || "") + expires + "; path=/";
31}
32function getCookie(name) {
33  const value = `; ${document.cookie}`;
34  const parts = value.split(`; ${name}=`);
35  if (parts.length === 2) return parts.pop().split(';').shift();
36}
37
38
39    
40    const exitPopupCallbackBtn = document.querySelector('.exit-popup-callback');
41    const exitPopupWrap = document.querySelector('.exit-popup-wrap');
42    const exitPopupClose = document.querySelector('.exit-popup__close');
43    const exitPopup = document.querySelector('.exit-popup');
44
45    if (exitPopup) {
46		exitPopup.addEventListener("click", function (e) {
47			if (e.target.classList.contains("exit-popup__close") || e.target.parentElement.classList.contains("exit-popup__close")) {
48				setCookie("exitPopupCooldown", "1", 7);
49			} else {
50				setCookie("exitPopupCooldown", "1", 30);
51			}
52		});
53        exitPopupCallbackBtn.addEventListener('click', function(e){
54            exitPopupWrap.classList.remove('active');
55        });
56        
57        exitPopupClose.addEventListener('click', function(){
58            
59            exitPopupWrap.classList.remove('active');
60        });
61        
62        let exitIntentTriggered = false;
63
64        document.addEventListener('mouseleave', function(event) {
65            if (event.clientY <= 0 && !exitIntentTriggered) {
66                isCooldown = getCookie('exitPopupCooldown');
67                exitIntentTriggered = true;
68                if(exitPopupWrap && !isCooldown){
69                    exitPopupWrap.classList.add('active');
70                }    
71                document.removeEventListener('mouseleave', arguments.callee);
72            }
73        });
74    }
75
76function hide(element) {
77    element.style.pointerEvents = "none";
78    element.style.opacity = "0.3";
79}
80
81function show(element) {
82    element.style.pointerEvents = "";
83    element.style.opacity = "";
84}
85
86function menuOpen(menuSelector) {
87    menuSelector.classList.toggle("active");
88    document.body.classList.toggle("lock");
89}
90
91function menuClose(menuSelector) {
92    menuSelector.classList.remove("active");
93    document.body.classList.remove("lock");
94}
95
96document.addEventListener("DOMContentLoaded", function () {
97    // header sticky
98    const header = document.querySelector(".header");
99    const headerBottom = document.querySelector(".header__bottom");
100
101    window.addEventListener("scroll", function () {
102        if (header.offsetTop + header.clientHeight >= window.scrollY) {
103            header.style.paddingBottom = "0px";
104            headerBottom.classList.remove("active");
105        } else {
106            header.style.paddingBottom = headerBottom.clientHeight + "px";
107            headerBottom.classList.add("active");
108        }
109    });
110
111    // menu link
112    const menuLinkList = document.querySelectorAll(".menu__link");
113
114    if (menuLinkList.length > 0) {
115        menuLinkList.forEach((item) => {
116            const icon = item.querySelector(".menu__icon");
117            if (icon.getAttribute("data-src") == "") {
118                icon.remove();
119            }
120        });
121    }
122
123    // Popups
124    function popupClose(popupActive) {
125        popupActive.classList.remove("open");
126        document.body.classList.remove("lock");
127        document.querySelector("html").style.paddingRight = 0;
128        document.querySelectorAll(".padding-lock").forEach(function (elem) {
129            if (window.getComputedStyle(elem).position == "fixed") {
130                elem.style.paddingRight = 0;
131            }
132        });
133    }
134
135    const popupOpenBtns = document.querySelectorAll(".popup-btn");
136    const popups = document.querySelectorAll(".popup");
137    const closePopupBtns = document.querySelectorAll(".close-popup");
138
139    closePopupBtns.forEach(function (el) {
140        el.addEventListener("click", function (e) {
141            popupClose(e.target.closest(".popup"));
142        });
143    });
144
145    popupOpenBtns.forEach(function (el) {
146        el.addEventListener("click", function (e) {
147            const path = e.currentTarget.dataset.path;
148            const currentPopup = document.querySelector(`[data-target="${path}"]`);
149            const currentForm = currentPopup.querySelector(".form");
150            const title = el.dataset?.title || "Бесплатная консультация";
151            const reviewText = el.dataset.reviewText;
152
153            if (reviewText && currentPopup) {
154                const textElement = currentPopup.querySelector(".review-popup__text");
155                if (textElement) textElement.innerHTML = reviewText;
156            }
157
158            popups.forEach(function (popup) {
159                popupClose(popup);
160                popup.addEventListener("click", function (e) {
161                    if (!e.target.closest(".popup__content")) {
162                        popupClose(e.target.closest(".popup"));
163                    }
164                });
165            });
166
167            menuClose(header);
168
169            if (currentForm) {
170                const formTitle = currentForm.querySelector(".form-popup__title");
171                if (formTitle && !currentForm.classList.contains("form-review")) {
172                    formTitle.textContent = title;
173                }
174            }
175            currentPopup.classList.add("open");
176            document.body.classList.add("lock");
177            document.querySelector("html").style.paddingRight =
178                setWidthScrollBar() + "px";
179            document.querySelectorAll(".padding-lock").forEach(function (elem) {
180                console.log(window.getComputedStyle(elem).position == "fixed");
181                if (window.getComputedStyle(elem).position == "fixed") {
182                    elem.style.paddingRight = setWidthScrollBar() + "px";
183                }
184            });
185        });
186    });
187
188    // menu dropdown mobile
189    const menuDropdownBtnList = document.querySelectorAll(".menu__arrow-mobile");
190    if (menuDropdownBtnList.length > 0) {
191        menuDropdownBtnList.forEach((btn) => {
192            btn.addEventListener("click", function () {
193                // Если кнопка находится внутри menu__dropdown (вложенное меню)
194                if (btn.closest(".menu__dropdown")) {
195                    const dropdownBtn = btn
196                        .closest(".menu__dropdown-item")
197                        .querySelector(".menu__arrow-mobile");
198                    const dropdownWrapper = btn
199                        .closest(".menu__dropdown-item")
200                        .querySelector(".menu__dropdown-wrapper");
201                    if (dropdownWrapper) {
202                        dropdownWrapper.classList.toggle("open");
203                    }
204                    if (dropdownBtn) {
205                        dropdownBtn.classList.toggle("open");
206                    }
207                }
208                // Если кнопка в основном меню (вне menu__dropdown)
209                else {
210                    const menuItem = btn.closest(".menu-dropdown-item");
211                    menuItem.classList.toggle("active");
212                }
213            });
214        });
215    }
216
217    // menu burger
218    const openMenuBtns = document.querySelectorAll(".open-menu");
219    const closeMenuBtns = document.querySelectorAll(".close-menu");
220
221    openMenuBtns.forEach(function (openMenuBtn) {
222        openMenuBtn.addEventListener("click", function () {
223            menuOpen(header);
224        });
225    });
226
227    closeMenuBtns.forEach(function (closeMenuBtn) {
228        closeMenuBtn.addEventListener("click", function () {
229            menuClose(header);
230        });
231    });
232
233    // additionals full
234    /*const additionalBtnList = document.querySelectorAll('.additional__btn');
235      const additionalsContent = document.querySelector('.additionals-popup__content');
236      const additionalsFormData = new FormData;
237  
238      if (additionalBtnList.length > 0) {
239          additionalBtnList.forEach(additionalBtn => {
240              additionalBtn.addEventListener('click', function () {
241                  const subID = additionalBtn.getAttribute("data-sub-id");
242                  additionalsFormData.append("ADDITIONAL_FULL_ID", subID);
243                  fetch('/fetch/', {
244                      method: 'POST',
245                      body: additionalsFormData,
246                  }).then(async (response) => {
247                      let responseResult = await response.text();
248                      additionalsContent.innerHTML = responseResult;
249                  });
250              })
251          });
252      }*/
253
254    const swiperAdd = new Swiper(".additionals__row.swiper", {
255        slidesPerView: 1,
256        spaceBetween: 20,
257        centeredSlides: false,
258        loop: false,
259
260        pagination: {
261            el: ".swiper-pagination",
262            clickable: true,
263            dynamicBullets: false,
264        },
265
266        breakpoints: {
267            320: {
268                slidesPerView: 1,
269                spaceBetween: 20,
270                pagination: {
271                    enabled: true,
272                },
273            },
274            769: {
275                slidesPerView: 2,
276                spaceBetween: 20,
277                pagination: {
278                    enabled: false,
279                },
280            },
281            1024: {
282                slidesPerView: 3,
283                spaceBetween: 20,
284                pagination: {
285                    enabled: false,
286                },
287            },
288        },
289    });
290    
291    
292    
293    
294    
295    const swiperSales = new Swiper(".sales-slider-section.swiper", {
296        slidesPerView: 3,
297        spaceBetween: 20,
298        loop: false,
299        
300        navigation: {
301          prevEl: document.querySelector(".sales-slider-prev"),
302          nextEl: document.querySelector(".sales-slider-next"),
303        },
304
305        breakpoints: {
306            320: {
307                slidesPerView: 1,
308                spaceBetween: 20,
309                pagination: {
310                    enabled: true,
311                },
312            },
313            769: {
314                slidesPerView: 2,
315                spaceBetween: 20,
316                pagination: {
317                    enabled: false,
318                },
319            },
320            1024: {
321                slidesPerView: 3,
322                spaceBetween: 20,
323                pagination: {
324                    enabled: false,
325                },
326            },
327        },
328    });
329    
330    
331    
332    
333let swiperLaw;
334
335function initLawSwiper() {
336    const container = document.querySelector(".law__swiper");
337    if (!container) return;
338
339    if (window.innerWidth < 990) {
340        if (!swiperLaw) {
341            swiperLaw = new Swiper(".law__swiper", {
342                slidesPerView: 1,
343                spaceBetween: 20,
344                loop: false,
345            });
346        }
347    } else if (swiperLaw) {
348        swiperLaw.destroy(true, true);
349        swiperLaw = null;
350    }
351}
352
353if (document.readyState === "loading") {
354    document.addEventListener("DOMContentLoaded", initLawSwiper);
355} else {
356    initLawSwiper();
357}
358
359window.addEventListener("resize", initLawSwiper);
360    
361    
362    
363    
364    
365    
366
367    // slider-1
368    const slider1List = document.querySelectorAll(".slider-1");
369
370    if (slider1List.length > 0) {
371        slider1List.forEach((slider) => {
372            const slider1 = new Swiper(slider, {
373                touchRatio: false,
374                effect: "fade",
375                fadeEffect: {
376                    crossFade: true,
377                },
378                navigation: {
379                    prevEl: slider
380                        .closest(".slider-wrapper")
381                        .querySelector(".slider-btn_prev"),
382                    nextEl: slider
383                        .closest(".slider-wrapper")
384                        .querySelector(".slider-btn_next"),
385                },
386            });
387        });
388    }
389
390    // slider-3
391    const slider3List = document.querySelectorAll(".slider-4");
392
393    if (slider3List.length > 0) {
394        slider3List.forEach((slider) => {
395            const slider3 = new Swiper(slider, {
396                slidesPerView: 4,
397                spaceBetween: 30,
398                navigation: {
399                    prevEl: slider
400                        .closest(".slider-wrapper")
401                        .querySelector(".slider-btn_prev"),
402                    nextEl: slider
403                        .closest(".slider-wrapper")
404                        .querySelector(".slider-btn_next"),
405                },
406                breakpoints: {
407                    0: {
408                        slidesPerView: 1.1,
409                        spaceBetween: 15,
410                    },
411                    576: {
412                        slidesPerView: 2,
413                        spaceBetween: 15,
414                    },
415                    768: {
416                        slidesPerView: 3,
417                        spaceBetween: 15,
418                    },
419                    1201: {
420                        slidesPerView: 4,
421                        spaceBetween: 30,
422                    },
423                },
424            });
425        });
426    }
427
428    // side block slider
429    const sideBlockSliderList = document.querySelectorAll(".side__block-slider");
430
431    if (sideBlockSliderList.length > 0) {
432        sideBlockSliderList.forEach((slider) => {
433            const sideBlockSlider = new Swiper(slider, {
434                slidesPerView: 1,
435                spaceBetween: 20,
436                navigation: {
437                    prevEl: slider
438                        .closest(".slider-wrapper")
439                        .querySelector(".slider-btn_prev"),
440                    nextEl: slider
441                        .closest(".slider-wrapper")
442                        .querySelector(".slider-btn_next"),
443                },
444                pagination: {
445                    el: slider
446                        .closest(".slider-wrapper")
447                        .querySelector(".slider-pagination"),
448                    type: "fraction",
449                },
450            });
451        });
452    }
453    // side block slider
454    const sideBlockSliderList2 = document.querySelectorAll(".side__block-slider2");
455
456    if (sideBlockSliderList2.length > 0) {
457        sideBlockSliderList2.forEach((slider) => {
458            const sideBlockSlider = new Swiper(slider, {
459                slidesPerView: 1,
460                spaceBetween: 20,
461                navigation: {
462                    prevEl: slider
463                        .closest(".slider-wrapper")
464                        .querySelector(".slider-btn_prev"),
465                    nextEl: slider
466                        .closest(".slider-wrapper")
467                        .querySelector(".slider-btn_next"),
468                },
469                pagination: {
470                    el: slider
471                        .closest(".slider-wrapper")
472                        .querySelector(".slider-pagination"),
473                    type: "fraction",
474                },
475            });
476        });
477    }
478
479    // slider-3
480    const slider4List = document.querySelectorAll(".slider-5");
481
482    if (slider4List.length > 0) {
483        slider4List.forEach((slider) => {
484            const slider4 = new Swiper(slider, {
485                slidesPerView: 3,
486                spaceBetween: 20,
487                pagination: {
488                    el: ".swiper-pagination",
489                    clickable: true,
490                },
491                breakpoints: {
492                    0: {
493                        slidesPerView: 1.1,
494                        spaceBetween: 15,
495                    },
496                    576: {
497                        slidesPerView: 2,
498                        spaceBetween: 15,
499                    },
500                    768: {
501                        slidesPerView: 3,
502      
502                  spaceBetween: 15,
503                    },
504                    1201: {
505                        slidesPerView: 3,
506                        spaceBetween: 20,
507                    },
508                },
509            });
510        });
511    }
512
513    const doctorsSlider = new Swiper(".doctors-slider", {
514        spaceBetween: 20,
515        grabCursor: true,
516        allowTouchMove: false,
517
518        breakpoints: {
519            320: {
520                allowTouchMove: true,
521                slidesPerView: 1,
522                spaceBetween: 15,
523            },
524
525            768: {
526                allowTouchMove: true,
527                slidesPerView: 2.5,
528                spaceBetween: 20,
529            },
530
531            1024: {
532                allowTouchMove: true,
533                slidesPerView: 4,
534                spaceBetween: 20,
535            },
536        },
537
538        pagination: {
539            el: ".doctors-slider__pagination",
540            type: "bullets",
541            clickable: true,
542        },
543
544        navigation: false,
545        scrollbar: false,
546    });
547
548    // ward slider
549    const wardSliderList = document.querySelectorAll(".ward__slider");
550
551    if (wardSliderList.length > 0) {
552        wardSliderList.forEach((slider) => {
553            const wardSlider = new Swiper(slider, {
554                slidesPerView: 1,
555                spaceBetween: 20,
556                loop: true,
557                navigation: {
558                    prevEl: slider
559                        .closest(".slider-wrapper")
560                        .querySelector(".slider-btn_prev"),
561                    nextEl: slider
562                        .closest(".slider-wrapper")
563                        .querySelector(".slider-btn_next"),
564                },
565            });
566        });
567    }
568    const swiper = new Swiper(".emergency-services-swiper", {
569        loop: true,
570        speed: 800,
571
572        pagination: {
573            el: ".swiper-pagination",
574            clickable: true,
575        },
576
577        navigation: {
578            nextEl: ".swiper-button-next",
579            prevEl: ".swiper-button-prev",
580        },
581
582        breakpoints: {
583            320: {
584                slidesPerView: 1,
585                spaceBetween: 10,
586            },
587            768: {
588                slidesPerView: 1,
589                spaceBetween: 20,
590            },
591            1024: {
592                slidesPerView: 1,
593                spaceBetween: 30,
594            },
595        },
596    });
597
598    const progressBlock = document.getElementById("progressBlock");
599    const progressFills = document.querySelectorAll(".progress-fill");
600    const progressValues = document.querySelectorAll(".progress-value");
601
602    let animationPlayed = false;
603
604    function animateProgressBars() {
605        const isMobile = window.innerWidth <= 768;
606        const multiplier = isMobile ? 0.83 : 0.93;
607
608        progressFills.forEach((fill, index) => {
609            const value = fill.getAttribute("data-value");
610            fill.style.width = "0%";
611            progressValues[index].textContent = "0%";
612
613            setTimeout(() => {
614                fill.style.width = value * multiplier + "%";
615
616                let currentValue = 0;
617                const increment = value / 50;
618
619                const counter = setInterval(() => {
620                    currentValue += increment;
621                    if (currentValue >= value) {
622                        currentValue = value;
623                        clearInterval(counter);
624                    }
625
626                    progressValues[index].textContent = Math.round(currentValue) + "%";
627                }, 30);
628            }, 150 * index);
629        });
630
631        animationPlayed = true;
632    }
633
634    const observer = new IntersectionObserver(
635        (entries) => {
636            entries.forEach((entry) => {
637                if (entry.isIntersecting && !animationPlayed) {
638                    progressBlock.classList.add("visible");
639                    setTimeout(animateProgressBars, 300);
640                }
641            });
642        },
643        {
644            threshold: 0.3,
645        }
646    );
647    if (progressBlock) {
648        observer.observe(progressBlock);
649    }
650
651
652    // documents fancybox
653    Fancybox.bind('[data-fancybox="documents"]', {
654        placeFocusBack: false,
655    });
656
657    // prices-gallery fancybox
658    Fancybox.bind('[data-fancybox="prices-gallery"]', {
659        placeFocusBack: false,
660    });
661
662    // gallery fancybox
663    Fancybox.bind('[data-fancybox="gallery"]', {
664        placeFocusBack: false,
665    });
666
667    // btn to top
668    const goTopBtn = document.querySelector(".btn-to-top");
669    let flagBitrix = false;
670
671    window.addEventListener("scroll", trackScroll);
672    goTopBtn.addEventListener("click", goTop);
673
674    function trackScroll() {
675        const scrolled = window.pageYOffset;
676        const coords = document.documentElement.clientHeight;
677        if (scrolled > coords) {
678            goTopBtn.classList.add("btn-to-top_show");
679        } else {
680            goTopBtn.classList.remove("btn-to-top_show");
681        }
682    }
683
684    function goTop() {
685        if (window.pageYOffset > 0) {
686            window.scrollBy(0, -75);
687            setTimeout(goTop, 0);
688        }
689    }
690
691    // accordion
692    const ACCORDION_LIST = "data-accordion-list";
693    const ACCORDION_BUTTON = "data-accordion-button";
694    const ACCORDION_ARROW = "data-accordion-arrow";
695    const ACCORDION_CONTENT = "data-accordion-content";
696    const SECTION_OPENED = "active";
697    const ICON_ROTATED = "rotated";
698
699    class Accordion {
700        static apply(accordionNode) {
701            if (!accordionNode) {
702                return;
703            }
704
705            const acc = new Accordion();
706            acc.accordion = accordionNode;
707            accordionNode.onclick = acc.onClick.bind(acc);
708        }
709
710        handleClick(button) {
711            const innerSection = button
712                .closest(".accor")
713                .querySelector(".accor-full");
714            const isOpened = innerSection.classList.contains(SECTION_OPENED);
715
716            const accListItems = button
717                .closest(`[${ACCORDION_LIST}]`)
718                .querySelectorAll(".accor .accor-full");
719            this.closeAll(accListItems);
720            if (isOpened) {
721                this.close(innerSection);
722                return;
723            }
724            this.open(innerSection);
725        }
726
727        closeAll(items) {
728            if (items.length) {
729                items.forEach((item) => {
730                    this.close(item);
731                });
732            }
733        }
734
735        open(section) {
736            const accordion = section
737                .querySelector(`[${ACCORDION_CONTENT}`)
738                .closest(".accor");
739            const accordionContent = section.querySelector(`[${ACCORDION_CONTENT}`);
740            const accordionList = accordionContent.querySelector(
741                `[${ACCORDION_LIST}`
742            );
743            const innerSectionHeight = accordionContent.clientHeight;
744            let countOfScrollHeight = 0;
745            const allElementContentData = section.querySelectorAll(
746                `[${ACCORDION_CONTENT}`
747            );
748            accordion.classList.add(SECTION_OPENED);
749            section.classList.add(SECTION_OPENED);
750            this.rotateIconFor(section.previousElementSibling);
751
752            for (const item of allElementContentData) {
753                countOfScrollHeight = countOfScrollHeight + item.scrollHeight;
754            }
755
756            if (accordionContent.contains(accordionList)) {
757                section.style.maxHeight = `${innerSectionHeight + countOfScrollHeight
758                    }px`;
759                return;
760            }
761            section.style.maxHeight = `${innerSectionHeight}px`;
762        }
763
764        close(section) {
765            const accordion = section
766                .querySelector(`[${ACCORDION_CONTENT}`)
767                .closest(".accor");
768            section.style.maxHeight = 0;
769            accordion.classList.remove(SECTION_OPENED);
770            section.classList.remove(SECTION_OPENED);
771            this.rotateIconFor(section.previousElementSibling);
772        }
773
774        rotateIconFor(button) {
775            const rotatedIconClass = ICON_ROTATED;
776            const arrowElement = button.dataset.hasOwnProperty("accordionArrow")
777                ? button
778                : button.querySelector(`[${ACCORDION_ARROW}]`);
779
780            if (!arrowElement) {
781                return;
782            }
783
784            const isOpened = arrowElement.classList.contains(rotatedIconClass);
785            if (!isOpened) {
786                arrowElement.classList.add(rotatedIconClass);
787                return;
788            }
789            arrowElement.classList.remove(rotatedIconClass);
790        }
791
792        onClick(event) {
793            let button = event.target.closest(`[${ACCORDION_BUTTON}]`);
794            if (button && button.dataset.accordionButton !== undefined) {
795                this.handleClick(button);
796            }
797            setTimeout(() => {
798                AOS.refresh();
799            }, 500);
800        }
801    }
802
803    const accorWrapperList = document.querySelectorAll(".accor-wrapper");
804
805    if (accorWrapperList.length > 0) {
806        accorWrapperList.forEach(function (elem) {
807            Accordion.apply(elem);
808        });
809    }
810
811    // accordion faq-redesign
812
813    // SVG иконки
814    const PLUS_SVG =
815        '<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M8 0C8.55229 0 9 0.447715 9 1V7H15C15.5522 7 15.9998 7.44787 16 8C16 8.55229 15.5523 9 15 9H9V15C9 15.5523 8.55229 16 8 16C7.44772 16 7 15.5523 7 15V9H1C0.447715 9 -2.41411e-08 8.55229 0 8C0.000175551 7.44786 0.447824 7 1 7H7V1C7 0.447715 7.44772 0 8 0Z" fill="#FF5B5B"/></svg>';
816    const MINUS_SVG =
817        '<svg width="16" height="2" viewBox="0 0 16 2" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M15 0C15.5523 2.41411e-08 16 0.447715 16 1C16 1.55228 15.5523 2 15 2H1C0.447715 2 1.60558e-07 1.55228 0 1C2.41411e-08 0.447715 0.447715 4.0285e-08 1 0H15Z" fill="#282828"/></svg>';
818
819    class Accordion1 {
820        static apply(accordionNode1) {
821            if (!accordionNode1) {
822                return;
823            }
824
825            const acc = new Accordion1();
826            acc.accordion = accordionNode1;
827            accordionNode1.onclick = acc.onClick.bind(acc);
828        }
829
830        handleClick(button) {
831            const accordionItem = button.closest(".accor-redesign");
832            const innerSection = accordionItem.querySelector(".accor-full");
833            const isOpened = innerSection.classList.contains(SECTION_OPENED);
834
835            const accListItems = button
836                .closest(`[${ACCORDION_LIST}]`)
837                .querySelectorAll(".accor-redesign .accor-full");
838            this.closeAll(accListItems);
839
840            if (isOpened) {
841                this.close(innerSection);
842                return;
843            }
844            this.open(innerSection);
845        }
846
847        closeAll(items) {
848            if (items.length) {
849                items.forEach((item) => {
850                    this.close(item);
851                });
852            }
853        }
854
855        open(section) {
856            const accordionItem = section.closest(".accor-redesign");
857            const accordionContent = section.querySelector(`[${ACCORDION_CONTENT}]`);
858            const accordionButton = accordionItem.querySelector(
859                `[${ACCORDION_BUTTON}]`
860            );
861            const accordionIcon = accordionButton.querySelector(
862                ".accor-redesign-open-decor"
863            );
864
865            accordionItem.classList.add(SECTION_OPENED);
866            section.classList.add(SECTION_OPENED);
867
868            if (accordionIcon) {
869                accordionIcon.innerHTML = MINUS_SVG;
870                accordionIcon.style.backgroundColor = "#f5f5f5";
871            }
872
873            const contentHeight = accordionContent.scrollHeight;
874            section.style.maxHeight = `${contentHeight}px`;
875        }
876
877        close(section) {
878            const accordionItem = section.closest(".accor-redesign");
879            const accordionButton = accordionItem.querySelector(
880                `[${ACCORDION_BUTTON}]`
881            );
882            const accordionIcon = accordionButton.querySelector(
883                ".accor-redesign-open-decor"
884            );
885
886            section.style.maxHeight = 0;
887            accordionItem.classList.remove(SECTION_OPENED);
888            section.classList.remove(SECTION_OPENED);
889
890            if (accordionIcon) {
891                accordionIcon.innerHTML = PLUS_SVG;
892                accordionIcon.style.backgroundColor = "rgba(255, 91, 91, 0.1)";
893            }
894        }
895
896        onClick(event) {
897            let button = event.target.closest(`[${ACCORDION_BUTTON}]`);
898            if (button && button.dataset.accordionButton !== undefined) {
899                this.handleClick(button);
900            }
901            setTimeout(() => {
902                if (typeof AOS !== "undefined") {
903                    AOS.refresh();
904                }
905            }, 500);
906        }
907    }
908
909    const accorWrapperList1 = document.querySelectorAll(
910        ".accor-redesign-wrapper"
911    );
912
913    if (accorWrapperList1.length > 0) {
914        accorWrapperList1.forEach(function (elem) {
915            Accordion1.apply(elem);
916        });
917    }
918    ymaps.ready(initMap);  
919    function initMap() {
920        var myMap = new ymaps.Map("districtMap3", {
921            center: districtCoords.center,
922            zoom: 12,
923        });
924
925        const controlsToRemove = [
926            "zoomControl", "geolocationControl", "searchControl",
927            "trafficControl", "typeSelector", "fullscreenControl", "rulerControl"
928        ];
929
930        controlsToRemove.forEach(control => myMap.controls.remove(control));
931
932        const placemarkOptions = {
933            iconLayout: "default#image",
934            iconImageHref: "/assets/images/placemark.svg",
935            iconImageSize: [15, 18],
936            iconImageOffset: [-7, -18],
937        };
938
939        districtCoords.placemarks.forEach(mark => {
940            var placemark = new ymaps.Placemark(
941                mark.coords,
942                {
943                    hintContent: mark.name,
944                    balloonContent: mark.name,
945                },
946                placemarkOptions
947            );
948            myMap.geoObjects.add(placemark);
949        });
950        console.log(myMap);
951    }
952    ymaps.ready(init);
953    ymaps.ready(init2);
954    function init() {
955        var myMap = new ymaps.Map("districtMap", {
956            center: [51.533103, 46.034158], // Координаты Саратова
957            zoom: 12,
958        });
959        myMap.controls.remove("zoomControl");
960        myMap.controls.remove("geolocationControl");
961        myMap.controls.remove("searchControl");
962        myMap.controls.remove("trafficControl");
963        myMap.controls.remove("typeSelector");
964        myMap.controls.remove("fullscreenControl");
965        myMap.controls.remove("rulerControl");
966        var volzhskiy = new ymaps.Placemark(
967            [51.558607, 46.076187],
968            {
969                hintContent: "Волжский район",
970                balloonContent: "Волжский район",
971            },
972            {
973                iconLayout: "default#image",
974                iconImageHref: "/assets/images/placemark.svg",
975                iconImageSize: [15, 18],
976                iconImageOffset: [-7, -18],
977            }
978        );
979        var kirovskiy = new ymaps.Placemark(
980            [51.573346, 46.029318],
981            {
982                hintContent: "Кировский район",
983                balloonContent: "Кировский район",
984            },
985            {
986                iconLayout: "default#image",
987                iconImageHref: "/assets/images/placemark.svg",
988                iconImageSize: [15, 18],
989                iconImageOffset: [-7, -18],
990            }
991        );
992        var leninskiy = new ymaps.Placemark(
993            [51.598793, 45.927753],
994            {
995                hintContent: "Ленинский район",
996                balloonContent: "Ленинский район",
997            },
998            {
999                iconLayout: "default#image",
1000                iconImageHref: "/assets/images/placemark.svg",
1001                iconImageSize: [15, 18],
1002                iconImageOffset: [-7, -18],
1003            }
1004        );
1005        var zavodskoy = new ymaps.Placemark(
1006            [51.472219, 45.926378],
1007            {
1008                hintContent: "Заводской район",
1009                balloonContent: "Заводской район",
1010            },
1011            {
1012                iconLayout: "default#image",
1013                iconImageHref: "/assets/images/placemark.svg",
1014                iconImageSize: [15, 18],
1015                iconImageOffset: [-7, -18],
1016            }
1017        );
1018        var oktyabrskiy = new ymaps.Placemark(
1019            [51.52729, 45.970581],
1020            {
1021                hintContent: "Октябрьский район",
1022                balloonContent: "Октябрьский район",
1023            },
1024            {
1025                iconLayout: "default#image",
1026                iconImageHref: "/assets/images/placemark.svg",
1027                iconImageSize: [15, 18],
1028                iconImageOffset: [-7, -18],
1029            }
1030        );
1031
1032        var frunzensky = new ymaps.Placemark(
1033            [51.53665, 45.994789],
1034            {
1035                hintContent: "Фрунзенский район",
1036                balloonContent: "Фрунзенский район",
1037            },
1038            {
1039                iconLayout: "default#image",
1040                iconImageHref: "/assets/images/placemark.svg",
1041                iconImageSize: [15, 18],
1042                iconImageOffset: [-7, -18],
1043            }
1044        );
1045        myMap.geoObjects.add(volzhskiy);
1046        myMap.geoObjects.add(kirovskiy);
1047        myMap.geoObjects.add(leninskiy);
1048        myMap.geoObjects.add(oktyabrskiy);
1049        myMap.geoObjects.add(frunzensky);
1050        myMap.geoObjects.add(zavodskoy);
1051    }
1052
1053    function init2(){
1054        console.log('actr')
1055        var myMap2 = new ymaps.Map("districtMap2", {
1056            center: [46.343720, 48.042306], // Координаты Астрахани
1057            zoom: 12,
1058        });
1059
1060        var kirrai = new ymaps.Placemark(
1061            [46.3494444444444, 48.0638888888889],
1062            {
1063                hintContent: "Кировский район",
1064                balloonContent: "Кировский район",
1065            },
1066            {
1067                iconLayout: "default#image",
1068                iconImageHref: "/assets/images/placemark.svg",
1069                iconImageSize: [15, 18],
1070                iconImageOffset: [-7, -18],
1071            }
1072        );
1073
1074        var sovrai = new ymaps.Placemark(
1075            [46.3083333333333, 48.0172222222222],
1076            {
1077                hintContent: "Советский район",
1078                balloonContent: "Советский район",
1079            },
1080            {
1081                iconLayout: "default#image",
1082                iconImageHref: "/assets/images/placemark.svg",
1083                iconImageSize: [15, 18],
1084                iconImageOffset: [-7, -18],
1085            }
1086        );
1087
1088        var trurai = new ymaps.Placemark(
1089            [46.353275, 47.999429],
1090            {
1091                hintContent: "Трусовский район",
1092                balloonContent: "Трусовский район",
1093            },
1094            {
1095                iconLayout: "default#image",
1096                iconImageHref: "/assets/images/placemark.svg",
1097                iconImageSize: [15, 18],
1098                iconImageOffset: [-7, -18],
1099            }
1100        );
1101
1102        var lenrai = new ymaps.Placemark(
1103            [46.3944444444444, 48.1066666666667],
1104            {
1105                hintContent: "Ленинский район",
1106                balloonContent: "Ленинский район",
1107            },
1108            {
1109                iconLayout: "default#image",
1110                iconImageHref: "/assets/images/placemark.svg",
1111                iconImageSize: [15, 18],
1112                iconImageOffset: [-7, -18],
1113            }
1114        );
1115        
1116        myMap2.controls.remove("zoomControl");
1117        myMap2.controls.remove("geolocationControl");
1118        myMap2.controls.remove("searchControl");
1119        myMap2.controls.remove("trafficControl");
1120        myMap2.controls.remove("typeSelector");
1121        myMap2.controls.remove("fullscreenControl");
1122        myMap2.controls.remove("rulerControl");
1123
1124        myMap2.geoObjects.add(kirrai);
1125        myMap2.geoObjects.add(trurai);
1126        myMap2.geoObjects.add(sovrai);
1127        myMap2.geoObjects.add(lenrai);
1128    }
1129
1130    const workDays = {
1131        1: [["10:00", "20:00"]],
1132        2: [["10:00", "20:00"]],
1133        3: [["10:00", "20:00"]],
1134        4: [["10:00", "20:00"]],
1135        5: [["10:00", "20:00"]],
1136        6: [["10:00", "20:00"]],
1137        0: [["10:00", "20:00"]],
1138    };
1139    const slotLength = 60;
1140
1141    let sessionId = sessionStorage.getItem("schedule_session_id");
1142    if (!sessionId) {
1143        sessionId =
1144            "session_" + Date.now() + "_" + Math.random().toString(36).slice(2, 11);
1145        sessionStorage.setItem("schedule_session_id", sessionId);
1146    }
1147
1148    let selectedDate = null;
1149    let selectedTime = null;
1150    let datesSwiper = null;
1151
1152    initAll();
1153
1154    function initAll() {
1155        generateDates();
1156        initSwiper();
1157        initBookingForm();
1158    }
1159
1160    function simpleHash(str) {
1161        let hash = 0;
1162        for (let i = 0; i < str.length; i++) {
1163            const char = str.charCodeAt(i);
1164            hash = (hash << 5) - hash + char;
1165            hash = hash & hash;
1166        }
1167        return Math.abs(hash);
1168    }
1169
1170    function seededRandom(seed) {
1171        const x = Math.sin(seed) * 10000;
1172        return x - Math.floor(x);
1173    }
1174
1175    function generateDates() {
1176        const datesListElement = document.getElementById("dates-list");
1177        if (!datesListElement) return;
1178
1179        datesListElement.innerHTML = "";
1180
1181        const today = new Date();
1182        const days = ["Вс", "Пн", "Вт", "Ср", "Чт", "Пт", "Сб"];
1183        const months = [
1184            "янв",
1185            "февр",
1186            "март",
1187            "апр",
1188            "мая",
1189            "июня",
1190            "июля",
1191            "авг",
1192            "сент",
1193            "окт",
1194            "нояб",
1195            "дек",
1196        ];
1197
1198        const doctorId =
1199            document.querySelector('input[name="doctor_id"]')?.value || "default";
1200
1201        let addedButtons = 0;
1202        let firstActiveDate = null;
1203        let firstActiveSlide = null;
1204
1205        const disabledDates = generateStableDisabledDates(doctorId, today);
1206
1207        for (let i = 1; i < 15 && addedButtons < 14; i++) {
1208            const currentDate = new Date(today);
1209            currentDate.setDate(today.getDate() + i);
1210            const dayOfWeek = currentDate.getDay();
1211            const slide = document.createElement("div");
1212            slide.className = "swiper-slide";
1213
1214            const dateBtn = document.createElement("button");
1215            dateBtn.type = "button";
1216            dateBtn.className = "date-btn";
1217
1218            const isDisabled = disabledDates.has(currentDate.toDateString());
1219            if (isDisabled) {
1220                dateBtn.classList.add("disabled");
1221                dateBtn.disabled = true;
1222            }
1223
1224            const dayName = days[dayOfWeek];
1225            const monthName = months[currentDate.getMonth()];
1226            const dateNum = currentDate.getDate();
1227            dateBtn.innerHTML = `${dateNum} ${monthName}`;
1228
1229            if (!isDisabled) {
1230                dateBtn.addEventListener("click", function () {
1231                    selectDate(new Date(currentDate), this);
1232                });
1233
1234                if (!firstActiveDate) {
1235                    firstActiveDate = new Date(currentDate);
1236                    firstActiveSlide = slide;
1237                }
1238            }
1239
1240            slide.appendChild(dateBtn);
1241            datesListElement.appendChild(slide);
1242            addedButtons++;
1243        }
1244
1245        if (firstActiveDate && firstActiveSlide) {
1246            selectDate(firstActiveDate, firstActiveSlide.querySelector(".date-btn"));
1247        }
1248    }
1249
1250    function initSwiper() {
1251        datesSwiper = new Swiper(".dates-swiper", {
1252            slidesPerView: "auto",
1253            spaceBetween: 12,
1254            freeMode: true,
1255            resistance: true,
1256            resistanceRatio: 0.85,
1257            watchSlidesProgress: true,
1258            navigation: {
1259                nextEl: "#dates-next",
1260                prevEl: "#dates-prev",
1261            },
1262            breakpoints: {
1263                320: {
1264                    slidesPerView: "auto",
1265                    spaceBetween: 8,
1266                },
1267                768: {
1268                    slidesPerView: "auto",
1269                    spaceBetween: 12,
1270                },
1271            },
1272        });
1273
1274        datesSwiper.on("slideChange", function () {
1275            updateArrows();
1276        });
1277
1278        setTimeout(updateArrows, 100);
1279    }
1280
1281    function updateArrows() {
1282        if (!datesSwiper) return;
1283
1284        const prevArrow = document.getElementById("dates-prev");
1285        const nextArrow = document.getElementById("dates-next");
1286
1287        if (prevArrow) {
1288            prevArrow.disabled = datesSwiper.isBeginning;
1289            prevArrow.style.opacity = datesSwiper.isBeginning ? "0.3" : "1";
1290        }
1291
1292        if (nextArrow) {
1293            nextArrow.disabled = datesSwiper.isEnd;
1294            nextArrow.style.opacity = datesSwiper.isEnd ? "0.3" : "1";
1295        }
1296    }
1297
1298    function generateStableDisabledDates(doctorId, today) {
1299        const disabledDates = new Set();
1300        const seedStr = doctorId + sessionId;
1301        const seed = simpleHash(seedStr);
1302        for (let i = 0; i < 3; i++) {
1303            const randomOffset = 2 + Math.floor(seededRandom(seed + i) * 10);
1304            const disabledDate = new Date(today);
1305            disabledDate.setDate(today.getDate() + randomOffset);
1306            disabledDates.add(disabledDate.toDateString());
1307        }
1308        return disabledDates;
1309    }
1310
1311    function selectDate(date, button) {
1312        document.querySelectorAll(".date-btn").forEach((btn) => {
1313            btn.classList.remove("active");
1314        });
1315
1316        button.classList.add("active");
1317        selectedDate = date;
1318        selectedTime = null;
1319
1320        const submitBtn = document.getElementById("schedule-submit");
1321        if (submitBtn) submitBtn.disabled = true;
1322
1323        generateTimeSlots(date);
1324    }
1325
1326    function generateTimeSlots(date) {
1327        const timeSlotsList = document.getElementById("time-slots-list");
1328        if (!timeSlotsList) return;
1329        timeSlotsList.innerHTML = "";
1330
1331        const dayOfWeek = date.getDay();
1332        const workDay = workDays[dayOfWeek];
1333
1334        if (!workDay || workDay.length === 0) {
1335            timeSlotsList.innerHTML =
1336                '<div class="no-slots">На выбранную дату приёма нет</div>';
1337            return;
1338        }
1339
1340        const slotsData = generateStableTimeSlots(date);
1341
1342        if (!slotsData.slots.length) {
1343            timeSlotsList.innerHTML =
1344                '<div class="no-slots">Свободных окон нет</div>';
1345            return;
1346        }
1347
1348        slotsData.slots.forEach((slot) => {
1349            const timeSlot = document.createElement("button");
1350            timeSlot.type = "button";
1351            timeSlot.className = "time-slot";
1352            timeSlot.textContent = slot;
1353
1354            const isDisabled = slotsData.disabledSlots.includes(slot);
1355            if (isDisabled) {
1356                timeSlot.classList.add("disabled");
1357                timeSlot.disabled = true;
1358            } else {
1359                timeSlot.addEventListener("click", function () {
1360                    selectTime(slot, this);
1361                });
1362            }
1363            timeSlotsList.appendChild(timeSlot);
1364        });
1365    }
1366
1367    function generateStableTimeSlots(date) {
1368        const doctorId =
1369            document.querySelector('input[name="doctor_id"]')?.value || "default";
1370        const dateStr =
1371            date.getFullYear() +
1372            String(date.getMonth() + 1).padStart(2, "0") +
1373            String(date.getDate()).padStart(2, "0");
1374        const seedStr = doctorId + dateStr + sessionId;
1375        const seed = simpleHash(seedStr);
1376
1377        const allSlots = [
1378            "10:00",
1379            "11:00",
1380            "12:00",
1381            "13:00",
1382            "14:00",
1383            "15:00",
1384            "16:00",
1385            "17:00",
1386            "18:00",
1387            "19:00",
1388            "20:00",
1389        ];
1390        const slotsCount = 7 + Math.floor(seededRandom(seed) * 2);
1391        const slots = [];
1392        const usedIndices = new Set();
1393        let attempt = 0;
1394
1395        while (
1396            slots.length < slotsCount &&
1397            usedIndices.size < allSlots.length &&
1398            attempt < 100
1399        ) {
1400            const randomValue = seededRandom(seed + slots.length + attempt);
1401            const index = Math.floor(randomValue * allSlots.length);
1402            if (!usedIndices.has(index)) {
1403                slots.push(allSlots[index]);
1404                usedIndices.add(index);
1405            }
1406            attempt++;
1407        }
1408        slots.sort(
1409            (a, b) => parseInt(a.replace(":", "")) - parseInt(b.replace(":", ""))
1410        );
1411        const disabledSlots = [];
1412        const disabledCount = Math.floor(slots.length * 0.3);
1413        for (let i = 0; i < disabledCount; i++) {
1414            const randomValue = seededRandom(seed + 1000 + i);
1415            const index = Math.floor(randomValue * slots.length);
1416            if (index < slots.length && !disabledSlots.includes(slots[index])) {
1417                disabledSlots.push(slots[index]);
1418            }
1419        }
1420
1421        return { slots, disabledSlots };
1422    }
1423
1424    function selectTime(time, button) {
1425        document
1426            .querySelectorAll(".time-slot")
1427            .forEach((btn) => btn.classList.remove("active"));
1428        button.classList.add("active");
1429        selectedTime = time;
1430        const submitBtn = document.getElementById("schedule-submit");
1431        if (submitBtn) submitBtn.disabled = false;
1432    }
1433
1434    function initBookingForm() {
1435        const submitBtn = document.getElementById("schedule-submit");
1436        const form = document.getElementById("booking-form");
1437        if (submitBtn && form) {
1438            submitBtn.addEventListener("click", function (e) {
1439                if (!selectedDate || !selectedTime) return;
1440                const days = ["Вс", "Пн", "Вт", "Ср", "Чт", "Пт", "Сб"];
1441                const months = [
1442                    "января",
1443                    "февраля",
1444                    "марта",
1445                    "апреля",
1446                    "мая",
1447                    "июня",
1448                    "июля",
1449                    "августа",
1450                    "сентября",
1451                    "октября",
1452                    "ноября",
1453                    "декабря",
1454                ];
1455
1456                const dayName = days[selectedDate.getDay()];
1457                const dayNumber = selectedDate.getDate();
1458                const monthName = months[selectedDate.getMonth()];
1459                const formattedDate = `${dayName} ${dayNumber} ${monthName}`;
1460
1461                form
1462                    .querySelectorAll(
1463                        'input[name="selected_date"], input[name="selected_time"]'
1464                    )
1465                    .forEach((n) => n.remove());
1466
1467                const dateInput = document.createElement("input");
1468                dateInput.type = "hidden";
1469                dateInput.name = "selected_date";
1470                dateInput.value = formattedDate;
1471                form.appendChild(dateInput);
1472
1473                const timeInput = document.createElement("input");
1474                timeInput.type = "hidden";
1475                timeInput.name = "selected_time";
1476                timeInput.value = selectedTime;
1477                form.appendChild(timeInput);
1478
1479                const commentField = form.querySelector(".preferred_time");
1480                if (commentField) {
1481                    commentField.value = `Запись на ${formattedDate} в ${selectedTime}`;
1482                }
1483
1484                const contactsSection = document.getElementById("contacts");
1485                const header = document.querySelector(".doctor-nav");
1486                if (contactsSection) {
1487                    const headerHeight = header ? header.offsetHeight : 0;
1488                    const targetPosition = contactsSection.offsetTop - headerHeight - 20;
1489                    window.scrollTo({ top: targetPosition, behavior: "smooth" });
1490                }
1491            });
1492        }
1493    }
1494
1495    document.addEventListener('change', function (e) {
1496        if (e.target.matches('input[type="checkbox"][name="consent"]')) {
1497            handleConsentCheckbox(e.target);
1498        }
1499    });
1500
1501    function handleConsentCheckbox(checkbox) {
1502        const form = checkbox.closest('form');
1503        if (!form) return;
1504
1505        const submitBtn = form.querySelector('button[type="submit"], input[type="submit"]');
1506        if (!submitBtn) return;
1507
1508        submitBtn.disabled = !checkbox.checked;
1509
1510        if (checkbox.checked) {
1511            submitBtn.classList.remove('disabled', 'form__btn--disabled');
1512            submitBtn.style.opacity = '1';
1513            submitBtn.style.cursor = 'pointer';
1514        } else {
1515            submitBtn.classList.add('disabled', 'form__btn--disabled');
1516            submitBtn.style.opacity = '0.6';
1517            submitBtn.style.cursor = 'not-allowed';
1518        }
1519    }
1520
1521    document.querySelectorAll('input[type="checkbox"][name="consent"]').forEach(handleConsentCheckbox);
1522
1523    // rating
1524    const ratings = document.querySelectorAll(".rating");
1525    const articleID = document.querySelector('[name="f_id_article"]');
1526    const componentID = document.querySelector('[name="f_component_id"]');
1527    let articleIDValue = "";
1528    let componentIDValue = "";
1529
1530    if (articleID) {
1531        articleIDValue = articleID.value;
1532    }
1533
1534    if (componentID) {
1535        componentIDValue = componentID.value;
1536    }
1537
1538    if (ratings.length > 0) {
1539        initRatings();
1540    }
1541
1542    function initRatings() {
1543        let ratingActive, ratingValue, ratingText;
1544
1545        for (let i = 0; i < ratings.length; i += 1) {
1546            const rating = ratings[i];
1547            initRating(rating);
1548        }
1549    }
1550
1551    function initRating(rating) {
1552        initRatingVars(rating);
1553
1554        setRatingActiveWidth();
1555
1556        if (rating.classList.contains("rating__set")) {
1557            setRating(rating);
1558        }
1559    }
1560
1561    function initRatingVars(rating) {
1562        ratingActive = rating.querySelector(".rating__active");
1563        ratingValue = rating.querySelector(".rating__value");
1564        ratingText = rating.querySelector(".rating__text");
1565    }
1566
1567    function setRatingActiveWidth(
1568        index = ratingValue.innerHTML.replace(",", ".")
1569    ) {
1570        const ratingActiveWidth = index / 0.05;
1571        ratingActive.style.width = `${ratingActiveWidth}%`;
1572        if (ratingText) {
1573            ratingText.innerHTML = `Рекомендуют ${Math.round(ratingActiveWidth)}%`;
1574        }
1575    }
1576
1577    function setRating(rating) {
1578        const ratingItems = rating.querySelectorAll(".rating__item");
1579
1580        for (let i = 0; i < ratingItems.length; i += 1) {
1581            const ratingItem = ratingItems[i];
1582
1583            ratingItem.addEventListener("mouseenter", (e) => {
1584                initRatingVars(rating);
1585
1586                setRatingActiveWidth(ratingItem.value);
1587            });
1588
1589            ratingItem.addEventListener("mouseleave", (e) => {
1590                setRatingActiveWidth();
1591            });
1592
1593            ratingItem.addEventListener("click", (e) => {
1594                ratingItems.forEach((elem) => {
1595                    elem.style.pointerEvents = "none";
1596                });
1597                initRatingVars(rating);
1598
1599                ratingValue.innerHTML = i + 1;
1600                setRatingActiveWidth();
1601
1602                const formData = new FormData();
1603                formData.append("ID_ARTICLE", articleIDValue);
1604                formData.append("ID_COMPONENT", componentIDValue);
1605                formData.append("RATING", ratingValue.innerHTML);
1606
1607                fetch("/fetch/", {
1608                    method: "POST",
1609                    body: formData,
1610                }).then(async (response) => {
1611                    let responseResult = await response.text();
1612                    console.log(responseResult);
1613                });
1614            });
1615        }
1616    }
1617
1618    // article-navigation
1619    const articleNavigation = document.querySelector(".navigation-article");
1620
1621    if (articleNavigation) {
1622        const jsScrollBlockList = document.querySelectorAll(
1623            ".text-section h2, .text-section h3, .text-section h4, .text-section h5, .text-section h6"
1624        );
1625
1626        if (jsScrollBlockList.length > 0) {
1627            console.log("length: ", jsScrollBlockList.length);
1628            for (let i = 0; i < jsScrollBlockList.length; i += 1) {
1629                const jsScrollBlock = jsScrollBlockList[i];
1630                const titleBlock = jsScrollBlock.textContent;
1631                const articleNavigationList = document.querySelector(
1632                    ".navigation-article__list"
1633                );
1634                const articleNavigationItem = document.createElement("li");
1635                const articleNavigationLink = document.createElement("a");
1636                articleNavigationItem.classList.add("navigation-article__item");
1637                articleNavigationLink.classList.add("navigation-article__link");
1638                jsScrollBlock.setAttribute("id", `${i}`);
1639                articleNavigationLink.setAttribute("href", `#${i}`);
1640                articleNavigationLink.textContent = " " + titleBlock;
1641                articleNavigationItem.append(articleNavigationLink);
1642                articleNavigationList.append(articleNavigationItem);
1643            }
1644
1645            document.querySelectorAll('a[href^="#"').forEach((link) => {
1646                link.addEventListener("click", function (e) {
1647                    e.preventDefault();
1648
1649                    let href = this.getAttribute("href").substring(1);
1650
1651                    const scrollTarget = document.getElementById(href);
1652
1653                    // const topOffset = document.querySelector('.scrollto').offsetHeight;
1654                    const topOffset = 180;
1655                    const elementPosition = scrollTarget.getBoundingClientRect().top;
1656                    const offsetPosition = elementPosition - topOffset;
1657
1658                    window.scrollBy({
1659                        top: offsetPosition,
1660                        behavior: "smooth",
1661                    });
1662                });
1663            });
1664            if (jsScrollBlockList.length > 5) {
1665                let list = document.querySelector(".navigation-article__body");
1666                let arrow = document.createElement("div");
1667                arrow.classList.add("navigation-article__arrow");
1668                list.appendChild(arrow);
1669            }
1670        } else {
1671            articleNavigation.querySelector(".navigation-article").remove();
1672        }
1673    }
1674    const navigationListArrow = document.querySelectorAll(
1675        ".navigation-article__arrow"
1676    );
1677    if (navigationListArrow.length) {
1678        navigationListArrow.forEach((item) => {
1679            item.addEventListener("click", (e) => {
1680                e.target.parentNode.classList.add("open-mobile");
1681                e.target.style.display = "none";
1682            });
1683        });
1684    }
1685    //initPhoneMask();
1686    //initFormSender();
1687    // AOS.init({
1688    //     once: true,
1689    // });
1690});
1691
1692setTimeout(() => {
1693    const elements = document.querySelectorAll("[data-anim]");
1694    elements.forEach((element) => {
1695        const animClass = element.getAttribute("data-anim");
1696        if (animClass) {
1697            element.classList.add(animClass);
1698        }
1699    });
1700}, 3000);
1701
1702document.addEventListener('DOMContentLoaded', () => {
1703    const observerOptions = {
1704        threshold: 0.2
1705    };
1706
1707    const observer = new IntersectionObserver((entries) => {
1708        entries.forEach(entry => {
1709            if (entry.isIntersecting) {
1710                const bars = entry.target.querySelectorAll('.clinic-rating__bar');
1711                bars.forEach(bar => {
1712                    const targetWidth = bar.getAttribute('data-width');
1713                    bar.style.width = `${targetWidth}%`;
1714                });
1715                observer.unobserve(entry.target);
1716            }
1717        });
1718    }, observerOptions);
1719
1720    const statsBlock = document.querySelector('.clinic-rating__distribution');
1721    if (statsBlock) observer.observe(statsBlock);
1722
1723    const sessionKey = 'clinic_rating_data';
1724    const currentData = { score: 4.8, count: 1250 };
1725    
1726    if (!localStorage.getItem(sessionKey)) {
1727        localStorage.setItem(sessionKey, JSON.stringify(currentData));
1728    }
1729});
1730
1731
1732
1733document.addEventListener('DOMContentLoaded', function () {
1734  document.querySelectorAll('.literature__wrapper').forEach(function (wrapper) {
1735    var content = wrapper.querySelector('.literature__content');
1736    var toggle  = wrapper.querySelector('.literature__toggle');
1737    if (!content || !toggle) return;
1738
1739    var items = content.querySelectorAll('li');
1740    if (!items.length) return;
1741
1742    var isMobile = window.matchMedia('(max-width: 767px)').matches;
1743    var visibleCount = isMobile ? 3 : 8;
1744
1745    if (items.length <= visibleCount) {
1746      toggle.hidden = true;
1747      return;
1748    }
1749
1750    toggle.hidden = false;
1751    toggle.textContent = 'Показать все (' + items.length + ')';
1752
1753    toggle.addEventListener('click', function () {
1754      var isOpen = content.classList.toggle('is-open');
1755      toggle.textContent = isOpen
1756        ? 'Свернуть'
1757        : 'Показать все (' + items.length + ')';
1758    });
1759  });
1760});

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.