PageSourceSearch

https://turuhan-avia.ru/wp-content/themes/newaero-2026/js/custom.js?ver=2026.05.23.2

js turuhan-avia.ru collected 2026-10-03 18:57:23 UTC 6,881 bytes, 187 lines download raw bytes

1jQuery(document).ready(function(){
2
3  	jQuery('.nav_top_s_sub').click(
4         function() {
5        var $button = jQuery(this);
6        var $menu = jQuery('#' + $button.attr('aria-controls'));
7        var isOpen = !$menu.hasClass('nav_top_s_vup_active');
8
9        $menu.toggleClass('nav_top_s_vup_active', isOpen);
10        $button.attr('aria-expanded', isOpen ? 'true' : 'false');
11   		return false;
12         });
13
14    jQuery('.entry table').each(function() {
15        var $table = jQuery(this);
16        var $thead = $table.children('thead').first();
17        var $headerRow = $thead.length ? $thead.find('tr').first() : $table.find('tr').first();
18        var $dataRows = $thead.length ? $table.children('tbody').children('tr') : $table.find('tr').not($headerRow);
19        var labels = [];
20
21        $table.addClass($thead.length ? 'modern-table-has-thead' : 'modern-table-no-thead');
22
23        $headerRow.children('th, td').each(function() {
24            labels.push(jQuery(this).text().replace(/\s+/g, ' ').trim());
25        });
26
27        if (labels.length > 1) {
28            $table.addClass('modern-card-table');
29            $dataRows.each(function() {
30                jQuery(this).children('th, td').each(function(index) {
31                    if (labels[index]) {
32                        jQuery(this).attr('data-label', labels[index]);
33                    }
34                });
35            });
36        }
37
38        if (!$table.parent().hasClass('modern-table-scroll')) {
39            $table.wrap('<div class="modern-table-scroll"></div>');
40        }
41    });
42    var bottomWidgets = document.querySelectorAll('.ajax_here2');
43    var appendScriptFromTemplate = function(bottomWidget) {
44        var template = bottomWidget.querySelector('template.newaero-widget-template');
45
46        if (!template) {
47            return false;
48        }
49
50        var scripts = template.content ? template.content.querySelectorAll('script[src], script[data-rocket-src]') : [];
51
52        scripts.forEach(function(sourceScript) {
53            var script = document.createElement('script');
54            var sourceSrc = sourceScript.getAttribute('src') || sourceScript.getAttribute('data-rocket-src') || '';
55
56            Array.prototype.forEach.call(sourceScript.attributes, function(attribute) {
57                if (attribute.name === 'src' || attribute.name === 'data-rocket-src' || attribute.name === 'data-rocket-type' || attribute.name === 'data-rocket-defer') {
58                    return;
59                }
60
61                if (attribute.name === 'type' && attribute.value === 'rocketlazyloadscript') {
62                    return;
63                }
64
65                script.setAttribute(attribute.name, attribute.value);
66            });
67
68            if (sourceSrc) {
69                script.src = sourceSrc;
70                bottomWidget.appendChild(script);
71            }
72        });
73
74        template.remove();
75        return scripts.length > 0;
76    };
77
78    var loadBottomWidget = function(bottomWidget) {
79        if (!bottomWidget || bottomWidget.dataset.loaded === 'true') {
80            return;
81        }
82
83        if (appendScriptFromTemplate(bottomWidget)) {
84            bottomWidget.dataset.loaded = 'true';
85            return;
86        }
87
88        var widgetSrc = bottomWidget.getAttribute('data-widget-src') || window.newaeroBottomWidgetSrc || '';
89        if (!widgetSrc) {
90            return;
91        }
92
93        var script = document.createElement('script');
94        script.charset = 'utf-8';
95        script.async = true;
96        script.src = widgetSrc;
97        bottomWidget.dataset.loaded = 'true';
98        bottomWidget.appendChild(script);
99    };
100
101    bottomWidgets.forEach(function(bottomWidget) {
102        if ('IntersectionObserver' in window) {
103            var bottomWidgetObserver = new IntersectionObserver(function(entries) {
104                if (entries[0] && entries[0].isIntersecting) {
105                    bottomWidgetObserver.disconnect();
106                    loadBottomWidget(bottomWidget);
107                }
108            }, { rootMargin: '640px 0px' });
109
110            bottomWidgetObserver.observe(bottomWidget);
111        } else {
112            window.setTimeout(function() {
113                loadBottomWidget(bottomWidget);
114            }, 1600);
115        }
116    });
117
118    var localizeReviewerUi = function(root) {
119        var scope = root && root.querySelectorAll ? root : document;
120
121        scope.querySelectorAll('.rwp-more-urs-btn').forEach(function(button) {
122            if (/^\s*show more\s*$/i.test(button.textContent || '')) {
123                button.textContent = 'Показать еще';
124            }
125        });
126    };
127
128    localizeReviewerUi(document);
129
130    if ('MutationObserver' in window) {
131        var reviewerObserver = new MutationObserver(function(mutations) {
132            mutations.forEach(function(mutation) {
133                mutation.addedNodes.forEach(function(node) {
134                    if (node.nodeType === 1) {
135                        localizeReviewerUi(node);
136                    }
137                });
138            });
139        });
140
141        reviewerObserver.observe(document.body, { childList: true, subtree: true });
142    }
143
144    var stickyTicketCta = document.querySelector('[data-mobile-ticket-cta]');
145    if (stickyTicketCta) {
146        var stickyTicketFooter = document.querySelector('.top-footer') || document.querySelector('footer');
147        var isStickyTicketNearFooter = function() {
148            if (!stickyTicketFooter) {
149                return false;
150            }
151
152            var footerRect = stickyTicketFooter.getBoundingClientRect();
153            return footerRect.top < window.innerHeight - 8 && footerRect.bottom > 0;
154        };
155
156        var updateStickyTicketCta = function() {
157            var isMobile = !window.matchMedia || window.matchMedia('(max-width: 788px)').matches;
158            var isNearFooter = isMobile && isStickyTicketNearFooter();
159            var shouldShow = isMobile && window.scrollY > Math.min(520, window.innerHeight * 0.72) && !isNearFooter;
160
161            document.body.classList.toggle('mobile-ticket-cta-near-footer', isNearFooter);
162            stickyTicketCta.classList.toggle('is-visible', shouldShow);
163        };
164
165        updateStickyTicketCta();
166        window.addEventListener('scroll', updateStickyTicketCta, { passive: true });
167        window.addEventListener('resize', updateStickyTicketCta);
168    }
169
170    document.addEventListener('click', function(event) {
171        if (!event.target.closest || !window.dataLayer || !Array.isArray(window.dataLayer)) {
172            return;
173        }
174
175        var ctaLink = event.target.closest('[data-cta-location]');
176        if (!ctaLink || !ctaLink.href) {
177            return;
178        }
179
180        window.dataLayer.push({
181            event: 'ticket_cta_click',
182            cta_location: ctaLink.getAttribute('data-cta-location'),
183            cta_url: ctaLink.href
184        });
185    });
186
187	});

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.