PageSourceSearch

https://my.cloud86.io/modules/addons/cloud86/assets/js/affiliate.js

js cloud86.io collected 2026-10-02 09:57:55 UTC 2,263 bytes, 74 lines download raw bytes

1class CookieManager {
2
3    getAllCookies() {
4        let splits = document.cookie.split(";");
5
6        let cookies = {};
7        for (let i = 0; i < splits.length; i++) {
8            let cookieName = splits[i].match(/[^=]*/).pop().trim();
9            let cookieValue = splits[i].replace(cookieName + '=', '');
10            cookies[cookieName] = cookieValue;
11        }
12        return cookies;
13    }
14
15    removeAllCookies() {
16        for (let cookieName in this.getAllCookies()) {
17            this.removeCookie(cookieName);
18        }
19    }
20
21    hasCookie(cookieName) {
22
23        return this.getAllCookies().hasOwnProperty(cookieName);
24    }
25
26    getCookieValue(cookieName) {
27        let allCookies = this.getAllCookies();
28        if (allCookies.hasOwnProperty(cookieName)) {
29            return allCookies[cookieName];
30        }
31        return null;
32    }
33
34    setCookie(name, value, days, domain = null, sameSite = 'Lax') {
35        let date = new Date();
36        date.setTime(date.getTime() + (days * 24 * 60 * 60 * 1000));
37        let expiryDate = date.toUTCString();
38        let cookie = name + "=" + value + ";expires=" + expiryDate + ";path=/";
39        if (domain) {
40            cookie += ';domain=' + domain;
41        }
42        if (sameSite) {
43            cookie += ';samesite=' + sameSite;
44        }
45        document.cookie = cookie;
46    }
47
48    removeCookie(cookieName) {
49        document.cookie = cookieName + "=; expires=Thu, 01 Jan 1970 00:00:00 UTC; path=/;";
50    }
51
52}
53
54(function() {
55    if (!window.location.hash.startsWith('#a_aid=')) {
56        return;
57    }
58
59    let affiliateCookieName = 'Affiliate_cookie';
60    let affiliateCookieValue = window.location.hash.substring(1);
61    let affiliateCookieExpirationDays = 60;
62
63    let cookieManager = new CookieManager();
64
65    // We set/update the cookie if no cookie has been set yet or if the value matches the cookie value. The latter updates the expiration on the existing cookie.
66    if (!cookieManager.hasCookie(affiliateCookieName) || cookieManager.getCookieValue(affiliateCookieName) === affiliateCookieValue) {
67        cookieManager.setCookie(
68            affiliateCookieName,
69            affiliateCookieValue,
70            affiliateCookieExpirationDays,
71            '.cloud86.io'
72        );
73    }
74})();

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.