PageSourceSearch

https://www.food-supply.dk/js/cookie-utilities.js

js food-supply.dk collected 2026-10-02 11:42:02 UTC 1,431 bytes, 52 lines download raw bytes

1function setCookie(cname, cvalue, exdays) {
2    var d = new Date();
3    d.setTime(d.getTime() + (exdays * 24 * 60 * 60 * 1000));
4    var expires = "expires="+d.toUTCString();
5    document.cookie = cname + "=" + cvalue + ";" + expires + ";path=/";
6}
7
8function cookieExists(name){
9    var cookies = document.cookie.split(';');
10    for (var i = 0; i < cookies.length; i++) {
11        if (cookies[i].trim().startsWith(name + '=')) {
12            return true;
13        }
14    }
15    return false;
16}
17
18function getCookie(cname) {
19    var name = cname + "=";
20    var ca = document.cookie.split(';');
21    for(var i = 0; i < ca.length; i++) {
22        var c = ca[i];
23        while (c.charAt(0) == ' ') {
24            c = c.substring(1);
25        }
26        if (c.indexOf(name) == 0) {
27            return c.substring(name.length, c.length);
28        }
29    }
30    return "";
31}
32
33function checkCookie() {
34    var user = getCookie("username");
35    if (user != "") {
36        alert("Welcome again " + user);
37    } else {
38        user = prompt("Please enter your name:", "");
39        if (user != "" && user != null) {
40            setCookie("username", user, 365);
41        }
42    }
43}
44
45window.delete_cookie = function ( name, path, domain ) {
46    if( cookieExists( name ) ) {
47        document.cookie = name + "=" +
48            ((path) ? ";path="+path:"")+
49            ((domain)?";domain="+domain:"") +
50            ";expires=Thu, 01 Jan 1970 00:00:01 GMT";
51    }
52}

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.