summaryrefslogtreecommitdiff
path: root/backend/instance/nocookies/data/js/common2.js
blob: a5f936b6357dadd22fb84527e47513f2267a9c44 (plain)
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 getItem(hostname)
{
	switch (hostname)
	{
		case 'pepephone.com': return {strict: true, key: 'cookiesChosen', value: 'done'};
	}
	
	
	const parts = hostname.split('.');
	
	if (parts.length > 2)
	{
		parts.shift();
		return getItem(parts.join('.'));
	}
	
	return false;
}


let	hostname = document.location.hostname.replace(/^w{2,3}\d*\./i, ''),
	item = getItem(hostname);

if (item) {
	let value = sessionStorage.getItem(item.key);
	
	if (value == null || (item.strict && value != item.value)) {
		sessionStorage.setItem(item.key, item.value);
		document.location.reload();
	}
}