PageSourceSearch

https://cdn.atodomotor.com/assets/js/main_2025.js

js atodomotor.com collected 2026-10-01 11:32:34 UTC 4,685 bytes, 146 lines download raw bytes

1document.addEventListener("DOMContentLoaded", () => {
2    setupImageFooters();
3    setupStickyElement();
4    setupCategoriesScroll();
5    setupHideIfEmpty();
6    setupCollapsibleContent();
7    setupTooltip();
8});
9
10function setupStickyElement() {
11    const stickyElement = document.querySelector(".sticky-scroll-block");
12
13    if (stickyElement) {
14        const headerHeight = parseFloat(getComputedStyle(document.documentElement).getPropertyValue("--header-height"));
15
16        window.addEventListener("scroll", () => {
17            const stickyTop = stickyElement.getBoundingClientRect().top;
18            if (stickyTop <= headerHeight) {
19                stickyElement.classList.add("sticky-move");
20            } else {
21                stickyElement.classList.remove("sticky-move");
22            }
23        });
24    }
25}
26
27function setupImageFooters()
28{
29    document.querySelectorAll("article .artContImg").forEach(function (container) {
30        var imageAltText = container.querySelector("img")?.getAttribute("alt");
31
32        if (imageAltText) {
33            var footer = container.querySelector(".artImgFooter");
34            if (footer) {
35                footer.textContent = imageAltText;
36            }
37        } else {
38            var footer = container.querySelector(".artImgFooter");
39            if (footer) {
40                footer.remove();
41            }
42        }
43    });
44}
45
46function setupCategoriesScroll()
47{
48    const categoriesLists = document.querySelectorAll(".badges-swipe");
49
50    categoriesLists.forEach(categoriesList => {
51        const activeItem = categoriesList.querySelector(".badges-item.is-active");
52
53        if (categoriesList && activeItem) {
54            const containerWidth = categoriesList.offsetWidth;
55            const itemWidth = activeItem.offsetWidth;
56            const itemOffsetLeft = activeItem.offsetLeft;
57
58            const scrollPosition = itemOffsetLeft - (containerWidth / 2) + (itemWidth / 2);
59
60            categoriesList.scrollTo({
61                left: scrollPosition
62            });
63        }
64    });
65}
66
67function setupHideIfEmpty()
68{
69    const articleMore = document.querySelector(".hide-if-empty");
70    
71    if (articleMore && articleMore.textContent.trim() === "") {
72        articleMore.style.display = "none";
73    }
74}
75
76function setupCollapsibleContent()
77{
78    const collapsibles = document.querySelectorAll(".collapsible");
79
80    collapsibles.forEach((collapsible) => {
81        const header = collapsible.querySelector(".collapsible-header");
82        header.addEventListener("click", () => {
83            collapsible.classList.toggle("active");
84        });
85    });
86}
87
88function setupTooltip()
89{
90    document.querySelectorAll(".isTooltip, .statusCountRN, .statusCountRT, .statusCountAR")
91    .forEach(element => {
92      element.addEventListener("mouseenter", (e) => {
93        let tooltipText = element.getAttribute("title");
94        if (!tooltipText) return;
95  
96        let placement = element.getAttribute("data-placement") || "top";
97  
98        let tooltip = document.createElement("div");
99        tooltip.className = "custom-tooltip";
100        tooltip.textContent = tooltipText;
101        document.body.appendChild(tooltip);
102  
103        let rect = element.getBoundingClientRect();
104  
105        let left = 0, top = 0;
106        if (placement === "left") {
107          left = rect.left + window.scrollX - tooltip.offsetWidth - 5;
108          top = rect.top + window.scrollY + (rect.height - tooltip.offsetHeight) / 2;
109        } else if (placement === "right") {
110          left = rect.right + window.scrollX + 5;
111          top = rect.top + window.scrollY + (rect.height - tooltip.offsetHeight) / 2;
112        } else if (placement === "bottom") {
113          left = rect.left + window.scrollX + (rect.width - tooltip.offsetWidth) / 2;
114          top = rect.bottom + window.scrollY + 5;
115        } else { // top (default)
116          left = rect.left + window.scrollX + (rect.width - tooltip.offsetWidth) / 2;
117          top = rect.top + window.scrollY - tooltip.offsetHeight - 2;
118        }
119  
120        tooltip.style.left = `${left}px`;
121        tooltip.style.top = `${top}px`;
122  
123        element._tooltipElement = tooltip;
124      });
125  
126      element.addEventListener("mouseleave", (e) => {
127        if (element._tooltipElement) {
128          element._tooltipElement.remove();
129          element._tooltipElement = null;
130        }
131      });
132    });
133}
134
135function setupLanguageFlags(language) {
136    const flags = document.querySelectorAll(".lang-flag");
137
138    flags.forEach(flag => {
139        flag.classList.remove("active-flag");
140    });
141
142    const activeFlag = document.getElementById(`flag_${language}`);
143    if (activeFlag) {
144        activeFlag.classList.add("active-flag");
145    }
146}

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.