-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript.js
More file actions
344 lines (302 loc) · 14.8 KB
/
Copy pathscript.js
File metadata and controls
344 lines (302 loc) · 14.8 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
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
// =========================================
// Project Data
// =========================================
const projectsData = {
"1": {
title: "AI-Based Wrong-Way Traffic Offense Detection System",
image: "assets/project1.png",
description: "An intelligent traffic monitoring system that automatically detects wrong-way driving violations from CCTV footage using Computer Vision. The system processes uploaded traffic videos, tracks vehicle movement direction, flags violations, and generates evidence frames to support enforcement.",
features: [
"Vehicle detection using deep learning models (YOLO-based)",
"Multi-object tracking for movement analysis",
"Direction detection logic to identify wrong-way violations",
"Automatic extraction of evidence frames with timestamps",
"Optional number plate recognition (ANPR) for enforcement support",
"Violation summary dashboard with visual overlays"
],
techStack: ["Python", "FastAPI", "MongoDB", "YOLO (Ultralytics)", "OpenCV", "React"],
demoLink: "https://wrong-way-ai.vercel.app/",
repoLink: "https://github.com/Sayeed-5/WrongWayAI"
},
"2": {
title: "Interstellar Asteroid Tracker & Risk Analyzer",
image: "assets/project2.png",
description: "A full-stack web platform for real-time monitoring of Near-Earth Objects (NEOs), integrating live NASA NeoWs API data to provide trajectory insights, risk categorization, and proximity-based alerts through an intuitive space-themed dashboard",
features: [
"Real-time asteroid data feed (velocity, diameter, miss distance) via NASA NeoWs API",
"Risk Analysis Engine categorizing objects by hazardous status and dynamic risk score",
"User authentication with JWT for saving and tracking watched asteroids",
"Automated close-approach alert system with dashboard notifications",
"Dockerized multi-container deployment using Docker Compose"
],
techStack: ["React", "Express", "Node.js", "MongoDB", "NASA NeoWs API", "JWT Authentication", "Docker & Docker Compose", "Socket.io"],
demoLink: "https://cosmic-watch-eosin.vercel.app/",
repoLink: "https://github.com/Nityananda2005/Cosmic-Watch"
},
"3": {
title: "AgriSphere – AI-Powered Agri-Tech Platform",
image: "assets/project3.png",
description: "A full-stack agri-tech platform designed to modernize farming by combining AI-driven crop disease detection, an education hub, and a direct farmer-to-buyer marketplace in a single unified system.",
features: [
"AI-based plant disease detection using image analysis",
"AI chatbot for instant agricultural guidance and queries",
"Education hub with modern farming practices and government schemes",
"Direct marketplace (AgriMart) enabling farmers to sell produce without middlemen",
"Product and order management dashboard with real-time updates",
"Secure authentication and user management"
],
techStack: ["React", "Tailwind CSS", "Firebase Authentication", "Firebase Firestore", "Gemini API"],
demoLink: "https://agri-sphare.vercel.app/",
repoLink: "https://github.com/Sayeed-5/AgriSphere"
}
};
document.addEventListener('DOMContentLoaded', () => {
// =========================================
// Custom Cursor
// =========================================
const cur = document.getElementById('cur');
const ring = document.getElementById('cur-ring');
let mx = 0, my = 0, rx = 0, ry = 0;
document.addEventListener('mousemove', e => {
mx = e.clientX;
my = e.clientY;
});
(function loop() {
cur.style.left = mx + 'px';
cur.style.top = my + 'px';
rx += (mx - rx) * 0.1;
ry += (my - ry) * 0.1;
ring.style.left = rx + 'px';
ring.style.top = ry + 'px';
requestAnimationFrame(loop);
})();
document.querySelectorAll('a, button, input, textarea, .project-card, .hackathon-card, .focus-card-new, .ct-soc').forEach(el => {
el.addEventListener('mouseenter', () => {
cur.style.transform = 'translate(-50%,-50%) scale(.3)';
ring.style.transform = 'translate(-50%,-50%) scale(1.8)';
ring.style.borderColor = 'var(--accent)';
});
el.addEventListener('mouseleave', () => {
cur.style.transform = 'translate(-50%,-50%) scale(1)';
ring.style.transform = 'translate(-50%,-50%) scale(1)';
ring.style.borderColor = 'rgba(200,241,53,.4)';
});
});
// =========================================
// Theme Toggle Logic
// =========================================
const themeToggleBtn = document.getElementById('theme-toggle');
const htmlElement = document.documentElement;
const savedTheme = localStorage.getItem('theme');
if (savedTheme) {
htmlElement.setAttribute('data-theme', savedTheme);
} else {
htmlElement.setAttribute('data-theme', 'dark');
}
themeToggleBtn.addEventListener('click', () => {
const currentTheme = htmlElement.getAttribute('data-theme');
const newTheme = currentTheme === 'dark' ? 'light' : 'dark';
htmlElement.setAttribute('data-theme', newTheme);
localStorage.setItem('theme', newTheme);
});
// =========================================
// Mobile Menu Toggle
// =========================================
const mobileMenuBtn = document.querySelector('.mobile-menu-btn');
const navLinks = document.getElementById('nav-links');
mobileMenuBtn.addEventListener('click', () => {
navLinks.classList.toggle('active');
});
document.querySelectorAll('.nav-link').forEach(link => {
link.addEventListener('click', () => {
navLinks.classList.remove('active');
});
});
// =========================================
// Navbar Scroll & Active Link Highlight
// =========================================
const navbar = document.getElementById('navbar');
const sections = document.querySelectorAll('section, header');
const navItems = document.querySelectorAll('.nav-link');
const handleScroll = () => {
// Navbar scrolled state
navbar.classList.toggle('scrolled', scrollY > 50);
// Active nav link
let current = '';
sections.forEach(section => {
const sectionTop = section.offsetTop;
if (scrollY >= (sectionTop - 100)) {
current = section.getAttribute('id');
}
});
navItems.forEach(li => {
li.classList.remove('active');
if (li.getAttribute('href').includes(current)) {
li.classList.add('active');
}
});
};
window.addEventListener('scroll', handleScroll, { passive: true });
// =========================================
// Scroll Reveal (.reveal class — portfolio.html style)
// =========================================
function checkReveal() {
document.querySelectorAll('.reveal').forEach(el => {
const rect = el.getBoundingClientRect();
if (rect.top < window.innerHeight - 60) {
el.classList.add('visible');
}
});
}
checkReveal();
window.addEventListener('scroll', checkReveal, { passive: true });
// =========================================
// Scroll Animation — .fade-in-up (Intersection Observer)
// =========================================
const observer = new IntersectionObserver((entries, obs) => {
entries.forEach(entry => {
if (entry.isIntersecting) {
entry.target.classList.add('visible');
obs.unobserve(entry.target);
}
});
}, { root: null, rootMargin: '0px', threshold: 0.1 });
document.querySelectorAll('.fade-in-up').forEach(el => observer.observe(el));
// =========================================
// Hero Parallax
// =========================================
const heroSection = document.getElementById('home');
const heroGlow = document.querySelector('.hero-glow-orb');
const heroGrid = document.querySelector('.hero-grid-bg');
if (heroSection) {
heroSection.addEventListener('mousemove', e => {
const cx = window.innerWidth / 2;
const cy = window.innerHeight / 2;
const dx = (e.clientX - cx) / cx;
const dy = (e.clientY - cy) / cy;
if (heroGlow) heroGlow.style.transform = `translate(${dx * 20}px, ${dy * 20}px)`;
if (heroGrid) heroGrid.style.transform = `translate(${dx * 6}px, ${dy * 6}px)`;
});
}
// =========================================
// Modal Logic
// =========================================
const modal = document.getElementById('project-modal');
const modalCloseBtns = document.querySelectorAll('[data-close]');
const viewDetailsBtns = document.querySelectorAll('.view-details-btn');
const modalTitle = document.getElementById('modal-title');
const modalDesc = document.getElementById('modal-description');
const modalFeatures = document.getElementById('modal-features');
const modalTechStack = document.getElementById('modal-tech-stack');
const modalDemoLink = document.getElementById('modal-demo-link');
const modalRepoLink = document.getElementById('modal-github-link');
const modalImage = document.getElementById('modal-image');
const modalImgPlaceholder = document.getElementById('modal-img-placeholder');
const openModal = (projectId) => {
const project = projectsData[projectId];
if (!project) return;
modalTitle.textContent = project.title;
modalDesc.textContent = project.description;
modalFeatures.innerHTML = project.features.map(f => `<li>${f}</li>`).join('');
modalTechStack.innerHTML = project.techStack.map(t => `<span>${t}</span>`).join('');
modalDemoLink.href = project.demoLink;
modalRepoLink.href = project.repoLink;
// Show project image if available
if (project.image) {
modalImage.src = project.image;
modalImage.style.display = 'block';
modalImgPlaceholder.style.display = 'none';
} else {
modalImage.style.display = 'none';
modalImgPlaceholder.style.display = 'flex';
}
modal.classList.add('active');
modal.setAttribute('aria-hidden', 'false');
document.body.style.overflow = 'hidden';
};
const closeModal = () => {
modal.classList.remove('active');
modal.setAttribute('aria-hidden', 'true');
document.body.style.overflow = '';
};
viewDetailsBtns.forEach(btn => {
btn.addEventListener('click', () => openModal(btn.getAttribute('data-project')));
});
modalCloseBtns.forEach(btn => btn.addEventListener('click', closeModal));
document.addEventListener('keydown', e => {
if (e.key === 'Escape' && modal.classList.contains('active')) closeModal();
});
// =========================================
// Contact Form
// =========================================
const cfSubmit = document.getElementById('cf-submit');
if (cfSubmit) {
cfSubmit.addEventListener('click', () => {
const name = document.getElementById('cf-name').value.trim();
const email = document.getElementById('cf-email').value.trim();
const subject = document.getElementById('cf-subject').value.trim();
const message = document.getElementById('cf-message').value.trim();
if (!name || !email || !message) {
cfSubmit.textContent = 'Fill all required fields!';
cfSubmit.style.background = 'transparent';
cfSubmit.style.color = '#ff6b6b';
cfSubmit.style.border = '1px solid #ff6b6b';
setTimeout(() => {
cfSubmit.textContent = 'Send Message →';
cfSubmit.style.cssText = '';
}, 2500);
return;
}
// Open mailto with pre-filled content
const mailtoLink = `mailto:sayeed.ahemmad.05@gmail.com?subject=${encodeURIComponent(subject || 'Portfolio Contact')}&body=${encodeURIComponent(`Hi Sayed,\n\nName: ${name}\nEmail: ${email}\n\n${message}`)}`;
window.open(mailtoLink, '_blank');
// Visual feedback
cfSubmit.textContent = 'Message Sent! ✓';
cfSubmit.style.background = 'var(--accent)';
setTimeout(() => {
cfSubmit.textContent = 'Send Message →';
cfSubmit.style.background = '';
// Clear form
document.getElementById('cf-name').value = '';
document.getElementById('cf-email').value = '';
document.getElementById('cf-subject').value = '';
document.getElementById('cf-message').value = '';
}, 3000);
});
}
// =========================================
// Hackathon Image Lightbox
// =========================================
const lightbox = document.getElementById('img-lightbox');
const lightboxImg = document.getElementById('lightbox-img');
const lightboxClose = document.getElementById('lightbox-close');
const lightboxBackdrop = document.getElementById('lightbox-backdrop');
const openLightbox = (src, alt) => {
lightboxImg.src = src;
lightboxImg.alt = alt || 'Hackathon photo';
lightbox.classList.add('active');
lightbox.setAttribute('aria-hidden', 'false');
document.body.style.overflow = 'hidden';
};
const closeLightbox = () => {
lightbox.classList.remove('active');
lightbox.setAttribute('aria-hidden', 'true');
document.body.style.overflow = '';
// Clear src after transition so old image isn't flash-visible next open
setTimeout(() => { lightboxImg.src = ''; }, 350);
};
// Attach click to every hackathon image CONTAINER (not the img child,
// because the ::after overlay could block pointer events on the img).
document.querySelectorAll('.hack-img-container').forEach(container => {
container.addEventListener('click', (e) => {
e.stopPropagation(); // don't bubble to hackathon-card
const img = container.querySelector('img');
if (img) openLightbox(img.src, img.alt);
});
});
lightboxClose.addEventListener('click', closeLightbox);
lightboxBackdrop.addEventListener('click', closeLightbox);
document.addEventListener('keydown', e => {
if (e.key === 'Escape' && lightbox.classList.contains('active')) closeLightbox();
});
});