This repository has been archived by the owner on Oct 6, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
index.ejs~
529 lines (475 loc) · 14.7 KB
/
index.ejs~
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
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
<!DOCTYPE html>
<html xmlns:fb="http://ogp.me/ns/fb#" lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=2.0, user-scalable=yes" />
<title>If I Die Today</title>
<!--<link rel="stylesheet" href="stylesheets/screen.css" media="Screen" type="text/css" />-->
<link rel="stylesheet" href="stylesheets/mobile.css" media="handheld, only screen and (max-width: 480px), only screen and (max-device-width: 480px)" type="text/css" />
<!--<link rel="stylesheet" href="http://twitter.github.com/bootstrap/1.4.0/bootstrap.min.css">-->
<link rel="stylesheet" href="stylesheets/style.css" />
<script type="text/javascript" src="http://use.typekit.com/kih0iop.js"></script>
<script type="text/javascript">try{Typekit.load();}catch(e){}</script>
<script type="text/javascript" src="scripts/Datejs-all/date.js"></script>
<!--[if IEMobile]>
<link rel="stylesheet" href="mobile.css" media="screen" type="text/css" />
<![endif]-->
<!-- These are Open Graph tags. They add meta data to your -->
<!-- site that facebook uses when your content is shared -->
<!-- over facebook. You should fill these tags in with -->
<!-- your data. To learn more about Open Graph, visit -->
<!-- 'https://developers.facebook.com/docs/opengraph/' -->
<meta property="og:title" content="<%= app.name %>" />
<meta property="og:type" content="website" />
<meta property="og:url" content="<%= url() %>" />
<meta property="og:image" content="<%= url('/logo.png') %>" />
<meta property="og:site_name" content="If I Die Today" />
<meta property="og:description" content="A Project inspired by Post Mortem, a collaborative initiative by FRONTLINE, ProPublica and NPR on Death Investigation in America." />
<meta property="fb:app_id" content="<%= app.id %>" />
<script type="text/javascript" src="/scripts/jquery.min.js"></script>
<script type="text/javascript" src="/scripts/underscore-min.js"></script>
<script type="text/javascript" src="/scripts/d3.v2.min.js"></script>
<script type="text/javascript">
var states = ['Alabama',
'Alaska',
'Arizona',
'Arkansas',
'California',
'Colorado',
'Connecticut',
'Delaware',
'District of Columbia',
'Florida',
'Georgia',
'Hawaii',
'Idaho',
'Illinois',
'Indiana',
'Iowa',
'Kansas',
'Kentucky',
'Louisiana',
'Maine',
'Maryland',
'Massachusetts',
'Michigan',
'Minnesota',
'Mississippi',
'Missouri',
'Montana',
'Nebraska',
'Nevada',
'New Hampshire',
'New Jersey',
'New Mexico',
'New York',
'North Carolina',
'North Dakota',
'Ohio',
'Oklahoma',
'Oregon',
'Pennsylvania',
'Rhode Island',
'South Carolina',
'South Dakota',
'Tennesee',
'Texas',
'Utah',
'Vermont',
'Virginia',
'Washington',
'West Virginia',
'Wisconsin',
'Wyoming'];
var stateCodes = ['al',
'ak',
'az',
'ar',
'ca',
'co',
'ct',
'de',
'dc',
'fl',
'ga',
'hi',
'id',
'il',
'in',
'ia',
'ks',
'ky',
'la',
'me',
'md',
'ma',
'mi',
'mn',
'ms',
'mo',
'mt',
'ne',
'nv',
'nh',
'nj',
'nm',
'ny',
'nc',
'nd',
'oh',
'ok',
'or',
'pa',
'ri',
'sc',
'sd',
'tn',
'tx',
'ut',
'vt',
'va',
'wa',
'wv',
'wi',
'wy'];
var stateFace = ['B',
'A',
'D',
'C',
'E',
'F',
'G',
'H',
'y',
'I',
'J',
'K',
'M',
'N',
'O',
'L',
'P',
'Q',
'R',
'U',
'T',
'S',
'V',
'W',
'Y',
'X',
'Z',
'c',
'g',
'd',
'e',
'f',
'h',
'a',
'b',
'i',
'j',
'k',
'm',
'n',
'o',
'p',
'p',
'q',
'r',
't',
's',
'u',
'w',
'v',
'x'];
</script>
<script type="text/javascript">
function logResponse(response) {
if (console && console.log) {
console.log('The response was', response);
}
}
$(function(){
// Set up so we handle click on the buttons
$('#postToWall').click(function() {
FB.ui(
{
method : 'feed',
link : $(this).attr('data-url')
},
function (response) {
// If response is null the user canceled the dialog
if (response != null) {
logResponse(response);
}
}
);
});
$('#sendToFriends').click(function() {
FB.ui(
{
method : 'send',
link : $(this).attr('data-url')
},
function (response) {
// If response is null the user canceled the dialog
if (response != null) {
logResponse(response);
}
}
);
});
$('#sendRequest').click(function() {
FB.ui(
{
method : 'apprequests',
message : $(this).attr('data-message')
},
function (response) {
// If response is null the user canceled the dialog
if (response != null) {
logResponse(response);
}
}
);
});
});
</script>
<!--[if IE]>
<script type="text/javascript">
var tags = ['header', 'section'];
while(tags.length)
document.createElement(tags.pop());
</script>
<![endif]-->
</head>
<body>
<div id="fb-root"></div>
<script type="text/javascript">
window.fbAsyncInit = function() {
FB.init({
appId : '<%= app.id %>', // App ID
channelUrl : '<%= url_no_scheme('/channel.html') %>', // Channel File
status : true, // check login status
cookie : true, // enable cookies to allow the server to access the session
xfbml : true // parse XFBML
});
// Listen to the auth.login which will be called when the user logs in
// using the Login button
FB.Event.subscribe('auth.login', function(response) {
// We want to reload the page now so PHP can read the cookie that the
// Javascript SDK sat. But we don't want to use
// window.location.reload() because if this is in a canvas there was a
// post made to this page and a reload will trigger a message to the
// user asking if they want to send data again.
window.location = window.location;
});
FB.Canvas.setAutoGrow();
};
// Load the SDK Asynchronously
(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/all.js";
fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));
</script>
<header class="clearfix">
<p id="codTemp"></p>
<% if (user) { %>
<script type="text/javascript">
var birthYear = parseInt("<%= user.birthday %>".split('/')[2]);
var year = (new Date()).getFullYear();
var age = year - birthYear;
$(function() {
/*$('#codTemp').append('Leading COD for age: ' + age + '<br>');*/
});
$.getJSON('/data/deaths.json', function(data) {
var causesOfDeathForAge = [];
$.each(data, function(i, cause) {
var low = parseInt(cause['Low age'], 10);
var high = parseInt(cause['High age'], 10);
if (age >= low && age < high) {
causesOfDeathForAge.push(cause);
}
});
causesOfDeathForAge.sort(function(a, b) {
return parseFloat(b['Total deaths']) - parseFloat(a['Total deaths']);
});
$.each(causesOfDeathForAge, function(i, v) {
/*$('#codTemp').append(v['Cause of death'] + ' deaths:' + v['Total deaths'] +'<br>');*/
});
$('#cod2').append(causesOfDeathForAge[0]['Cause of death']);
});
</script>
<script type="text/javascript">
var loc = "<%= user.location.name %>"
var city = loc.split(', ')[0];
var state = loc.split(', ')[1];
var _i = states.indexOf(state);
var postal = stateCodes[_i];
var curryear = parseInt(Date.today().getYear()) + 1900;
var dod = Date.today().getMonthName() + " " + Date.today().getDate() + ", " + curryear;
$(function() {
$('#city').append(city);
$('#state').append(state);
$('#city2').append(city);
$('#state2').append(state);
$('#dod').append(dod);
$('#age').append(age);
$('#postal').append(postal);
});
</script>
<script type="text/javascript">
var hasCoroner = false;
var hasExaminer = false;
var hasBoth = false;
$.getJSON('http://projects.propublica.org/forensics/geos/'+postal+'.json?callback=?', function(data) {
if (data.geo['system_types']['medical_examiner_system'] != "none") {
hasExaminer = true;
$('#systems').append('has ME');
}
if (data.geo['system_types']['coroner_system'] != "none") {
hasCoroner = true;
$('#systems').append('has coroner');
}
if (hasCoroner && hasExaminer) {
hasBoth = true;
}
});
</script>
<script type="text/javascript">
$(function() {
var statefaceKey = stateFace[_i];
$('#stateface').append(statefaceKey);
});
</script>
<p id="picture" style="background-image: url(https://graph.facebook.com/<%= user.id %>/picture?type=normal)"></p>
<!-- <div>
<h1>Welcome, <strong><%= user.name %></strong></h1>
<h1>Birthday: <strong><%= user.birthday %></strong></h1>
<h1>Loc: <strong><%= user.location.name %></strong></h1>
<h1>Short code: <strong id="postal"></strong></h1>
<p style="font-family: 'StateFaceRegular'; font-size: 100px;" id="stateface"></p>
<h1 id="systems"></h1>
<p class="tagline">
This is your app
<a href="<%= app.link %>" target="_top"><%= app.name %></a>
</p>
<div id="share-app">
<p>Share your app:</p>
<ul>
<li>
<a href="#" class="facebook-button" id="postToWall" data-url="<%= url() %>">
<span class="plus">Post to Wall</span>
</a>
</li>
<li>
<a href="#" class="facebook-button speech-bubble" id="sendToFriends" data-url="<%= url() %>">
<span class="speech-bubble">Send Message</span>
</a>
</li>
<li>
<a href="#" class="facebook-button apprequests" id="sendRequest" data-message="Test this awesome app">
<span class="apprequests">Send Requests</span>
</a>
</li>
</ul>
</div>
</div> -->
<% } else { %>
<div style="width: 720px; height: 405px; margin: 0 auto; position: relative;">
<div style="width: 720px; height: 405px; margin: 0 auto;">
<img src="/images/toetag-splash-withalltext.jpg">
</div>
<div style="position: absolute; top: 270px; right: 50px;">
<div class="fb-login-button" data-scope="user_likes,user_photos,user_photo_video_tags,user_birthday,user_location"></div>
</div>
</div>
<% } %>
</header>
<% if (user) { %>
<div id="container">
<div id="top-outline">
<div id="inner-outline">
<h1>Certified Copy of Record of Death</h1>
<% if(user) { %>
<h4>City of <font id="city2"></font>, State of <font id="state2"></font></h4>
<div class="img-thumbnail"><img src="https://graph.facebook.com/<%= user.id %>/picture?type=normal" id="profilepic" /></div>
<div id="profile">
<h2 id="name"><%= user.name %></h2>
<span class="left">
<b>City: </b><font id="city"></font><br />
<b>State: </b><font id="state"></font><br />
</span>
<span class="right">
<b>Date of Death: </b><font id="dod"></font><br />
<b>Age of Death: </b><font id="age"></font></br>
</span>
<% } else{%>
<div class="img-thumbnail"><img src="#" /></div>
<div id="profile">
<h2 id="name"></h2>
<span class="left">
<b>City: </b><font id="city"></font><br />
<b>State: </b><font id="state"></font><br />
</span>
<span class="right">
<b>Date of Death: </b><font id="dod"></font><br />
<b>Age of Death: </b><font id="age"></font><br />
</span>
<% } %>
</div>
<div id="cod">
<b>Cause of Death: </b><font id="cod2"></font><br />
<i style="color:#666;">(Based on likeliest cause of death for someone your age)</i><br />
<img src="/images/sig.gif" style="height:100px;"/>
<p id="coronerME">Coroner/Medical Examiner</p>
<script type="text/javascript">
if (hasCoroner && hasExaminer) {
$("#coronerME").text("Coroner/Medical Examiner")
}
else if (hasCoroner){
$("#coronerME").text("Coroner")
} else {
$("#coronerME").text("Medical Examiner")
}
</script>
</div>
</div> <!-- end inner-outline -->
<div style="padding: 13px 0;">
<b>Share on Facebook: </b>
<div style="display: inline;" class="fb-send" data-href="http://ifidietoday.org" data-font="lucida grande"></div>
</div>
<h3>Other probable deaths</h3>
<svg id="pie"></svg>
<script type="text/javascript"
src="/scripts/pie.js"></script>
<div id="whodecides">
<h3>But who will figure out why you really died?</h3>
<table>
<tr>
<td><p style="font-family: 'StateFaceRegular'; font-size: 100px;">R</p></td>
<td><p>In California, many places have coroners, who decide your cause of death, even though they have no medical training.</p></td>
</tr>
<tr>
<td><p style="font-family: 'StateFaceRegular'; font-size:100px;">s</p></td>
<td><p>Virginia has Medical Examiners. But there no national standards for competence that Medical Examiners have to meet.</p></td>
</tr>
<tr>
<td><p style="font-family: 'StateFaceRegular'; font-size:100px;">g</p></td>
<td><p>Nevada has coroners who decide your cause of death, even though they have no medical training.</p></td>
</tr>
</table>
</div> <!-- end whodecides -->
</div> <!-- end container -->
<video width="512" height="288" controls="controls">
<source src="/videos/teaser.web.webm" type="video/webm" />
<source src="/videos/teaser.web.m4v" type="video/mp4" />
Your browser does not support the video tag.
</video>
<% } %>
</body>
</html>