PageSourceSearch

https://centrluch.ru/local/templates/rossait/js/cookie-popup.js

js centrluch.ru collected 2026-10-08 03:27:43 UTC 1,315 bytes, 41 lines download raw bytes

1function getCookie(name) {
2    let match = document.cookie.match(new RegExp("(^| )" + name + "=([^;]+)"));
3    return match ? decodeURIComponent(match[2]) : null;
4}
5function setCookie(name, value, days) {
6    let expires = "";
7    if (days) {
8        let date = new Date();
9        date.setTime(date.getTime() + days * 24 * 60 * 60 * 1000);
10        expires = "; expires=" + date.toUTCString();
11    }
12    document.cookie = name + "=" + encodeURIComponent(value) + expires + "; path=/; Secure; SameSite=Lax";
13}
14
15    const popup = document.getElementById("cookie-popup");
16    const acceptButton = document.getElementById("accept-cookie");
17    function handleInitialLoad() {
18        let cookieAccepted = getCookie("cookieAccepted");
19
20
21        if (!cookieAccepted ) {
22            setCookie("cookieAccepted", "0", 365);
23            if(popup)
24            popup.style.display = "block";
25        } else {
26            if (cookieAccepted == 1 ) {
27                if(popup) popup.style.display = "none";
28            }
29        }
30    }
31
32
33    handleInitialLoad();
34
35    if (acceptButton && popup) {
36        acceptButton.addEventListener("click", function () {
37            document.cookie = setCookie("cookieAccepted", "1", 365);
38            popup.style.display = "none";
39        });
40    }
41

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.