-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript.js
More file actions
422 lines (383 loc) · 18.3 KB
/
script.js
File metadata and controls
422 lines (383 loc) · 18.3 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
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
// AOS init
AOS.init({
duration: 1200,
easing: 'ease-in-out',
once: true,
offset: 60
});
/* -----------------------
Audio controls
----------------------- */
const audio = document.getElementById("bg-music");
const audioBtn = document.getElementById("audio-control");
window.addEventListener("click", () => {
if (audio && audio.paused) audio.play();
}, { once: true });
if (audioBtn) {
audioBtn.addEventListener("click", () => {
if (!audio) return;
audio.muted = !audio.muted;
audioBtn.textContent = audio.muted ? "🔇" : "🔊";
});
}
/* -----------------------
Page content strings
----------------------- */
const content = {
home: `
<section class="hero" data-aos="fade-up">
<div class="hero-content">
<h1 class="hero-title">Saraswati Puja</h1>
<p class="hero-subtitle">A Celebration of Wisdom, Culture & Creative Harmony</p>
<p class="hero-quote"><em>“Spreading wisdom through devotion, together as one.”</em></p>
</div>
</section>
<section class="hero-description-section" data-aos="fade-up" data-aos-delay="100">
<div class="hero-description">
<h2>ABC Club Saraswati Puja</h2>
<p class="tagline"><em>Where Wisdom Dances with Art</em></p>
<p class="main-description">Since 1999, ABC Club has reimagined Saraswati Puja as more than a ritual — it's a celebration of learning, music, and creativity. From sacred symbols to soulful spaces, our festival becomes a living gallery of knowledge and culture.</p>
</div>
</section>
<div class="page-footer">
© 1999–2026 ABC Club. All Rights Reserved. | Designed & Developed with ❤️ by Arpan Garai
</div>
`,
about: `
<section class="about-section" data-aos="fade-up">
<img src="assets/about.png" alt="Saraswati Maa" class="about-img" />
<div class="about-text">
<h2 class="about-title">ABC Club</h2>
<p class="about-tagline"><em>We were, we are, we will be.</em></p>
<p>Rooted in tradition, driven by creativity, and united by community — ABC Club, established in 1999, is a Salboni-based socio-cultural organization in Paschim Medinipur, devoted to the celebration of knowledge, art, and collective spirit.</p>
<p>As a not-for-profit platform, we focus on Saraswati Puja as more than a ritual — a tribute to wisdom, creativity, and emerging talent.</p>
<h2 data-aos="fade-up" data-aos-delay="0">Our Vision</h2>
<ul>
<li data-aos="fade-up" data-aos-delay="100">To promote knowledge, creativity, and cultural legacy.</li>
<li data-aos="fade-up" data-aos-delay="200">To transform traditional festivals into platforms for growth.</li>
<li data-aos="fade-up" data-aos-delay="300">To support creative minds and artists.</li>
</ul>
<h2 data-aos="fade-up" data-aos-delay="400">Our Mission</h2>
<ul>
<li data-aos="fade-up" data-aos-delay="500">To organize Saraswati Puja with grace, innovation, and inclusivity.</li>
<li data-aos="fade-up" data-aos-delay="600">To bring together individuals from diverse backgrounds under one celebration.</li>
<li data-aos="fade-up" data-aos-delay="700">To use culture as a means of learning and unity.</li>
</ul>
<h2 data-aos="fade-up" data-aos-delay="800">Cultural Significance</h2>
<p data-aos="fade-up" data-aos-delay="900">
Saraswati Puja holds a sacred place in our hearts. It is not just a religious festival but a cultural celebration of learning, music, and creativity.Our event is dedicated to embracing this tradition with a touch of modernity—capturing the essence of devotion while celebrating the youth's spirit.
</p>
<h2 data-aos="fade-up" data-aos-delay="1300">Join Us</h2>
<p data-aos="fade-up" data-aos-delay="1400">
Be a part of this incredible celebration and witness the fusion of tradition and creativity like never before.
</p>
</div>
</section>
<div class="page-footer">
© 1999–2026 ABC Club. All Rights Reserved. | Designed & Developed with ❤️ by Arpan Garai
</div>
`,
schedule: `
<section class="section" data-aos="fade-up" style="display: flex; flex-direction: column; justify-content: center; align-items: center; text-align: center;">
<h2 style="color: #ffd700; font-size: 2rem; margin-bottom: 20px;">Event Schedule</h2>
<p style="max-width: 600px; color: #ccc;">Detailed day-wise schedule of Saraswati Puja 2026 will be updated soon. Stay tuned!</p>
</section>
`,
gallery: `
<section class="gallery-section" id="gallery2026" data-aos="fade-up">
<h2 class="gallery-title">Gallery 2026</h2>
<div class="gallery-grid">
<a href="assets/img%2016.jpeg" class="gallery-item" data-index="0"><img src="assets/img%2016.jpeg" alt="Gallery Image 1"></a>
<a href="assets/img%2017.jpeg" class="gallery-item" data-index="1"><img src="assets/img%2017.jpeg" alt="Gallery Image 2"></a>
<a href="assets/img%2018.jpg" class="gallery-item" data-index="2"><img src="assets/img%2018.jpg" alt="Gallery Image 3"></a>
</div>
</section>
<section class="gallery-section" id="gallery2025" data-aos="fade-up">
<h2 class="gallery-title">Gallery 2025</h2>
<div class="gallery-grid">
<a href="assets/img11.jpg" class="gallery-item" data-index="0"><img src="assets/img11.jpg" alt="Gallery Image 1"></a>
<a href="assets/img12.jpg" class="gallery-item" data-index="1"><img src="assets/img12.jpg" alt="Gallery Image 2"></a>
<a href="assets/img13.jpg" class="gallery-item" data-index="2"><img src="assets/img13.jpg" alt="Gallery Image 3"></a>
<a href="assets/img14.jpg" class="gallery-item" data-index="3"><img src="assets/img14.jpg" alt="Gallery Image 4"></a>
<a href="assets/img15.jpg" class="gallery-item" data-index="4"><img src="assets/img15.jpg" alt="Gallery Image 5"></a>
</div>
</section>
<section class="gallery-section" id="gallery2024" data-aos="fade-up">
<h2 class="gallery-title">Gallery 2024</h2>
<div class="gallery-grid">
<a href="assets/img4.jpg" class="gallery-item" data-index="0"><img src="assets/img4.jpg" alt="Gallery Image 1"></a>
<a href="assets/img5.jpg" class="gallery-item" data-index="1"><img src="assets/img5.jpg" alt="Gallery Image 2"></a>
<a href="assets/img6.jpg" class="gallery-item" data-index="2"><img src="assets/img6.jpg" alt="Gallery Image 3"></a>
<a href="assets/img7.jpg" class="gallery-item" data-index="3"><img src="assets/img7.jpg" alt="Gallery Image 4"></a>
<a href="assets/img8.jpg" class="gallery-item" data-index="4"><img src="assets/img8.jpg" alt="Gallery Image 5"></a>
<a href="assets/img9.jpg" class="gallery-item" data-index="5"><img src="assets/img9.jpg" alt="Gallery Image 6"></a>
<a href="assets/img10.jpg" class="gallery-item" data-index="5"><img src="assets/img10.jpg" alt="Gallery Image 6"></a>
</div>
</section>
<section class="gallery-section" id="gallery2023" data-aos="fade-up">
<h2 class="gallery-title">Gallery 2023</h2>
<div class="gallery-grid">
<a href="assets/img3.jpg" class="gallery-item" data-index="0"><img src="assets/img3.jpg" alt="Gallery Image 1"></a>
<a href="assets/img1.jpg" class="gallery-item" data-index="1"><img src="assets/img1.jpg" alt="Gallery Image 2"></a>
<a href="assets/img2.jpg" class="gallery-item" data-index="2"><img src="assets/img2.jpg" alt="Gallery Image 3"></a>
</div>
</section>
<div class="page-footer">
© 1999–2026 ABC Club. All Rights Reserved. | Designed & Developed with ❤️ by Arpan Garai
</div>
<div id="lightbox" style="display:none;">
<div id="lightbox-content">
<span id="lightbox-close">×</span>
<div id="lightbox-counter">1 / 5</div>
<img id="lightbox-image" src="">
<div id="lightbox-controls">
<button id="prev-btn">❮</button>
<button id="next-btn">❯</button>
</div>
</div>
</div>
`,
contact: `
<section id="contact">
<div class="centered-container" data-aos="fade-up">
<h2 class="location-heading">LOCATION</h2>
<div class="map-container">
<iframe
src="https://www.google.com/maps/embed?pb=!1m18!1m12!1m3!1d2972.7614297944433!2d87.32314939999999!3d22.639304799999998!2m3!1f0!2f0!3f0!3m2!1i1024!2i768!4f13.1!3m3!1m2!1s0x39f7e3d36e555053%3A0xb025d98f8163393f!2sSALBONI%20A.B.C%20CLUB!5e1!3m2!1sen!2sin!4v1745936857926!5m2!1sen!2sin"
width="100%" height="450" style="border:0;" allowfullscreen="" loading="lazy"
referrerpolicy="no-referrer-when-downgrade"></iframe>
</div>
</div>
</section>
<section class="contact-section" data-aos="fade-up">
<div class="contact-container">
<div class="contact-info">
<h2>Feel Free to Contact Us</h2>
<p><strong>Phone :</strong> (+91) 7001861255</p>
<p><strong>Phone :</strong> (+91) 8972623445</p>
<p><strong>Email :</strong> abcclub.official@gmail.com</p>
<p><strong>Address :</strong> Salboni, Chaktarini, West Bengal, India, Pin- 721147.</p>
</div>
<div class="contact-form">
<h2>Interested to work with us?</h2>
<p>Fill & Submit</p>
<form id="contact-form" action="https://formspree.io/f/mreebyve" method="POST">
<input type="text" name="name" placeholder="Your Name *" required>
<div class="form-row">
<input type="email" name="email" placeholder="Your Email *" required>
<input type="text" name="phone" placeholder="Your Number *" required>
</div>
<textarea name="message" placeholder="Message *" required></textarea>
<button type="submit">Send Message</button>
</form>
<div id="thank-you" style="display: none;">
<h3>Thank you for contacting us. We will reach you as soon as possible.</h3>
</div>
</div>
</div>
</section>
<div class="page-footer">
© 1999–2026 ABC Club. All Rights Reserved. | Designed & Developed with ❤️ by Arpan Garai
</div>
`
};
/* ---------- End content ---------- */
/* -----------------------
loadSection (returns a Promise)
----------------------- */
function loadSection(section) {
const mainContent = document.getElementById("main-content");
if (!content[section]) return Promise.resolve();
return new Promise((resolve) => {
mainContent.style.opacity = 0;
setTimeout(() => {
mainContent.innerHTML = content[section];
// Re-init AOS so animations work on newly-inserted elements
AOS.init({
duration: 1200,
easing: 'ease-in-out',
once: true,
offset: 60
});
mainContent.classList.add("fade-in");
mainContent.style.opacity = 1;
// Section-specific initializers
if (section === 'gallery') initLightbox();
if (section === 'contact') initContactForm();
// ---> NEW CODE: Update Active Navigation Link <---
const navLinks = document.querySelectorAll('.sidebar nav a');
navLinks.forEach(link => {
// Remove active class from all links
link.classList.remove('active-link');
// Add active class to the currently clicked link
if (link.getAttribute('href') === '#' + section) {
link.classList.add('active-link');
}
});
// ------------------------------------------------
resolve();
}, 300); // matches your fade timing
});
}
/* -----------------------
Lightbox
----------------------- */
function initLightbox() {
let currentIndex = 0;
const images = Array.from(document.querySelectorAll('.gallery-item'));
const lightbox = document.getElementById('lightbox');
const lightboxImage = document.getElementById('lightbox-image');
const closeBtn = document.getElementById('lightbox-close');
const prevBtn = document.getElementById('prev-btn');
const nextBtn = document.getElementById('next-btn');
const counter = document.getElementById('lightbox-counter');
if (!images.length || !lightbox) return;
function updateCounter() {
counter.textContent = `${currentIndex + 1} / ${images.length}`;
}
function showLightbox() {
lightbox.style.display = 'flex';
lightboxImage.src = images[currentIndex].getAttribute('href');
updateCounter();
}
images.forEach((item, index) => {
item.addEventListener('click', (e) => {
e.preventDefault();
currentIndex = index;
showLightbox();
});
});
closeBtn.addEventListener('click', () => {
lightbox.style.display = 'none';
});
prevBtn.addEventListener('click', () => {
currentIndex = (currentIndex - 1 + images.length) % images.length;
showLightbox();
});
nextBtn.addEventListener('click', () => {
currentIndex = (currentIndex + 1) % images.length;
showLightbox();
});
document.addEventListener('keydown', (e) => {
if (lightbox.style.display === 'flex') {
if (e.key === 'ArrowLeft') {
currentIndex = (currentIndex - 1 + images.length) % images.length;
showLightbox();
} else if (e.key === 'ArrowRight') {
currentIndex = (currentIndex + 1) % images.length;
showLightbox();
} else if (e.key === 'Escape') {
lightbox.style.display = 'none';
}
}
});
}
/* -----------------------
Contact form initializer (only invoked after contact is loaded)
----------------------- */
function initContactForm() {
const form = document.getElementById('contact-form');
const thankYou = document.getElementById('thank-you');
if (!form) return;
// avoid attaching duplicate listeners
if (form.dataset.listener === 'true') return;
form.dataset.listener = 'true';
form.addEventListener('submit', async function (e) {
e.preventDefault();
const emailInput = form.querySelector('input[type="email"]');
const email = emailInput ? emailInput.value : '';
if (!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(email)) {
alert("Please enter a valid email (e.g., user@example.com)");
return;
}
const formData = new FormData(form);
try {
const response = await fetch(form.action, {
method: 'POST',
body: formData,
headers: { 'Accept': 'application/json' }
});
if (response.ok) {
form.style.display = 'none';
if (thankYou) thankYou.style.display = 'block';
} else {
alert('Failed to submit form. Please try again.');
}
} catch (error) {
console.error('Error:', error);
alert('Failed to submit form. Please try again.');
}
});
}
/* -----------------------
Mobile sidebar behavior for nav links
- Waits for loadSection to finish, then closes sidebar & scrolls to top
----------------------- */
document.addEventListener('DOMContentLoaded', () => {
document.querySelectorAll('.sidebar nav a').forEach(link => {
link.addEventListener('click', (e) => {
e.preventDefault();
const href = link.getAttribute('href') || '#home';
const target = href.replace('#', '') || 'home';
// Load the section, then close sidebar + scroll to top
loadSection(target).then(() => {
const sidebar = document.getElementById('sidebar');
const hamburger = document.getElementById('hamburger');
const closeBtn = document.getElementById('closeBtn');
if (sidebar) sidebar.classList.remove('active');
if (hamburger) hamburger.style.display = 'flex';
if (closeBtn) closeBtn.style.display = 'none';
// Scroll to top to ensure newly-injected content is at viewport top
window.scrollTo({ top: 0, behavior: 'smooth' });
// update URL hash without triggering hashchange event
history.replaceState(null, '', '#' + target);
});
});
});
// Load initial section (respect hash)
const hash = window.location.hash.slice(1);
const defaultSection = hash || 'home';
loadSection(defaultSection);
});
// Also handle manual hash changes (user pastes/changes URL)
window.addEventListener('hashchange', () => {
const hash = window.location.hash.slice(1);
if (hash) loadSection(hash);
});
/* -----------------------
Sidebar toggler (existing function name used in HTML)
----------------------- */
function togglesidebar() {
const sidebar = document.getElementById('sidebar');
const hamburger = document.getElementById('hamburger');
const closeBtn = document.getElementById('closeBtn');
sidebar.classList.toggle('active');
if (sidebar.classList.contains('active')) {
if (hamburger) hamburger.style.display = 'none';
if (closeBtn) closeBtn.style.display = 'block';
} else {
if (hamburger) hamburger.style.display = 'flex';
if (closeBtn) closeBtn.style.display = 'none';
}
}
// schedule: `
// <section class="section" data-aos="fade-up" style="min-height: 70vh; display: flex; flex-direction: column; justify-content: center; align-items: center; text-align: center;">
// <h2 style="color: #ffd700; font-size: 2rem; margin-bottom: 20px;">Event Schedule</h2>
// <div style="max-width: 700px; color: #ccc; font-size: 1.05rem; text-align: left;">
// <h3 style="color: #ffcc00; margin-bottom: 10px;">Puja Rituals:</h3>
// <ul style="margin-bottom: 20px; padding-left: 20px;">
// <li><strong>Morning Puja:</strong> 7:00 AM – 9:00 AM</li>
// <li><strong>Pushpanjali:</strong> 9:30 AM, 11:30 AM, 1:30 PM batches</li>
// <li><strong>Aarti:</strong> Morning: (8:00 AM) & Evening: (6:00 PM)</li>
// </ul>
// <h3 style="color: #ffcc00; margin-bottom: 10px;">Bhog Distribution:</h3>
// <ul style="padding-left: 20px;">
// <li><strong>Bhog Timing:</strong> 12:30 PM – 2:00 PM</li>
// <li><em>Bhog will be distributed after Pushpanjali</em></li>
// </ul>
// </div>
// </section>
// <div class="page-footer">
// © 1999–2026 ABC Club. All Rights Reserved. | Designed & Developed with ❤️ by Arpan Garai
// </div>
// `,