-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
132 lines (132 loc) · 5.91 KB
/
index.html
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
<!DOCTYPE html>
<html>
<head>
<meta chartset="utf-8"/>
<meta name="viewport" content="width=device-width,initial-scale=1"/>
<script type="application/javascript">
// https://stackoverflow.com/questions/105034/how-to-create-a-guid-uuid
function uuidv4() {
return ([1e7]+-1e3+-4e3+-8e3+-1e11).replace(/[018]/g, c =>
(c ^ crypto.getRandomValues(new Uint8Array(1))[0] & 15 >> c / 4).toString(16)
);
}
var cookie_names = [
"test_cookie",
"c_user",
"datr",
"dpr",
"fr",
"sb",
"spin",
"xs"
];
document.addEventListener("DOMContentLoaded",()=> {
document.cookie = "test_cookie=" + uuidv4() + "; domain=" + new URL(document.location.href).host + "; secure; expires=" + new Date(new Date().getTime() + 31536000000).toGMTString() + "; path=/;";
document.cookie = "c_user=" + uuidv4() + "; domain=" + new URL(document.location.href).host + "; secure; expires=" + new Date(new Date().getTime() + 31536000000).toGMTString() + "; path=/;";
document.cookie = "datr=" + uuidv4() + "; domain=" + new URL(document.location.href).host + "; secure; expires=" + new Date(new Date().getTime() + 31536000000).toGMTString() + "; path=/;";
document.cookie = "dpr=" + uuidv4() + "; domain=" + new URL(document.location.href).host + "; secure; expires=" + new Date(new Date().getTime() + 31536000000).toGMTString() + "; path=/;";
document.cookie = "fr=" + uuidv4() + "; domain=" + new URL(document.location.href).host + "; secure; expires=" + new Date(new Date().getTime() + 31536000000).toGMTString() + "; path=/;";
document.cookie = "sb=" + uuidv4() + "; domain=" + new URL(document.location.href).host + "; secure; expires=" + new Date(new Date().getTime() + 31536000000).toGMTString() + "; path=/;";
document.cookie = "spin=" + uuidv4() + "; domain=" + new URL(document.location.href).host + "; secure; expires=" + new Date(new Date().getTime() + 31536000000).toGMTString() + "; path=/;";
document.cookie = "xs=" + uuidv4() + "; domain=" + new URL(document.location.href).host + "; secure; expires=" + new Date(new Date().getTime() + 31536000000).toGMTString() + "; path=/;";
document.getElementById("span").innerHTML = new URL(document.location.href).host + new URL(document.location.href).pathname.replace(/\/$/,'');
var t = document.getElementById("cookietable");
[...document.cookie.split(';')].forEach((i)=>{
var k = i.split('=')[0];
var value = [];
for(var ii = 0; ii < i.split('=').length; ii++){
if(ii != 0){
value.push(i.split('=')[ii])
}
}
var maketr = false;
cookie_names.forEach((i)=>{
if(k.match(i)){
maketr = true;
}
});
if(maketr){
var v = value.join();
var tr = document.createElement("tr");
var td1 = document.createElement("td");
var td2 = document.createElement("td");
td1.classList.add("cookie_name");
td1.innerHTML = k;
td2.innerHTML = v;
[td1,td2].forEach((iii)=>{tr.appendChild(iii)});
t.appendChild(tr);
}
});
});
</script>
<style type="text/css">
body {
color: chartreuse;
background-color: black;
font-size: 20pt;
font-family: 'Segoe UI';
white-space: nowrap;
}
#body {
margin: auto;
width: 90%
}
table,tr,td {
font-size: 16pt;
border-collapse: collapse;
border: 3px solid white;
padding: 5px;
}
td {
user-select: all;
}
#heading {
/*display: inline-block;
margin-left: 5%;
margin-right: 5%;*/
text-align: center;
background-color: #100e47;
border-bottom: 2px solid white;
}
#cookietable {
margin: auto;
/*width: 80%;*/
background-color: #100e47;
}
.padding {
height: 50px;
}
#summary {
/*display: inline-block;
margin-left: 5%;
margin-right: 5%;*/
text-align: center;
/*background-color: #100e47;
border: 2px solid white;*/
}
.cookie_name {
text-align: center;
}
</style>
</head>
<body>
<div id="heading">
<span id="span"></span>
</div>
<div id="body">
<div class="padding"></div>
<div id="summary">
<span style="color: white;">This page is being used to test <a href="https://github.com/nstevens1040/Create-CookieCollectionFromJson" target="_blank">Create-CookieCollectionFromJson</a> by generating cookies with javascript.<br/>The 8 cookie values below are randomly generated.</span>
</div>
<div class="padding"></div>
<div>
<table id="cookietable">
<colgroup>
<col/>
<col/>
</colgroup>
</table>
</div>
</div>
</body>
</html>