-
Notifications
You must be signed in to change notification settings - Fork 0
/
app.js
97 lines (92 loc) · 3.45 KB
/
app.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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
document.getElementById('command').addEventListener('keypress', function (e) {
if (e.key === 'Enter') {
const command = e.target.value.trim().toLowerCase();
const output = document.getElementById('command-output');
let response = '';
switch (command) {
case 'help':
response = `
<div>
<p><strong>help</strong>: List all commands</p>
<p><strong>mefetch</strong>: About me</p>
<p><strong>socialfetch</strong>: Social media links</p>
<p><strong>cmatrix</strong>: Put this because I was bored</p>
<p><strong>load(gui)</strong>: Load the GUI version of this website</p>
<p><strong>clear</strong>: Clear the screen</p>
<p><strong>repo</strong>: Shows the source files of the website</p>
</div>`;
break;
case 'mefetch':
response = `
<pre style="color: #ffc482;">
. . --->name: Blue_clouds
. ; |->weaving dreams for the virtual sky
: - --+- - |->i have no idea what I'm doing with my life
! . ! |->i need sleep
| . . |->i love coding, music, experimenting with things
|_ + --->lived since: December, 2008
, | \`.
--- --+-<#>-+- --- -- -
\`._|_,'
T
|
!
: . :
. *
</pre>`;
break;
case 'socialfetch':
response = `
<div>
<p><a href="https://github.com/blue-clouds4" target="_blank" class="data-link">GitHub</a></p>
<p><a href="https://www.instagram.com/blue_harsha/" target="_blank" class="data-link">Instagram</a></p>
</div>`;
break;
case 'cmatrix':
response = `<p>Running cmatrix... (Matrix effect)</p>`;
runCmatrix();
break;
case '1986':
response = `<p>1986 - A hidden gem!</p>`;
break;
case 'repo':
response = `
<div>
<p><a href="https://github.com/blue-clouds4/blue-clouds4.github.io/tree/main" target="_blank" class="data-link">source-file</a></p>
</div>`;
break;
case 'load(gui)':
response = `<p>Loading GUI...</p>`;
window.location.href = "https://blue-clouds4.github.io/gui-version-oftheweb/";
break;
case 'clear':
output.innerHTML = '';
break;
default:
response = `<p class="command-not-found">Command not found: ${command}</p>`;
}
if (command !== 'clear') {
output.innerHTML += `<div>${response}</div>`;
}
e.target.value = '';
}
});
function runCmatrix() {
const output = document.getElementById('command-output');
let matrixInterval = setInterval(() => {
let matrixLine = '';
for (let i = 0; i < 60; i++) {
matrixLine += Math.random() > 0.5 ? '1' : '0';
}
const matrixDiv = document.createElement('div');
matrixDiv.style.color = '#00ff00';
matrixDiv.textContent = matrixLine;
output.appendChild(matrixDiv);
if (output.children.length > 20) {
output.removeChild(output.firstChild);
}
}, 100);
setTimeout(() => {
clearInterval(matrixInterval);
}, 5000);
}