PageSourceSearch

https://www.samoter.it/packages/evelean/js/evelean_cookiemanager.j…=ca17add95b11d1baf3d74fcd3fa4637fb02c14ba

js samoter.it collected 2026-10-04 15:30:08 UTC 2,779 bytes, 103 lines download raw bytes

1function getKeyInCookie(cookiename, key)  {
2    //console.log('chiamato getKeyInCookie ',[cookiename, key]);
3    let c = getCookie(cookiename);
4    if (c) {
5        let obj_c = JSON.parse(c);
6        let ks = key.split('.');
7        for (let i = 0; i < ks.length - 1; i++) {
8            if (typeof obj_c == typeof undefined) return undefined;
9            
10            obj_c = obj_c[ks[i]];
11        }
12        
13        if (typeof obj_c == typeof undefined || obj_c == null) return undefined;
14        
15        return obj_c[ks[i]];
16    } else {
17        return null;
18    }
19}
20
21function deleteKeyInCookie(cookiename, key)  {
22    let c = getCookie(cookiename);
23    if (c) {
24        let obj_c = JSON.parse(c);
25        delete obj_c[key];
26        setCookie(cookiename, JSON.stringify(obj_c), 30);
27    }
28}
29
30function setKeyInCookie(cookiename, key, val, retain) {
31    let c;
32    let ct = getCookie(cookiename);
33
34    if (ct.length > 0) {
35        c = JSON.parse(ct);
36    } else {
37        c = {};
38    }
39
40    let count = (key.match(/\./g) || []).length;
41    if (count > 0) {
42        key = '"'+key.replace(/\./g, '":{"')+'"';
43    } else {
44        key = '"'+key+'"';
45    }
46    if (typeof val === 'object') {
47        key += ':'+JSON.stringify(val);
48    } else {
49        key += ':"'+val+'"';
50    } 
51    for(let i = 0; i < count; i ++) {
52        key += '}';
53    }
54
55    key = '{'+key+'}';
56
57    let newset = JSON.parse(key);
58    c = mergeDeep(c, newset);
59
60    setCookie(cookiename, JSON.stringify(c), retain);
61}
62
63function isObject(item) {
64    return (item && typeof item === 'object' && !Array.isArray(item));
65}
66
67function mergeDeep(target, source) {
68    let output = Object.assign({}, target);
69    if (isObject(target) && isObject(source)) {
70        Object.keys(source).forEach(key => {
71            if (isObject(source[key])) {
72                if (!(key in target))
73                    Object.assign(output, {[key]: source[key]});
74                else
75                    output[key] = mergeDeep(target[key], source[key]);
76            } else {
77                Object.assign(output, {[key]: source[key]});
78            }
79        });
80    }
81    return output;
82}
83
84function getCookie(cookiename)  {
85    let cookiestring=RegExp(""+cookiename+"[^;]+").exec(document.cookie);
86    return decodeURIComponent(!!cookiestring ? cookiestring.toString().replace(/^[^=]+./,"") : "");
87}
88
89function setCookie(name,value,retain) {
90    let expires = '';
91    if (retain) {
92        let date = new Date();
93        date.setTime(date.getTime() + (retain*24*60*60*1000));
94        expires = '; expires=' + date.toUTCString();
95    }
96
97    let secure = '';
98    if (location.protocol === 'https:') {
99        secure = ' secure;';
100    }
101
102    document.cookie = name + '=' + (value || '')  + expires + '; SameSite=Strict; path=/;'+secure;
103}

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.