forked from nohello-net/site
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathhello.js
More file actions
74 lines (62 loc) · 2.43 KB
/
hello.js
File metadata and controls
74 lines (62 loc) · 2.43 KB
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
// a key map of allowed keys
var allowedKeys = {
72: 'h',
69: 'e',
76: 'l',
79: 'o',
};
// the sequence
var nohelloCode = ['h', 'e', 'l', 'l', 'o'];
// a variable to remember the 'position' the user has reached so far.
var nohelloCodePosition = 0;
// add keydown event listener
document.addEventListener('keydown', function (e) {
// get the value of the key code from the key map
var key = allowedKeys[e.keyCode];
// get the value of the required key from the code
var requiredKey = nohelloCode[nohelloCodePosition];
// compare the key with the required key
if (key == requiredKey) {
// move to the next key in the sequence
nohelloCodePosition++;
// if the last key is reached, activate wut
if (nohelloCodePosition == nohelloCode.length) {
activateWut();
nohelloCodePosition = 0;
}
} else {
nohelloCodePosition = 0;
}
});
function activateWut() {
document.body.style.backgroundImage = "url('img/why.gif')";
document.getElementById('wholesite').style.cssText = 'color:white !important';
document.getElementsByTagName('p')[0].style.cssText =
'color:white !important';
document.getElementsByTagName('p')[1].style.cssText =
'color:white !important';
document.getElementsByTagName('p')[2].style.cssText =
'color:white !important';
document.getElementsByTagName('p')[3].style.cssText =
'color:white !important';
document.getElementsByTagName('p')[4].style.cssText =
'color:white !important';
document.getElementsByTagName('p')[5].style.cssText =
'color:white !important';
document.getElementsByTagName('p')[6].style.cssText =
'color:white !important';
document.getElementsByTagName('p')[7].style.cssText =
'color:white !important';
document.getElementsByTagName('ul')[0].style.cssText =
'color:white !important';
document.getElementsByTagName('ul')[1].style.cssText =
'color:white !important';
document.getElementsByTagName('footer')[0].style.cssText =
'background: linear-gradient(180deg, rgba(0,0,0,0) 0%, rgba(0,0,0,0.3) 45%) !important; color:white !important';
document.getElementsByClassName('one')[0].style.cssText =
'box-shadow: -20px 20px 60px #000000, 20px -20px 60px #000000 !important';
document.getElementsByClassName('two')[0].style.cssText =
'box-shadow: -20px 20px 60px #000000, 20px -20px 60px #000000 !important';
document.getElementsByClassName('subtitle')[0].style.cssText =
'color:white !important; opacity: 50%';
}