PageSourceSearch

https://markington.n-yorks.sch.uk/service/util/custom/javascript/cookie.js

js markington.n-yorks.sch.uk collected 2026-10-04 02:09:33 UTC 1,775 bytes, 60 lines download raw bytes

1var Cookie = (function(){
2    var milliseconds = 1;
3    var seconds = 1000;
4    var minutes = seconds * 60;
5    var hours = minutes * 60;
6    var days = hours * 24;
7
8    return {
9        units : {
10            MILLISECONDS    :   milliseconds,
11            SECONDS         :   seconds,
12            MINUTES         :   minutes,
13            HOURS           :   hours,
14            DAYS            :   days
15        },
16
17        createCookie : function(name,value,expTime,expUnit) {
18            var expires = "";
19
20            if (expTime) {
21                //backward compatability hack assumes expire time in days
22                if (!expUnit) {
23                    expUnit = Cookie.units.DAYS;
24                }
25                
26                var date = new Date();
27                date.setTime(date.getTime()+( expTime * expUnit));
28                var expires = "; expires="+date.toGMTString();
29            }
30            document.cookie = name+"="+value+expires+"; path=/";
31        },
32
33        readCookie : function(name, stripQuotes) {
34            var nameEQ = name + "=";
35            var ca = document.cookie.split(';');
36            for(var i=0;i < ca.length;i++) {
37                var c = ca[i];
38                while (c.charAt(0)==' ') c = c.substring(1,c.length);
39                if (c.indexOf(nameEQ) == 0) {
40                    var value = c.substring(nameEQ.length,c.length);
41                    if (stripQuotes) {
42                        value = value.replace(/^["']/,"");
43                        value = value.replace(/['"]$/,"");
44                    }
45                    return value;
46                }
47            }
48            return null;
49        },
50
51        eraseCookie : function(name) {
52            Cookie.createCookie(name,"",-1);
53        }
54    };
55
56
57}());
58
59
60

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.