PageSourceSearch

https://eanews.ru/assets/app_feeds-a568a32037bf591c237deb50bf14bb5daa397195be13a944af3125311c642130.js

js eanews.ru collected 2026-10-01 08:40:27 UTC 6,708 bytes, 167 lines download raw bytes

1document.addEventListener('DOMContentLoaded', function() {
2    const reglinks = document.querySelectorAll('.regions li a');
3    reglinks.forEach(function(link) {
4        link.addEventListener('click', function(event) {
5            const url = event.target.href;
6            const reg = url.substring(url.lastIndexOf('/') + 1);
7            const exp = reg === '' ? 'Thu, 01 Jan 1970 00:00:00 GMT' : 'Fri, 31 Dec 9999 23:59:59 GMT';
8            const val = reg === '' ? 'reg=rossiya'  : 'reg=' + reg;
9            document.cookie = val + '; expires=' + exp + '; sameSite=Lax; path=/';
10        });
11    });
12});
13const loadNextPage = function() {
14    const nextLink = document.getElementById('next_link');
15    if (!nextLink || nextLink.dataset.loading) return;
16    const items = document.getElementById('items');
17
18    const wBottom  = window.pageYOffset + window.innerHeight;
19    const elBottom = items.offsetTop + items.offsetHeight;
20
21    if (wBottom > (elBottom - 350)) {
22        nextLink.click();
23        nextLink.dataset.loading = true;
24    }
25};
26
27window.addEventListener('resize', loadNextPage);
28window.addEventListener('scroll', loadNextPage);
29window.addEventListener('load', loadNextPage);
30
31document.addEventListener('click', function(e) {
32    if (e.target.id !== 'next_link') return;
33
34    e.preventDefault();
35
36    const url = e.target.getAttribute('href');
37    const headers = {
38        'Accept': 'application/javascript',
39        'X-Requested-With': 'XMLHttpRequest'
40    };
41    if (e.target.dataset.feed) {
42        headers['Feed'] = e.target.dataset.feed;
43    }
44
45    const fetchData = (attempt = 1) => {
46        fetch(url, {
47            method: 'GET',
48            headers: headers,
49        })
50            .then(response => {
51                if (!response.ok) {
52                    throw new Error('Network response was not ok');
53                }
54                return response.text();
55            })
56            .then(jsCode => {
57                eval(jsCode);
58                e.target.dataset.loading = false; // Снимаем флаг загрузки
59            })
60            .catch(error => {
61                if (attempt < 3) {
62                    setTimeout(() => fetchData(attempt + 1), 2000);
63                } else {
64                    e.target.dataset.loading = false; // Снимаем флаг загрузки
65                }
66            });
67    };
68    fetchData();
69});
70document.addEventListener('DOMContentLoaded', () => {
71    const isYandexBrowser = /yabrowser/i.test(navigator.userAgent);
72    const isMobileDevice = /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent);
73
74    if (isYandexBrowser && isMobileDevice) return;
75
76    const btn = document.getElementById('scrollBtn');
77   // const menu = document.getElementById('menu');
78    let lastScrollTop = 0;
79
80    const scrollFunction = () => {
81        const scrollTop = window.pageYOffset || document.documentElement.scrollTop;
82        const isScrollingDown = scrollTop > lastScrollTop && scrollTop > 20;
83        const isScrollingUp = scrollTop < lastScrollTop && scrollTop > 20;
84
85      //  menu.classList.toggle('visbl', isScrollingUp);
86        btn.classList.toggle('visbl', isScrollingUp);
87     //   menu.classList.toggle('hid', isScrollingDown || !isScrollingUp);
88        btn.classList.toggle('hid', isScrollingDown || !isScrollingUp);
89
90
91        lastScrollTop = scrollTop;
92
93        if (isScrollingUp) {
94            clearTimeout(btn.timeoutId);
95            btn.timeoutId = setTimeout(() => {
96          //      menu.classList.remove('visbl');
97                btn.classList.remove('visbl');
98        //        menu.classList.add('hid');
99                btn.classList.add('hid');
100            }, 2600);
101        }
102    };
103
104    window.onscroll = scrollFunction;
105
106    btn.addEventListener('click', () => {
107        window.scrollTo({ top: 0, behavior: 'smooth' });
108    });
109});
110document.addEventListener('DOMContentLoaded', function() {
111    const key = '_ean_cookieExpTime'
112    if (checkCookieExpTime(key)) {
113        const notify = document.createElement('div');
114        notify.id = 'cookie-notify';
115        notify.innerHTML = `<p>На сайте используются cookie-файлы и сервис для анализа данных Яндекс.Метрика. Эти инструменты помогают улучшать работу сайта, понимать интересы наших пользователей и оптимизировать контент. Вся информация обрабатывается в обезличенном виде и используется только для статистического анализа. Продолжая использовать сайт, вы соглашаетесь с нашей <a href="/privacy-policy">Политикой обработки персональных данных</a>.</p>
116                    <button id="cookie-accept">Принимаю</button>`;
117        document.body.appendChild(notify);
118
119        document.getElementById('cookie-accept').addEventListener('click', function() {
120            const expTime = new Date().getTime() + (30 * 24 * 60 * 60 * 1000);
121            localStorage.setItem(key, expTime);
122            notify.remove();
123        });
124    }
125});
126
127function checkCookieExpTime(key) {
128    const expTime = localStorage.getItem(key);
129    if (!expTime) return true;
130
131    const currentTime = new Date().getTime();
132
133    if (currentTime < expTime) {
134        return false;
135    } else {
136        localStorage.removeItem(key);
137        return true;
138    }
139};
140document.addEventListener('DOMContentLoaded', () => {
141
142    const key = '_ean_cookieExpTime';
143    const viewKey = '_ean_expTgBanner';
144
145    if (!checkCookieExpTime(key) && checkCookieExpTime(viewKey)) {
146        const tgLink = document.querySelector('.ico.max');
147        const tgHref = tgLink ? tgLink.getAttribute('href') : 'https://max.ru/eanews';
148        let container = document.createElement('div');
149        container.id = 'subscribe';
150        document.body.appendChild(container);
151        container.innerHTML = `<a href="${tgHref}" rel="nofollow noopener noreferrer" target="_blank"><div class="title">Подписывайся на канал ЕАН в Max</div><div class="desc">У всех контент, а у нас – новости</div></a><span class="close"></span>`;
152    const close = container.querySelector('.close');
153
154    if (close) {
155        close.addEventListener('click', function() {
156            container.style.display = 'none';
157            const viewTime = new Date().getTime() + (2 * 24 * 60 * 60 * 1000);
158            localStorage.setItem(viewKey, viewTime);
159            container.remove();
160        });
161     }
162    }
163});
164
165
166
167

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.