PageSourceSearch

https://gdekomfort.ru/resource/js/core6/rsplugins/cookie.js

js gdekomfort.ru collected 2026-10-05 02:25:59 UTC 1,269 bytes, 41 lines download raw bytes

1new class Cookie extends RsJsCore.classes.plugin {
2    /**
3     * Устанавливает значение в cookie
4     *
5     * @param name
6     * @param value
7     * @param options
8     */
9    setCookie(name, value, options = {}) {
10        options = {
11            path: '/',
12            expires: new Date( Date.now() + 750 * 24 * 60 * 60 * 1000),
13            ...options
14        };
15
16        if (options.expires instanceof Date) {
17            options.expires = options.expires.toUTCString();
18        }
19        let updatedCookie = encodeURIComponent(name) + "=" + encodeURIComponent(value);
20        for (let optionKey in options) {
21            updatedCookie += "; " + optionKey;
22            let optionValue = options[optionKey];
23            if (optionValue !== true) {
24                updatedCookie += "=" + optionValue;
25            }
26        }
27        document.cookie = updatedCookie;
28    }
29
30    /**
31     * Возвращает значение из cookie
32     * @param name
33     * @returns {any}
34     */
35    getCookie(name) {
36        let matches = document.cookie.match(new RegExp(
37            "(?:^|; )" + name.replace(/([\.$?*|{}\(\)\[\]\\\/\+^])/g, '\\$1') + "=([^;]*)"
38        ));
39        return matches ? decodeURIComponent(matches[1]) : undefined;
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.