-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path404.html
142 lines (126 loc) · 4.14 KB
/
404.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
133
134
135
136
137
138
139
140
141
142
<!DOCTYPE html>
<head>
<meta charset="UTF-8">
<style>
*{
font-family: Arial, Helvetica, sans-serif;
}
.hero{
color: #333;
margin: auto;
min-height: 256px;
text-align: center;
width: 60%;
}
.hero *{
padding: 8px;
}
.hero a{
padding: 0px;
}
.hero h1{
font-style: bold;
font-size: 64px;
}
.hero #name{
color: #aa3333;
font-style: bold;
}
</style>
<title>404</title>
</head>
<body>
<div class="hero">
<h1>404</h1>
<h3>It looks like this page is missing, just like:</h3>
<h2 id="name">John Doe</h2>
<img id="portrait" />
<p id="desc"></p>
</div>
<script>
asyncGetRegion("http://ipinfo.io/json")
function asyncGetRegion(url){
var request = new XMLHttpRequest();
request.onreadystatechange = function(){
if(request.readyState == 4 && request.status == 200){
var response = JSON.parse(request.responseText);
var states = {};
states["Alabama"] = "AL";
states["Alaska"] = "AK";
states["Arizona"] = "AZ";
states["Arkansas"] = "AR";
states["California"] = "CA";
states["Colorado"] = "CO";
states["Connecticut"] = "CT";
states["Delaware"] = "DE";
states["Florida"] = "FL";
states["Georgia"] = "GA";
states["Hawaii"] = "HI";
states["Idaho"] = "ID";
states["Illinois"] = "IL";
states["Indiana"] = "IN";
states["Iowa"] = "IA";
states["Kansas"] = "KS";
states["Kentucky"] = "KY";
states["Louisiana"] = "LA";
states["Maine"] = "ME";
states["Maryland"] = "MD";
states["Massachusetts"] = "MA";
states["Michigan"] = "MI";
states["Minnesota"] = "MN";
states["Mississippi"] = "MS";
states["Missouri"] = "MO";
states["Montana"] = "MT";
states["Nebraska"] = "NE";
states["Nevada"] = "NV";
states["New Hampshire"] = "NH";
states["New Jersey"] = "NJ";
states["New Mexico"] = "NM";
states["New York"] = "NY";
states["North Carolina"] = "NC";
states["North Dakota"] = "ND";
states["Ohio"] = "OH";
states["Oklahoma"] = "OK";
states["Oregon"] = "OR";
states["Pennsylvania"] = "PA";
states["Rhode Island"] = "RI";
states["South Carolina"] = "SC";
states["South Dakota"] = "SD";
states["Tennessee"] = "TN";
states["Texas"] = "TX";
states["Utah"] = "UT";
states["Vermont"] = "VT";
states["Virginia"] = "VA";
states["Washington"] = "WA";
states["West Virginia"] = "WV";
states["Wisconsin"] = "WI";
states["Wyoming"] = "WY";
var keys = Object.keys(states);
var abbr = states[keys[Math.floor(keys.length * Math.random())]];
if(response.region in states){
abbr = states[response.region];
}
asyncGetPoster(abbr);
}
}
request.open("GET", url, true);
request.send(null);
}
function asyncGetPoster(abbr){
var request = new XMLHttpRequest();
request.onreadystatechange = function(){
if(request.readyState == 4 && request.status == 200){
console.log(request.responseText);
var response = JSON.parse(request.responseText);
var person = response.persons[Math.floor(response.persons.length * Math.random())];
var fullName = person.firstName + " " + person.middleName + " " + person.lastName;
document.getElementById('name').innerHTML = fullName;
document.getElementById('portrait').src = ("http://missingkids.org" + person.thumbnailUrl).replace("t.jpg", ".jpg");
document.getElementById('desc').innerHTML = fullName + " was last scene in " + person.missingCity + ", " + person.missingState + " on " + person.missingDate + ". (S)he is currently " + person.age + '. If you have any information, please contact the <a href="http://www.missingkids.org/CyberTipline">National Center for Missing and Exploited Children</a>. You can also call them at 1-800-THE-LOST (1-800-843-5678). Reference case number <a href="http://www.missingkids.org/poster/NCMC/' + person.caseNumber + '/1/screen">' + person.caseNumber + "</a>.";
}
}
request.open("GET", "https://murmuring-wildwood-56385.herokuapp.com/query/" + abbr, true);
request.send(null);
}
</script>
</body>