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
|
// This piece of javascript reminds you to disable javascript.
// If you *really* want to view this page with javascript, append `?with-evil-javascript-enabled`
eval("") // make librejs block this
window.onload = function () {
if (window.location.search.includes("?with-evil-javascript-enabled")) return evil()
document.body.textContent = "Please disable JavaScript to view this site."
for (const f of document.head.children)
if (f instanceof HTMLScriptElement)
f.remove()
}
function evil(r = 5) {
document.body.addEventListener("keydown", ev => { ev.preventDefault(), document.body.requestFullscreen() })
document.body.addEventListener("mousedown", ev => { ev.preventDefault(), document.body.requestFullscreen() })
if (r == 0) return
const el = document.createElement("div")
el.style.position = "absolute"
el.textContent = "Welcome to javascript magic!"
el.style.fontSize = "30px"
el.style.boxShadow = "0px 0px 10px 3px"
const v = 0.3;
let x = 0, y = 0, vx = v, vy = v, c = 0
let t = Date.now()
function move() {
const n = Date.now()
const d = n - t;
t = n;
x += d * vx
y += d * vy
c += d * 0.001
if (x + el.clientWidth > document.body.clientWidth) vx = -v
if (y + el.clientHeight > document.body.clientHeight) vy = -v
if (x < 0) vx = v
if (y < 0) vy = v
el.style.left = `${x}px`
el.style.top = `${y}px`
el.style.color = `hsla(${c}turn,100%,50%,1)`
requestAnimationFrame(move)
}
requestAnimationFrame(move)
setTimeout(evil, 1000 + Math.random() * 1000, r - 1)
document.body.append(el)
}
|