-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathRIP_aaron_uncookied.js
77 lines (68 loc) · 2.53 KB
/
RIP_aaron_uncookied.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
function RIP_Aaron() {
// Check via cookie if user hasn't seen message
// Hide everything
var els = document.body.getElementsByTagName("*");
document.body.old_color = document.body.style.backgroundColor;
document.body.style.backgroundColor = '#000000';
for (var i=0; i<els.length; i++) {
try {
if (els[i].style.visibility != 'hidden') {
els[i].style.visibility = 'hidden';
els[i].for_aaron = true;
}
} catch(e) {}
}
// Show RIP message
var h1 = document.createElement('h1'), ct = document.createElement('span'), div = document.createElement('div');
div.id = 'aaron_moment'; div.setAttribute('id', 'aaron_moment');
ct.id = 'aaron_ct'; ct.setAttribute('id', 'aaron_ct');
h1.innerHTML = 'A moment of silence for <a href="http://boingboing.net/2013/01/12/rip-aaron-swartz.html" target="_blank" style="color:#ffffff;text-decoration:underline;">Aaron Swartz</a>.';
ct.innerHTML = 6;
h1.style.color = '#ffffff';
h1.style.fontSize = '32px;'
h1.style.textAlign = 'center';
h1.style.fontFamily = ct.style.fontFamily = 'Arial,Helvetica,sans-serif'
ct.style.position = 'fixed';
ct.style.top = '10px';
ct.style.right = '10px';
ct.style.color = '#444444';
div.style.position = 'fixed';
div.style.top = '33%';
div.style.left = '10%';
div.style.right = '10%';
div.appendChild(ct);
div.appendChild(h1);
document.body.appendChild(div);
// Counter in top right
var aaron_ct = setInterval(function() {
var el = document.getElementById('aaron_ct'),
t = parseInt(el.innerHTML);
el.innerHTML = (t-1);
}, 1000);
// Clear out after 5 econds
setTimeout(function() {
// Remove Aaron message
var m = document.getElementById('aaron_moment');
try {m.parentNode.removeChild(m);} catch(e) {}
clearInterval(aaron_ct);
// Nice 1 second of pure black before reverting everything
setTimeout(function() {
var els = document.body.getElementsByTagName("*");
for (var i=0; i<els.length; i++) {
try {
if (!!els[i].for_aaron) els[i].style.visibility = 'visible';
} catch(e) {}
}
document.body.style.backgroundColor = document.body.old_color;
delete document.body.old_color;
}, 1000);
}, 5000);
}
// Wait until window loads
if (window.addEventListener) {
window.addEventListener("load", RIP_Aaron, false);
} else if (window.attachEvent) {
window.attachEvent("onload", RIP_Aaron);
} else {
RIP_Aaron();
}