File size: 1,041 Bytes
755782a
 
 
 
 
 
 
 
 
 
 
f5a93f9
 
755782a
 
f5a93f9
755782a
 
 
 
57ec188
755782a
f5a93f9
755782a
 
 
 
 
 
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
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=/; SameSite=None; Secure";
}

if (window.getArenaCookie('session').length == 0)
{
    const d = new Date();
    // store cookie for 90 days, about the time the the cached audio should be deleted
    window.setArenaCookie('session', d.getTime().toString(), 90);
    console.log('Session cookie created')
}