-
Notifications
You must be signed in to change notification settings - Fork 8
/
index.html
275 lines (250 loc) · 8.24 KB
/
index.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
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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>LinkOfDeath.com - when it will catch you it will kill you(r tab)</title>
<meta property="og:title" content="LinkOfDeath.com - when it will catch you it will kill you(r tab)" />
<meta property="og:description" content="Do not open" />
<meta property="og:type" content="game" />
<meta property="og:url" content="http://linkofdeath.com" />
<meta property="og:image" content="http://ecx.images-amazon.com/images/I/61-TKSWRAML._SY355_.jpg">
<meta name="viewport" content="target-densitydpi=device-dpi, width=device-width, user-scalable=no, maximum-scale=1, minimum-scale=1" />
<link rel="image_src" href="http://ecx.images-amazon.com/images/I/61-TKSWRAML._SY355_.jpg">
<style>
body {
background: #fbfbfb;
font-family: sans-serif;
overflow: hidden;
}
body.state-playing {
cursor: none;
background: #fff;
}
body.state-playing #you {
display: block;
}
body.state-playing #link {
display: block;
}
body.state-playing #score {
display: block;
}
body.state-playing #gameover {
display: none;
}
body.state-finger-removed #keepfinger {
display: block;
}
h1 {
font-size: 1.5em;
}
h2 {
font-size: 1.2em;
}
#gitlink {
display: none;
}
body.state-playing #gitlink {
display: block;
}
button {
cursor: pointer;
box-shadow: 3px 3px 5px #ccc;
}
.deadfolder {
background: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAoCAIAAAA35e4mAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAIGNIUk0AAHolAACAgwAA+f8AAIDpAAB1MAAA6mAAADqYAAAXb5JfxUYAAACxSURBVHja7FdBDoAwCKvGH+7CE/fHXTyYLIsXKbooppx2AFLawGBprQEAYGZwWK015u+0FR+zzwFaSikUt12pSf6S7Mq2cKSzy5z+XVBJ9rhk7KBjBZVkAiRALwMys96Q45vqZypDtsF4jMGjrNhIZDNkY2isLMYTmyH/CjvJ9LkKkFZY9tII92xChkZW/HWfuPQHJmTozicfIOxHt/2k81KD0b9+iKEkgHYAAAD//wMAQ6ROUVC0zhIAAAAASUVORK5CYII=');
width: 48px;
height: 40px;
}
#link{
display: none;
background: #f00;
color: #fff;
position:absolute;
font-size: 10px;
padding: 5px;
border-radius: 10px;
box-shadow: 0px 0px 15px #ffaaaa;
z-index: 5;
}
#you {
display: none;
background: #000;
width: 20px;
height: 20px;
position:absolute;
border-radius: 10px;
box-shadow: 2px 2px 15px #ccc;
}
#score {
display: none;
position:absolute;
top: 10px;
right: 10px;
font-size: 30px;
}
#restart {
padding: 10px;
border: 0;
border-radius: 5px;
background: #33f;
font-weight: bold;
color: #fff;
}
#gameover {
display: block;
padding: 100px 15vw;
}
#keepfinger {
display: none;
}
</style>
</head>
<body class="state-playing">
<div id="score"></div>
<div id="you"></div>
<a id="link" href="http://a/%%30%30">LINK OF DEATH<br> http://a/%%30%30</a>
<div id="gameover">
<div class="deadfolder"></div>
<h1>Aw, Snap!</h1>
<p>This is not a real error. Use Chrome to see the real crash! Update: The latest Chrome update fixes the error</p>
<h1 id="keepfinger">KEEP YOUR FINGER ON THE SCREEN</h1>
<h1><strong>Your score is: <span id="final-score"></span></strong></h1>
<button id="restart">Play again</button>
<h2>Try our other browser game, but much bigger one (first playable version)</h2>
<p><strong>Works the best in Chrome(Canary version recommended), playable in Firefox, Edge - you can try, IE - Good luck with that!</strong></p>
<p><a href="http://bad.city" target="_blank">Bad.City - multiplayer "Grand Theft Auto" in a browser</a></p>
</div>
<a id="gitlink" href="https://github.com/DVLP/LinkOfDeath"><img style="position: absolute; top: 0; left: 0; border: 0;" src="https://camo.githubusercontent.com/82b228a3648bf44fc1163ef44c62fcc60081495e/68747470733a2f2f73332e616d617a6f6e6177732e636f6d2f6769746875622f726962626f6e732f666f726b6d655f6c6566745f7265645f6161303030302e706e67" alt="Fork me on GitHub" data-canonical-src="https://s3.amazonaws.com/github/ribbons/forkme_left_red_aa0000.png"></a>
</body>
</html>
<script>
'use strict';
var currX = 0;
var currY = 0;
var clientX = 0;
var clientY = 0;
var score = 0;
var difficulty = 100;
var you = document.getElementById('you');
var scoreEl = document.getElementById('score');
var link = document.getElementById('link');
var finalScore = document.getElementById('final-score');
var restart = document.getElementById('restart');
var linkOffsetX = link.offsetWidth / 2;
var linkOffsetY = link.offsetHeight / 2;
var difficultyLimit = 1.5;
var mouseActive = false;
var mouseActiveTimer = null;
var gameLoop = null;
var scoreText = '';
var gameState = '';
var states = {
PLAYING: 'state-playing',
FINGER_REMOVED: 'state-finger-removed',
GAME_END: 'state-game-end'
};
link.addEventListener('mouseover', function (e) {
endGame();
});
restart.addEventListener('click', function () {
startGame();
});
document.addEventListener('mousemove', function (e) {
clientX = e.clientX + document.body.scrollLeft;
clientY = e.clientY + document.body.scrollTop;
mouseActive = true;
you.style.left = clientX + 'px';
you.style.top = clientY + 'px';
// stop adding score when a user is not moving mouse
if(mouseActiveTimer) {
clearTimeout(mouseActiveTimer);
}
mouseActiveTimer = setTimeout(function () {
mouseActive = false;
}, 1000);
});
document.addEventListener('touchmove', function (e) {
e.preventDefault();
clientX = e.changedTouches[0].clientX + document.body.scrollLeft;
clientY = e.changedTouches[0].clientY + document.body.scrollTop;
mouseActive = true;
you.style.left = clientX + 'px';
you.style.top = clientY + 'px';
// stop adding score when a user is not moving mouse
if(mouseActiveTimer) {
clearTimeout(mouseActiveTimer);
}
mouseActiveTimer = setTimeout(function () {
mouseActive = false;
}, 1000);
});
document.addEventListener('touchend', function (e) {
if(gameState !== states.PLAYING) {
return;
}
endGame();
setGameState(states.FINGER_REMOVED);
});
function setGameState (state) {
gameState = state;
document.body.className = '';
//state.map(function (st) {
document.body.classList.add(state);
//});
}
function startGame () {
currX = 0;
currY = 0;
clientX = 0;
clientY = 0;
score = 0;
difficulty = 100;
setGameState(states.PLAYING);
gameLoop = setInterval(function () {
currX += (clientX - currX) / (2 * difficulty);
currY += (clientY - currY) / (2 * difficulty);
if(clientX && Math.abs(currX - clientX) < 30 && Math.abs(currY - clientY) < 15) {
endGame();
setGameState(states.GAME_END);
}
link.style.left = currX - linkOffsetX + 'px';
link.style.top = currY - linkOffsetY + 'px';
if(mouseActive) {
score++;
}
scoreText = 'Score:' + score;
scoreEl.textContent = scoreText;
document.title = scoreText;
if (difficulty > difficultyLimit) {
difficulty -= 0.05;
} else {
difficulty = 1.5;
}
if (currX > window.innerWidth) {
currX = window.innerWidth;
} else if (currX < 0) {
currX = 0;
}
if (currY < 0) {
currY = 0;
} else if (currY > window.innerHeight) {
currY = window.innerHeight;
}
}, 10);
}
function endGame () {
clearInterval(gameLoop);
setGameState(states.GAME_END);
finalScore.textContent = score;
}
startGame();
</script>
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-67882877-1', 'auto');
ga('send', 'pageview');
</script>