-
Notifications
You must be signed in to change notification settings - Fork 2
/
How_Many_Apocalypses_Have_I_Survived.html
executable file
·216 lines (200 loc) · 7.66 KB
/
How_Many_Apocalypses_Have_I_Survived.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
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>How Many Apocalypses Have I Survived?</title>
<meta content="yes" name="apple-mobile-web-app-capable">
<meta content="user-scalable=no, width=device-width, initial-scale=1.0, maximum-scale=1.0" name="viewport">
<link href="https://fonts.googleapis.com/css?family=Open+Sans:700" rel="stylesheet">
<script charset='utf-8' type='text/javascript'>
window.addEventListener('load', function(e) {
setTimeout(function() { window.scrollTo(0, 1); }, 1);
}, false);
</script>
<script type='text/javascript' src='https://ko-fi.com/widgets/widget_2.js'></script>
<style>
html, body {
height:100%;width:100%;
margin:0;
padding:0;
}
body {
font:200%/1.5;
font-family: 'Open Sans', Helvetica, sans-serif;
font-weight: 700;
display: -webkit-box;
-webkit-box-orient: horizontal;
-webkit-box-pack: center;
-webkit-box-align: center;
display: -moz-box;
-moz-box-orient: horizontal;
-moz-box-pack: center;
-moz-box-align: center;
display: box;
box-orient: horizontal;
box-pack: center;
box-align: center;
text-align:center;
background: url(https://i.imgur.com/Lmsxeiz.jpg) #111;
background-size: cover;
background-position: center center;
color: white;
}
#main {
max-width:90%;
}
#year, #submit {
display:inline-block;
font-size:2em;
line-height:1.5;
text-align:center;
max-width:83%;
}
#social {
margin:1em;
}
#social > * {
display:inline;
}
script, style { display:none!important; }
h1, #counter {
font-size: 4vw;
text-shadow: 1px 1px #999, 2px 2px #999, 3px 3px #999, 0 0 5px #111;
-webkit-font-smoothing: antialiased;
}
@media (min-width: 576px) {
#counter {
font-size: calc(15.625vw - 40px);
}
}
@media (min-width: 768px) {
#counter {
font-size: calc(8.92857vw + 11.42857px);
}
}
#result p, #result a, #result a:hover {
color: white;
text-decoration: none;
text-shadow: 0 0 10px #111, 0 0 5px #000, 0 0 1px #000;
}
#result .h2 {
display: flex;
justify-content: center;
align-items: center;
flex-direction: column;
margin: 1em auto;
background:#f00;
padding:0.5em;
border-radius:50%;
min-height: 200px;
min-width: 200px;
width: 30vw;
height: 30vw;
}
#counter {
margin: 0;
padding: 0;
}
#result, #form {display:none}
@-webkit-keyframes spin{
0% { -webkit-transform:rotate(0deg); -webkit-transform-origin:50% 50%; }
100% { -webkit-transform:rotate(359deg); }
}
@keyframes spin{
0% { transform:rotate(0deg); }
100% { transform:rotate(359deg); }
}
#spinner {
border-radius:100%; height:2em; width:2em;
margin:1em auto;
box-shadow:2px 2px 5px rgba(0,0,0,0.8),
-2px -2px 5px rgba(255,255,255,0.8),
2px -2px 5px rgba(0,0,0,0.8),
-2px 2px 5px rgba(255,255,255,0.8);
display:block;
-webkit-animation:0.8s spin infinite linear;
animation:0.8s spin infinite linear;
}
</style>
<script src="//cdnjs.cloudflare.com/ajax/libs/jquery/2.1.1/jquery.min.js">
</script>
</head>
<body>
<div id="main">
<div id="loading">
Loading<br>
<div id="spinner">
</div>
</div>
<h1>How Many Apocalypses Have I Survived?</h1>
<div id="result">
<div class="h2">You have survived
<div id="counter">
</div>
end times
</div>
<p>Find out more on <a href="https://en.wikipedia.org/wiki/List_of_dates_predicted_for_apocalyptic_events">wikipedia</a></p>
<div id="social">
<a class="twitter-share-button" data-related="jkirchartz" data-text="how many times have you survived the apocalypse?" data-url="http://jkirchartz.com/demos/How_Many_Apocalypses_Have_I_Survived.html" data-via="JKirchartz" href="https://twitter.com/share">Tweet</a>
<div class="fb-like" data-href="https://jkirchartz.com/demos/How_Many_Apocalypses_Have_I_Survived.html" data-layout="button" data-size="small" data-share="true" data-show-faces="false" data-width="320">
</div>
<script type='text/javascript'>kofiwidget2.init('Buy Me a Coffee', '#46b798', 'Q5Q79ZEI');kofiwidget2.draw();</script>
</div>
</div>
<form action="#" id="form" name="form">
<input id="year" placeholder="Year of Birth" type="tel"><button id="submit" type="submit">»</button>
</form>
<script>
var getYears = [],
count = 0,
d = new Date(),
currYear = d.getFullYear();
$(function() {
$.getJSON("https://en.wikipedia.org/w/api.php?action=parse&rvprop=content&page=List_of_dates_predicted_for_apocalyptic_events&format=json&callback=?",
function(data) {
$(data.parse.text["*"]).find("tr").each(function() {
var origin = $(this).find("td:first").text();
if (origin.search(/\d\d+/) != -1) {
getYears.push(origin.replace(/,/gi, ""));
}
});
$("#loading").hide();
$("#form").show();
});
});
$("#form").on("submit", function(e) {
e.preventDefault();
var inputYear = parseInt($("#year").val(),10);
if(!inputYear){
$("#year").val("");
alert("Try a number, genius.");
return false;
}
getYears.map(function(item) {
var yr = item.match(/\d{3,9}/);
if (yr !== null &&
(yr[0] >= inputYear) &&
(yr[0] <= currYear)
) {
count++;
}
});
$("#counter").text(count);
$("#result").show();
$('[id*=twitter-widget]').attr('data-text', "How many apocalypses have you survived? I've survived " + count + " times!");
count = 0;
return false;
});
!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0];if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src="//platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);}}(document,"script","twitter-wjs");
</script>
<div id="fb-root"></div>
<script>(function(d, s, id) {
var js, fjs = d.getElementsByTagName(s)[0];
if (d.getElementById(id)) return;
js = d.createElement(s); js.id = id;
js.src = "//connect.facebook.net/en_US/sdk.js#xfbml=1&version=v2.9&appId=1879249312305029";
fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));</script>
</div>
</body>
</html>