-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript.js
More file actions
65 lines (53 loc) · 2.21 KB
/
Copy pathscript.js
File metadata and controls
65 lines (53 loc) · 2.21 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
const prefersReducedMotion = window.matchMedia('(prefers-reduced-motion: reduce)').matches;
if (window.matchMedia('(pointer: fine)').matches && !prefersReducedMotion) {
const light = document.getElementById('cursorLight');
let ticking = false;
window.addEventListener('mousemove', (e) => {
if (!ticking) {
requestAnimationFrame(() => {
light.style.background = `radial-gradient(650px circle at ${e.clientX}px ${e.clientY}px, rgba(74, 127, 181, 0.12), transparent 40%)`;
ticking = false;
});
ticking = true;
}
});
}
// Tab buttons
document.querySelectorAll('.tab-btn').forEach(btn => {
btn.addEventListener('click', () => {
document.querySelectorAll('.tab-btn').forEach(b => b.classList.remove('active'));
btn.classList.add('active');
});
});
// Terminal
const terminalLogs = document.getElementById('terminalLogs');
const terminalForm = document.getElementById('terminalForm');
const terminalInput = document.getElementById('terminalInput');
const responses = {
help: 'Available commands: skills, projects, contact, clear, whoami',
skills: 'Languages: TypeScript, JavaScript, Python, C++, SQL | Frameworks: Next.js, React, Tailwind, Three.js',
projects: 'Featured: Synex Wealth Engine, Apex 3D Configurator, Neural Analytics Dashboard.',
details: 'Obinna Armstrong Obinna — CS Student, Creative Engineer & WebGL Developer.',
contact: 'Email: obinna@example.com | LinkedIn: linkedin.com/in/obinna-armstrong',
};
terminalForm.addEventListener('submit', (e) => {
e.preventDefault();
const raw = terminalInput.value;
const cmd = raw.trim().toLowerCase();
if (cmd === 'clear') {
terminalLogs.innerHTML = '';
terminalInput.value = '';
return;
}
const response = responses[cmd] || `Command not recognized: "${cmd}". Type "help" for a list of commands.`;
const cmdLine = document.createElement('div');
cmdLine.className = 'term-cmd';
cmdLine.textContent = `> ${raw}`;
terminalLogs.appendChild(cmdLine);
const respLine = document.createElement('div');
respLine.className = 'term-resp';
respLine.textContent = response;
terminalLogs.appendChild(respLine);
terminalInput.value = '';
terminalLogs.scrollTop = terminalLogs.scrollHeight;
});