PageSourceSearch

https://www.kinderhulp-afrika.nl/ui/uibase/script/setcookie.js?r=ygq_l-DgCyk

js kinderhulp-afrika.nl collected 2026-10-06 07:30:59 UTC 4,446 bytes, 168 lines download raw bytes

1// Define global variables that will hold the cookie functions
2let setCookie;
3let setDataControllerCookie;
4let getCookie;
5let deleteCookie;
6let isForcedCookieType;
7let maySetCookieType;
8let maySetCookieDataController;
9let mayNotSetCookieCallback = function (name, value, controller, type) {
10    return '';
11};
12
13let Cookie = {
14    'TYPE_FUNCTIONAL': 1,
15    'TYPE_TRACKING': 2,
16    'TYPE_STATISTICS': 4,
17    'TYPE_EXTERNAL': 8,
18    'TYPE_PREFERENCES': 16,
19    'forcedTypes': 1,
20    'allowedTypes': 1,
21    'allowedDataControllers': []
22};
23
24(function () {
25    let cookieJar = '' + window.document.cookie;
26
27    /**
28     * @param name
29     * @param value
30     * @param type One of the Cookie.TYPE_* integers
31     * @param expires Date or number in seconds
32     * @param path
33     * @param domain
34     * @param secure
35     * @return string
36     * @private
37     */
38    setCookie = function (name, value, type, expires, path, domain, secure)
39    {
40        return setDataControllerCookie(name, value, 'procurios', type, expires, path, domain, secure);
41    };
42
43    /**
44     * @param name
45     * @param value
46     * @param {string} controller
47     * @param type One of the Cookie.TYPE_* integers
48     * @param expires Date or number in seconds
49     * @param path
50     * @param domain
51     * @param secure
52     * @return string
53     * @private
54     */
55    setDataControllerCookie = function (name, value, controller, type, expires, path, domain, secure) {
56        if (!maySetCookieType(type)) {
57            return mayNotSetCookieCallback(name, value, controller, type);
58        }
59        if (!isForcedCookieType(type) && !maySetCookieDataController(controller)) {
60            return mayNotSetCookieCallback(name, value, controller, type);
61        }
62
63        let cookieString = name + '=' + escape(value);
64        let expireString = '';
65
66        // Remove this cookie from the local cookie jar
67        const re = new RegExp('((^|;)\\s*' + name + '=[^;]*|' + name + '=[^;]*($|;))');
68        cookieJar = cookieJar.replace(re, '');
69
70        // Evaluate the expires argument to a Date object
71        if (typeof expires === 'string' && (/^\d+$/).test(expires)) {
72            expires = parseInt(expires, 10);
73        }
74
75        if (expires instanceof Date) {
76            expireString = expires.toUTCString();
77        } else if (typeof (expires) === 'number') {
78            let currentDate = new Date();
79            expires = new Date(currentDate.getTime() + (expires * 1e3));
80            expireString = expires.toUTCString();
81        }
82
83        // Add the cookie to the local cookie jar if it expires in the future
84        if (!expireString || new Date() < expires) {
85            cookieJar += '; ' + cookieString;
86        }
87
88        // Add other parts to the cookie string
89        if (expireString) {
90            cookieString += ';expires=' + expireString;
91        }
92
93        if (!path) {
94            path = '/';
95        }
96        cookieString += ';path=' + path;
97
98        if (domain) {
99            cookieString += ';domain=' + domain;
100        }
101
102        if (secure) {
103            cookieString += ';secure';
104        }
105
106        // Set the real cookie
107        return window.document.cookie = cookieString;
108    };
109
110    /**
111     * @param name
112     * @return string|null
113     */
114    getCookie = function (name)
115    {
116        let start = cookieJar.indexOf(name + '=');
117        let len = start + name.length + 1;
118
119        if ((!start) && (name !== cookieJar.substring(0, name.length))) {
120            return null;
121        }
122
123        if (start === -1) {
124            return null;
125        }
126
127        let end = cookieJar.indexOf(';', len);
128
129        if (end === -1) {
130            end = cookieJar.length;
131        }
132
133        return unescape(cookieJar.substring(len, end));
134    };
135
136    /**
137     * @param name
138     * @param path
139     * @param domain
140     * @return string
141     */
142    deleteCookie = function (name, path, domain)
143    {
144        return setCookie(name, '', Cookie.TYPE_FUNCTIONAL, -1, path, domain);
145    };
146
147    /**
148     * @param type
149     * @return {Boolean}
150     */
151    isForcedCookieType = function (type)
152    {
153        return (Cookie.forcedTypes & type) !== 0;
154    };
155
156    /**
157     * @param type
158     * @return {Boolean}
159     */
160    maySetCookieType = function (type)
161    {
162        return (Cookie.allowedTypes & type) !== 0;
163    };
164
165    maySetCookieDataController = function (vendor) {
166        return Cookie.allowedDataControllers.indexOf(vendor) !== -1;
167    };
168}());

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.