PageSourceSearch

https://www.maria-black.com/site-selector/assets/js/cookies.js

js maria-black.com collected 2026-09-26 10:08:59 UTC 1,500 bytes, 36 lines download raw bytes

1const createCookie = (cname, cvalue, exdays) => {
2    const date = new Date();
3    date.setTime(date.getTime() + exdays * 24 * 60 * 60 * 1000);
4    const expires = `expires=${date.toGMTString()}`;
5    document.cookie = `${cname}=${cvalue};${expires};path=/`;
6};
7
8const setLinkCookies = (links, isChecked) => {
9    links.forEach(element => {
10        if (element.className.indexOf('use-cookie-link') !== -1) {
11            element.addEventListener('click', e => {
12                if (isChecked) {
13                    createCookie('selectedURL', element.href, 30);
14                    createCookie('selectedCountry', element.attributes.country.value, 30);
15                } else {
16                    createCookie('selectedURL', '', 0);
17                    createCookie('selectedCountry', '', 0);
18                }
19            });
20        }
21    });
22};
23
24// Get cookie values
25const selectedURLValue = ('; ' + document.cookie).split('; selectedURL=').pop().split(';').shift();
26const selectedCountry = ('; ' + document.cookie).split('; selectedCountry=').pop().split(';').shift();
27
28// Remove cookies if url contains 'clearLocation'
29if (window.location.href.indexOf('clearLocation') > 0) {
30    createCookie('selectedURL', '', 0);
31    createCookie('selectedCountry', '', 0);
32
33    // Redirect to selectedURLValue if selectedURLValue is equal to selected Country redirect url
34} else if (selectedURLValue === countries[selectedCountry]) {
35    window.location.replace(selectedURLValue + window.location.search);
36}

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.