PageSourceSearch

https://rule15.ru/js/cookie-banner.js?v=2

js rule15.ru collected 2026-09-30 03:07:16 UTC 1,565 bytes, 50 lines download raw bytes

1(function () {
2    var STORAGE_KEY = 'rule15s_cookie_consent';
3    var STORAGE_VALUE = 'accepted';
4    var COOKIE_MAX_AGE_DAYS = 365;
5
6    function hasConsent() {
7        try {
8            if (window.localStorage && localStorage.getItem(STORAGE_KEY) === STORAGE_VALUE) {
9                return true;
10            }
11        } catch (e) {}
12        return document.cookie.indexOf(STORAGE_KEY + '=' + STORAGE_VALUE) !== -1;
13    }
14
15    function persistConsent() {
16        try {
17            if (window.localStorage) {
18                localStorage.setItem(STORAGE_KEY, STORAGE_VALUE);
19            }
20        } catch (e) {}
21        var expires = new Date();
22        expires.setTime(expires.getTime() + COOKIE_MAX_AGE_DAYS * 24 * 60 * 60 * 1000);
23        document.cookie = STORAGE_KEY + '=' + STORAGE_VALUE
24            + '; expires=' + expires.toUTCString()
25            + '; path=/; SameSite=Lax';
26    }
27
28    function init() {
29        var banner = document.getElementById('cookie-banner');
30        var button = document.getElementById('cookie-banner-accept');
31        if (!banner || !button) return;
32        if (hasConsent()) return;
33
34        banner.hidden = false;
35
36        button.addEventListener('click', function () {
37            persistConsent();
38            banner.hidden = true;
39            try {
40                document.dispatchEvent(new CustomEvent('r15:cookie-consent'));
41            } catch (e) {}
42        });
43    }
44
45    if (document.readyState === 'loading') {
46        document.addEventListener('DOMContentLoaded', init);
47    } else {
48        init();
49    }
50})();

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.