-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.js
More file actions
292 lines (222 loc) · 10.5 KB
/
Copy pathindex.js
File metadata and controls
292 lines (222 loc) · 10.5 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
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
document.addEventListener("DOMContentLoaded", () => {
const filterButtons = document.querySelectorAll('.filter-btn');
const projectCards = document.querySelectorAll('.modern-card');
filterButtons.forEach(button => {
button.addEventListener('click', () => {
filterButtons.forEach(btn => btn.classList.remove('active'));
button.classList.add('active');
const filterValue = button.getAttribute('data-filter');
projectCards.forEach(card => {
const cardCategory = card.getAttribute('data-category');
if (filterValue === 'all' || filterValue === cardCategory) {
card.style.display = 'block';
card.style.animation = 'fadeInUp 0.5s ease forwards';
} else {
card.style.display = 'none';
}
});
});
});
const profileImg = document.getElementById('profile-img');
let clickCount = 0;
if(profileImg) {
profileImg.addEventListener('click', () => {
clickCount++;
if(clickCount === 3) {
document.body.classList.toggle('hacker-mode');
clickCount = 0;
}
setTimeout(() => {
clickCount = 0;
}, 3000);
});
}
const textToType = "Initializing sequence...\nLoading React components... 100%\nConnecting to PostgreSQL database... Success\nRunning Express.js server on port 3000...\nAccess Granted: Full-Stack Developer Mode Engaged.";
const typingElement = document.getElementById('typing-text');
const autoCursor = document.getElementById('auto-cursor');
const interactiveLine = document.getElementById('interactive-line');
const terminalInput = document.getElementById('terminal-input');
const terminalOutput = document.getElementById('terminal-output');
const terminalBody = document.getElementById('terminal-body');
let index = 0;
function typeTerminal() {
if(index < textToType.length) {
if(textToType.charAt(index) === '\n') {
typingElement.innerHTML += '<br><span class="prompt" style="color: #3b82f6; font-weight: bold;">guest@rahul-portfolio:~$</span> ';
} else {
typingElement.innerHTML += textToType.charAt(index);
}
index++;
terminalBody.scrollTop = terminalBody.scrollHeight;
setTimeout(typeTerminal, 40);
} else {
if(autoCursor) autoCursor.style.display = 'none';
if(interactiveLine) interactiveLine.style.display = 'flex';
if(terminalInput) terminalInput.focus();
terminalOutput.innerHTML += '<p style="color: #ffbd2e; margin-top: 15px; margin-bottom: 10px;">Type \'help\' to see available commands.</p>';
terminalBody.scrollTop = terminalBody.scrollHeight;
}
}
const terminalSection = document.getElementById('terminal-section');
if(terminalSection && typingElement) {
const observer = new IntersectionObserver((entries) => {
if(entries[0].isIntersecting) {
setTimeout(typeTerminal, 500);
observer.disconnect();
}
}, { threshold: 0.5 });
observer.observe(terminalSection);
}
if(terminalInput) {
terminalInput.addEventListener('keydown', function(event) {
if(event.key === 'Enter') {
const command = this.value.trim().toLowerCase();
let response = '';
// Commands ka logic
if(command === 'help') {
response = "Available commands: <br> -> <b>about</b>: Know who I am <br> -> <b>skills</b>: View my tech stack <br> -> <b>contact</b>: Get my email <br> -> <b>clear</b>: Clear the terminal";
}
else if (command === 'about') {
response = "Hi, I'm Rahul Pawar! A 2nd-year CS engineering student at Dadaji College, passionate about Full-Stack Web Development.";
}
else if (command === 'skills') {
response = "[Frontend]: HTML, CSS, JS, React <br> [Backend]: Node.js, Express, REST APIs <br> [Database]: PostgreSQL, SQLite";
}
else if (command === 'contact') {
response = "Email me at: pawar.rahuljii@gmail.com";
}
else if (command === 'clear') {
typingElement.innerHTML = '';
const extraMessages = terminalOutput.querySelectorAll('p:not(:first-child)');
extraMessages.forEach(msg => msg.remove());
this.value = '';
return;
}
else if (command === '') {
response = "";
}
else {
response = `bash: ${command}: command not found. Type 'help' for options.`;
}
if(command !== '') {
terminalOutput.innerHTML += `<p><span class="prompt" style="color: #3b82f6; font-weight: bold;">guest@rahul-portfolio:~$</span> <span style="color: #10b981;">${command}</span></p>`;
if(response) {
terminalOutput.innerHTML += `<p style="color: #a78bfa; margin-bottom: 10px;">${response}</p>`;
}
}
this.value = '';
terminalBody.scrollTop = terminalBody.scrollHeight;
}
});
}
const githubUsername = "rahulpawar-o7";
const repoCountEl = document.getElementById('repo-count');
const followerCountEl = document.getElementById('follower-count');
if(repoCountEl && followerCountEl) {
fetch(`https://api.github.com/users/${githubUsername}`)
.then(response => {
if(!response.ok) {
throw new Error("API call failed");
}
return response.json();
})
.then(data => {
repoCountEl.innerText = data.public_repos !== undefined ? data.public_repos : "N/A";
followerCountEl.innerText = data.followers !== undefined ? data.followers : "N/A";
})
.catch(error => {
repoCountEl.innerText = "Error";
followerCountEl.innerText = "Error";
console.error("GitHub API Data Fetch karne mein problem aayi:", error);
});
}
const yearSpan = document.getElementById('current-year');
if (yearSpan) {
yearSpan.textContent = new Date().getFullYear();
}
if (typeof VanillaTilt !== 'undefined') {
VanillaTilt.init(document.querySelectorAll(".project-card, .skill-category, .stat-box"), {
max: 15,
speed: 500,
glare: true,
"max-glare": 0.6,
scale: 1.02
});
}
if (typeof particlesJS !== 'undefined') {
const particleConfig = {
"particles": {
"number": { "value": 60, "density": { "enable": true, "value_area": 800 } },
"color": { "value": "#2563eb" }, /* Professional Blue Color */
"shape": { "type": "circle" },
"opacity": { "value": 0.5, "random": false },
"size": { "value": 3, "random": true },
"line_linked": {
"enable": true,
"distance": 150,
"color": "#2563eb",
"opacity": 0.3,
"width": 1.2
},
"move": {
"enable": true,
"speed": 2,
"direction": "none",
"random": false,
"straight": false,
"out_mode": "out",
"bounce": false
}
},
"interactivity": {
"detect_on": "canvas",
"events": {
"onhover": { "enable": true, "mode": "grab" },
"onclick": { "enable": true, "mode": "push" },
"resize": true
},
"modes": {
"grab": { "distance": 140, "line_linked": { "opacity": 1 } },
"push": { "particles_nb": 4 }
}
},
"retina_detect": true
};
// Teeno sections par same design apply karna
if(document.getElementById('particles-js')) particlesJS("particles-js", particleConfig);
if(document.getElementById('particles-skills')) particlesJS("particles-skills", particleConfig);
if(document.getElementById('particles-projects')) particlesJS("particles-projects", particleConfig);
}
const cursorDot = document.querySelector("[data-cursor-dot]");
const cursorOutline = document.querySelector("[data-cursor-outline]");
if(cursorDot && cursorOutline) {
window.addEventListener("mousemove", function (e) {
const posX = e.clientX;
const posY = e.clientY;
cursorDot.style.left = `${posX}px`;
cursorDot.style.top = `${posY}px`;
cursorOutline.animate({
left: `${posX}px`,
top: `${posY}px`
}, { duration: 500, fill: "forwards" });
});
const hoverElements = document.querySelectorAll("a, .btn, .about-image");
hoverElements.forEach(element => {
element.addEventListener("mouseenter", () => {
cursorOutline.classList.add("hovered");
});
element.addEventListener("mouseleave", () => {
cursorOutline.classList.remove("hovered");
});
});
}
const progressBar = document.getElementById('scroll-progress');
if (progressBar) {
window.addEventListener('scroll', () => {
const scrollHeight = document.documentElement.scrollHeight - document.documentElement.clientHeight;
const scrollTop = document.documentElement.scrollTop;
const scrollPercentage = (scrollTop / scrollHeight) * 100;
progressBar.style.width = `${scrollPercentage}%`;
});
}
});