-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathscript.js
78 lines (71 loc) · 3.18 KB
/
script.js
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
function start() {
var startButton = document.getElementById('start');
var intro = document.getElementById('intro');
if (startButton.classList.contains('hide')) {
return
}
startButton.classList = 'hide';
intro.classList.add('hide');
var eight_minutes_from_now = new Date().getTime() + 527000;
var interval = setInterval(function() {
var now = new Date().getTime();
var time_remaining = eight_minutes_from_now - now;
var minutes = Math.floor((time_remaining % (3600000)) / (60000));
var seconds = Math.floor((time_remaining % (60000)) / 1000);
var glue = (seconds > 9) ? ':' : ':0';
var transcript_item = getTranscriptItem(time_remaining);
if (transcript_item) {
fadeInText(transcript_item);
}
document.getElementById("timer").innerHTML = minutes + glue + seconds;
if (time_remaining < 0) {
clearInterval(interval);
document.getElementById("timer").innerHTML = "0:00";
setTimeout(function(){
var transcript = document.getElementById('transcript');
transcript.innerHTML = 'Justice for George. <br> Sources: <a target="_blank" href="https://www.youtube.com/watch?v=FMGUAHBFmjk">1</a>, <a target="_blank" href="https://www.youtube.com/watch?v=lirHz93qJ50">2</a>, <a target="_blank" href="https://en.wikipedia.org/wiki/Death_of_George_Floyd">3</a>';
transcript.classList = 'transcript-show';
}, 10000);
}
}, 200);
}
function fadeInText(t) {
var transcript = document.getElementById('transcript');
transcript.innerHTML = t;
transcript.classList = 'transcript-show';
setTimeout(function(){
var transcript = document.getElementById('transcript');
transcript.classList = 'transcript-hide';
}, 7000)
}
function getTranscriptItem(current_time) {
var fullTranscript = {
520000: "“Please, please, please! I can't breathe!”",
495000: "“Please man.”",
485000: "“I can't breathe.”",
475000: "“I'm about to die.”",
465000: "“I can't breathe. I can't breathe.”",
455000: "(Still kneeling) “Get in the car!” “I will!”",
445000: "(Still kneeling) “Get up, get in the car!” “I can't move.”",
435000: "(Still kneeling) “Get up, and get in the car!” “Mama! Mama!”",
407000: "An ambulance is called.",
380000: "“Everything hurts. Some water or something, please.”",
350000: "“I can't breathe officer.” “Shut up.” “They gonna kill me.”",
227000: "“He's not responsive right now!” -bystander",
173000: "After 5 minutes and 50 seconds, George Floyd becomes unresponsive.",
107000: "“He's not fucking moving!” -bystander",
1: "After 8 minutes and 46 seconds, Derek Chauvin removed his knee from George Floyd's neck. Mr. Floyd was later pronounced dead."
};
for (var timestamp in fullTranscript) {
if (isInTimeWindow(timestamp)) {
return fullTranscript[timestamp];
}
}
function isInTimeWindow(timestamp) {
var t = parseInt(timestamp);
if (current_time >= t - 100 && current_time <= t + 100) {
return true;
}
return false;
}
}