PageSourceSearch

https://hockeyskates.ru/bitrix/templates/aspro-lite/js/custom.js?179040899512149

js hockeyskates.ru collected 2026-10-06 03:57:58 UTC 12,149 bytes, 431 lines download raw bytes

1$(document).ready(function() {
2	if (window.location.href.includes("nashi-partnery")) {
3	   $(".header__main-inner").hide();
4	   $(".mega-menu").hide();
5	   $(".phones").hide();
6	   $(".footer__info").hide();
7	   $(".header__bottom-part").hide();
8	   $(".mobileheader__inner").hide();
9    }
10});
11
12
13(function () {
14    'use strict';
15
16    var CONFIG = {
17        consentCookie: 'lx_cookie_consent_v3',
18        legacyCookie: 'cookies_policy',
19        previousConsentCookies: ['lx_cookie_consent_v1', 'lx_cookie_consent_v2'],
20        cookieDays: 365,
21        metrikaId: 94311453,
22        showDelayMs: 1000
23    };
24
25    var roots = [];
26    var metrikaInitialized = false;
27
28    function setCookie(name, value, days, domain) {
29        var maxAge = Math.floor(days * 24 * 60 * 60);
30        var cookie = name + '=' + encodeURIComponent(value) +
31            '; path=/' +
32            '; max-age=' + maxAge +
33            '; SameSite=Lax';
34
35        if (domain) {
36            cookie += '; domain=' + domain;
37        }
38
39        if (window.location.protocol === 'https:') {
40            cookie += '; Secure';
41        }
42
43        document.cookie = cookie;
44    }
45
46    function getCookie(name) {
47        var escapedName = name.replace(/([.$?*|{}()\[\]\\\/+^])/g, '\\$1');
48        var matches = document.cookie.match(new RegExp('(?:^|; )' + escapedName + '=([^;]*)'));
49        return matches ? decodeURIComponent(matches[1]) : null;
50    }
51
52    function deleteCookie(name, domain) {
53        var cookie = name + '=; path=/; max-age=0; SameSite=Lax';
54
55        if (domain) {
56            cookie += '; domain=' + domain;
57        }
58
59        if (window.location.protocol === 'https:') {
60            cookie += '; Secure';
61        }
62
63        document.cookie = cookie;
64    }
65
66    function deleteCookieEverywhere(name) {
67        var host = window.location.hostname;
68
69        deleteCookie(name);
70        deleteCookie(name, host);
71        deleteCookie(name, '.' + host);
72
73        var parts = host.split('.');
74        if (parts.length > 2) {
75            var baseDomain = parts.slice(-2).join('.');
76            deleteCookie(name, baseDomain);
77            deleteCookie(name, '.' + baseDomain);
78        }
79    }
80
81    function normalizeConsent(value) {
82        if (!value || typeof value !== 'object') {
83            return null;
84        }
85
86        if (
87            value.version !== 3 ||
88            typeof value.analytics !== 'boolean'
89        ) {
90            return null;
91        }
92
93        return {
94            version: 3,
95            necessary: true,
96            analytics: value.analytics
97        };
98    }
99
100    function writeConsent(consent) {
101        setCookie(
102            CONFIG.consentCookie,
103            JSON.stringify({
104                version: 3,
105                necessary: true,
106                analytics: Boolean(consent.analytics)
107            }),
108            CONFIG.cookieDays
109        );
110
111        /* Старые согласия намеренно НЕ мигрируются в аналитику. */
112        deleteCookieEverywhere(CONFIG.legacyCookie);
113        CONFIG.previousConsentCookies.forEach(deleteCookieEverywhere);
114    }
115
116    function readConsent() {
117        var raw = getCookie(CONFIG.consentCookie);
118
119        if (!raw) {
120            return null;
121        }
122
123        try {
124            return normalizeConsent(JSON.parse(raw));
125        } catch (error) {
126            deleteCookieEverywhere(CONFIG.consentCookie);
127            return null;
128        }
129    }
130
131    function deleteYandexCookies() {
132        [
133            '_ym_uid',
134            '_ym_d',
135            '_ym_isad',
136            '_ym_visorc'
137        ].forEach(deleteCookieEverywhere);
138    }
139
140    /*
141     * ВАЖНО:
142     * Эта функция вызывается ТОЛЬКО после consent.analytics === true.
143     * До этого момента <script src="https://mc.yandex.ru/metrika/tag.js"> не существует.
144     */
145    function ensureYandexApi() {
146        if (typeof window.ym !== 'function') {
147            window.ym = function () {
148                (window.ym.a = window.ym.a || []).push(arguments);
149            };
150            window.ym.l = 1 * new Date();
151        }
152
153        if (!document.querySelector('script[data-lx-yandex-metrika]')) {
154            var script = document.createElement('script');
155            script.async = true;
156            script.src = 'https://mc.yandex.ru/metrika/tag.js';
157            script.setAttribute('data-lx-yandex-metrika', '1');
158            document.head.appendChild(script);
159        }
160    }
161
162    function startYandexMetrika() {
163        if (metrikaInitialized || !CONFIG.metrikaId) {
164            return;
165        }
166
167        metrikaInitialized = true;
168        window.dataLayer = window.dataLayer || [];
169
170        ensureYandexApi();
171
172        window.ym(CONFIG.metrikaId, 'init', {
173            webvisor: true,
174            clickmap: true,
175            ecommerce: 'dataLayer',
176            referrer: document.referrer,
177            url: window.location.href,
178            accurateTrackBounce: true,
179            trackLinks: true
180        });
181    }
182
183    function stopYandexMetrika() {
184        if (metrikaInitialized && typeof window.ym === 'function') {
185            try {
186                window.ym(CONFIG.metrikaId, 'destruct');
187            } catch (error) {}
188        }
189
190        metrikaInitialized = false;
191        deleteYandexCookies();
192    }
193
194    function applyConsent(consent) {
195        if (consent && consent.analytics === true) {
196            startYandexMetrika();
197        } else {
198            stopYandexMetrika();
199        }
200    }
201
202    function showRoots() {
203		roots.forEach(function (root) {
204			root.hidden = false;
205			root.setAttribute('aria-hidden', 'false');
206
207			root.classList.remove('show');
208
209			requestAnimationFrame(function () {
210				requestAnimationFrame(function () {
211					root.classList.add('show');
212				});
213			});
214		});
215	}
216
217    function hideRoots() {
218        roots.forEach(function (root) {
219            root.classList.remove('show');
220            root.setAttribute('aria-hidden', 'true');
221            root.hidden = true;
222        });
223    }
224
225    function showView(name) {
226        roots.forEach(function (root) {
227            var views = root.querySelectorAll('[data-cookie-view]');
228
229            Array.prototype.forEach.call(views, function (view) {
230                view.hidden = view.getAttribute('data-cookie-view') !== name;
231            });
232        });
233    }
234
235    function updateToggleVisual(input, allowed) {
236        if (!input) {
237            return;
238        }
239
240        input.checked = Boolean(allowed);
241
242        var label = input.closest('.lx-cookie-consent__toggle');
243        var status = label ? label.querySelector('.lx-cookie-consent__toggle-label') : null;
244
245        if (status) {
246            status.textContent = allowed ? 'Разрешено' : 'Запрещено';
247        }
248    }
249
250    function syncToggleType(selector, allowed) {
251        roots.forEach(function (root) {
252            updateToggleVisual(root.querySelector(selector), allowed);
253        });
254    }
255
256    function syncPreferenceToggles(consent) {
257        syncToggleType('[data-cookie-analytics-toggle]', Boolean(consent && consent.analytics));
258    }
259
260    function syncTogglesFromSavedConsent() {
261        var consent = readConsent();
262
263        /* Если выбора ещё нет — аналитические cookie выключены. */
264        syncPreferenceToggles(consent || {
265            analytics: false
266        });
267    }
268
269    function saveAndClose(analyticsAllowed) {
270        var consent = {
271            version: 3,
272            necessary: true,
273            analytics: Boolean(analyticsAllowed)
274        };
275
276        writeConsent(consent);
277        syncPreferenceToggles(consent);
278        applyConsent(consent);
279        hideRoots();
280    }
281
282    function toggleCategory(button) {
283        var category = button.closest('.lx-cookie-consent__category');
284        if (!category) {
285            return;
286        }
287
288        var body = category.querySelector('.lx-cookie-consent__category-body');
289        var expanded = button.getAttribute('aria-expanded') === 'true';
290
291        button.setAttribute('aria-expanded', expanded ? 'false' : 'true');
292        category.classList.toggle('is-open', !expanded);
293
294        if (body) {
295            body.hidden = expanded;
296        }
297    }
298
299    function handleChange(event) {
300        var target = event.target;
301
302        if (target.matches('[data-cookie-analytics-toggle]')) {
303            syncToggleType('[data-cookie-analytics-toggle]', target.checked);
304        }
305    }
306
307    function handleClick(event) {
308        var root = event.currentTarget;
309        var target = event.target.closest('[data-cookie-action], [data-cookie-category-toggle]');
310
311        if (!target || !root.contains(target)) {
312            return;
313        }
314
315        if (target.hasAttribute('data-cookie-category-toggle')) {
316            toggleCategory(target);
317            return;
318        }
319
320        var action = target.getAttribute('data-cookie-action');
321
322        if (action === 'accept-all') {
323            /* «Принять все» = явное разрешение аналитических cookie. */
324            saveAndClose(true);
325            return;
326        }
327
328        if (action === 'reject-optional') {
329            saveAndClose(false);
330            return;
331        }
332
333        if (action === 'settings') {
334            syncTogglesFromSavedConsent();
335            showView('settings');
336            return;
337        }
338
339        if (action === 'back') {
340            showView('notice');
341            return;
342        }
343
344        if (action === 'confirm') {
345            var analyticsToggle = root.querySelector('[data-cookie-analytics-toggle]');
346
347            saveAndClose(Boolean(analyticsToggle && analyticsToggle.checked));
348        }
349    }
350
351    function openSettings() {
352        syncTogglesFromSavedConsent();
353        showView('settings');
354        showRoots();
355    }
356
357
358    /*
359     * Открытие настроек cookie из ссылки в футере.
360     * Использование:
361     * <a href="#" data-cookie-settings-link>Настройки cookie</a>
362     */
363    function bindExternalSettingsLinks() {
364        var links = document.querySelectorAll('[data-cookie-settings-link]');
365
366        Array.prototype.forEach.call(links, function (link) {
367            link.addEventListener('click', function (event) {
368                event.preventDefault();
369                openSettings();
370            });
371        });
372    }
373
374    function resetConsentForTesting() {
375        deleteCookieEverywhere(CONFIG.consentCookie);
376        deleteCookieEverywhere(CONFIG.legacyCookie);
377        CONFIG.previousConsentCookies.forEach(deleteCookieEverywhere);
378        stopYandexMetrika();
379        syncPreferenceToggles({ analytics: false });
380        showView('notice');
381        showRoots();
382    }
383
384    function init() {
385        roots = Array.prototype.slice.call(document.querySelectorAll('[data-cookie-consent-root]'));
386
387        if (!roots.length) {
388            return;
389        }
390
391        bindExternalSettingsLinks();
392
393        roots.forEach(function (root) {
394            root.addEventListener('click', handleClick, false);
395            root.addEventListener('change', handleChange, false);
396        });
397
398        /* Изначально аналитические cookie выключены. */
399        syncPreferenceToggles({
400            analytics: false
401        });
402
403        var consent = readConsent();
404
405        if (consent) {
406            syncPreferenceToggles(consent);
407            applyConsent(consent);
408            hideRoots();
409        } else {
410            /* Без нового согласия Метрика не создаётся и не запускается. */
411            stopYandexMetrika();
412            showView('notice');
413
414            window.setTimeout(function () {
415                showRoots();
416            }, CONFIG.showDelayMs);
417        }
418
419        window.LXCookieConsent = {
420            openSettings: openSettings,
421            getConsent: readConsent,
422            resetForTesting: resetConsentForTesting
423        };
424    }
425
426    if (document.readyState === 'loading') {
427        document.addEventListener('DOMContentLoaded', init, { once: true });
428    } else {
429        init();
430    }
431}());

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.