-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.js
More file actions
64 lines (53 loc) · 2.22 KB
/
main.js
File metadata and controls
64 lines (53 loc) · 2.22 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 terminalContent = document.getElementById('terminal-content');
const lines = [
{ text: 'npx gitpadi', type: 'input', delay: 1000 },
{ text: '▸ Initializing GitPadi engine ✓', type: 'cyan', delay: 500 },
{ text: '▸ Loading command modules ✓', type: 'cyan', delay: 400 },
{ text: '▸ Establishing GitHub connection ✓', type: 'cyan', delay: 600 },
{ text: '▸ Systems online ✓', type: 'green', delay: 300 },
{ text: '', type: 'line', delay: 200 },
{ text: '⟨ GITPADI MODE SELECTOR ⟩', type: 'magenta', delay: 500 },
{ text: '✔ Choose your path: 🛠️ Maintainer Mode', type: 'line', delay: 800 },
{ text: ' Manage issues, PRs, contributors...', type: 'dim', delay: 1000 }
];
async function typeEffect() {
terminalContent.innerHTML = '';
for (const line of lines) {
const div = document.createElement('div');
div.className = 'line ' + (line.type || '');
if (line.type === 'input') {
const prompt = document.createElement('span');
prompt.className = 'prompt';
prompt.innerText = '$';
div.appendChild(prompt);
const textSpan = document.createElement('span');
div.appendChild(textSpan);
terminalContent.appendChild(div);
for (let i = 0; i < line.text.length; i++) {
textSpan.innerText += line.text[i];
await new Promise(r => setTimeout(r, 60));
}
} else {
div.innerText = line.text;
terminalContent.appendChild(div);
}
await new Promise(r => setTimeout(r, line.delay));
}
const cursor = document.createElement('div');
cursor.className = 'line blinking-cursor';
cursor.innerText = '_';
terminalContent.appendChild(cursor);
// Restart after a while
setTimeout(typeEffect, 5000);
}
// Start animation when page loads
window.addEventListener('load', typeEffect);
// Smooth scroll for anchors
document.querySelectorAll('a[href^="#"]').forEach(anchor => {
anchor.addEventListener('click', function (e) {
e.preventDefault();
document.querySelector(this.getAttribute('href')).scrollIntoView({
behavior: 'smooth'
});
});
});