File size: 1,054 Bytes
f5a93f9
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
function () {
    window.getArenaCookie = function getArenaCookie(cname) {
        let name = cname + "=";
        let decodedCookie = decodeURIComponent(window.document.cookie);
        let ca = decodedCookie.split(';');
        for (let i = 0; i < ca.length; i++) {
            let c = ca[i];
            while (c.charAt(0) == ' ') {
            c = c.substring(1);
            }
            if (c.indexOf(name) == 0) {
            return c.substring(name.length, c.length);
            }
        }
        return "";
    }

    window.setArenaCookie = function setArenaCookie(cname, cvalue, exdays) {
        const d = new Date();
        d.setTime(d.getTime() + (exdays * 24 * 60 * 60 * 1000));
        let expires = "expires=" + d.toUTCString();
        window.document.cookie = cname + "=" + cvalue + ";" + expires + ";path=/";
    }

    if (window.getArenaCookie('session').length == 0)
    {
        const d = new Date();
        window.setArenaCookie('session', d.getTime().toString(), 90);
        console.log('Session cookie created')
    }
}