PageSourceSearch

https://schiedel.com.ru/wp-content/themes/schiedel/js/tabvideo.js?ver=1.0.0

js schiedel.com.ru collected 2026-10-09 23:11:07 UTC 4,408 bytes, 111 lines download raw bytes

1document.addEventListener('DOMContentLoaded', () => {
2    const tabsvBlocks = document.querySelectorAll('.tabs-video');
3
4    if (!tabsvBlocks || tabsvBlocks.length === 0) {
5        console.log('No tabs-video blocks found on the page');
6        return;
7    }
8
9    tabsvBlocks.forEach((tabsv, index) => {
10        if (!tabsv) {
11            console.log(`Block ${index}: tabsv element is null`);
12            return;
13        }
14
15        const tabsBtnv = tabsv.querySelectorAll('.tabs__btn-v');
16        const tabsContentv = tabsv.querySelectorAll('.tabs__content-v');
17
18        // Если нет кнопок или контента, пропускаем этот блок
19        if (!tabsBtnv || !tabsContentv || !tabsBtnv.length || !tabsContentv.length) {
20            console.log(`Block ${index}: No buttons or content found`);
21            return;
22        }
23
24        // Если только одна вкладка, просто активируем ее
25        if (tabsBtnv.length === 1) {
26            console.log(`Block ${index}: Single tab mode`);
27            const firstBtn = tabsBtnv[0];
28            const firstContent = tabsContentv[0];
29            
30            if (firstBtn && firstContent) {
31                if (!firstBtn.classList.contains('tabs__btn-v--active')) {
32                    firstBtn.classList.add('tabs__btn-v--active');
33                }
34                if (!firstContent.classList.contains('tabs__content-v--active')) {
35                    firstContent.classList.add('tabs__content-v--active');
36                }
37            }
38            return;
39        }
40
41        console.log(`Block ${index}: Multiple tabs mode, found ${tabsBtnv.length} tabs`);
42
43        // Для блоков с несколькими вкладками
44        const tabsHandlerv = (path) => {
45            if (!path) {
46                console.log(`Block ${index}: No path provided for tab switch`);
47                return;
48            }
49
50            console.log(`Block ${index}: Switching to tab ${path}`);
51            
52            // Сначала скрываем все контенты
53            tabsContentv.forEach(content => {
54                if (content && content.classList) {
55                    content.classList.remove('tabs__content-v--active');
56                }
57            });
58
59            // Затем показываем нужный контент
60            const targetContent = tabsv.querySelector(`[data-vid-target="${path}"]`);
61            if (targetContent && targetContent.classList) {
62                targetContent.classList.add('tabs__content-v--active');
63            } else {
64                console.log(`Block ${index}: Target content not found for path ${path}`);
65            }
66        };
67
68        // Добавляем обработчик клика на весь блок
69        tabsv.addEventListener('click', (e) => {
70            if (!e || !e.target) return;
71
72            const targetBtn = e.target.closest('.tabs__btn-v');
73            if (!targetBtn) {
74                console.log(`Block ${index}: Click outside tab button`);
75                return;
76            }
77
78            const tabsPathv = targetBtn.dataset.tabsVideo;
79            if (!tabsPathv) {
80                console.log(`Block ${index}: No data-tabs-video attribute found`);
81                return;
82            }
83
84            console.log(`Block ${index}: Tab clicked, path: ${tabsPathv}`);
85
86            // Убираем активный класс у всех кнопок
87            tabsBtnv.forEach(btn => {
88                if (btn && btn.classList) {
89                    btn.classList.remove('tabs__btn-v--active');
90                }
91            });
92
93            // Добавляем активный класс нажатой кнопке
94            if (targetBtn.classList) {
95                targetBtn.classList.add('tabs__btn-v--active');
96            }
97            
98            // Переключаем контент
99            tabsHandlerv(tabsPathv);
100        });
101
102        // Активируем первую вкладку при инициализации
103        const firstBtn = tabsBtnv[0];
104        if (firstBtn) {
105            const firstPath = firstBtn.dataset.tabsVideo;
106            if (firstPath) {
107                tabsHandlerv(firstPath);
108            }
109        }
110    });
111});

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.