/* ================================================== LSCI — shared.js Injects shared Navbar + Footer into every page, manages auth state across all pages. ================================================== */ (function () { 'use strict'; /* ── YEAR ──────────────────────────────────────── */ document.querySelectorAll('.year').forEach(function (el) { el.textContent = new Date().getFullYear(); }); /* ── THEME ─────────────────────────────────────── */ var html = document.documentElement; function applyTheme(t) { html.setAttribute('data-theme', t); localStorage.setItem('lsci-theme', t); var sun = document.getElementById('iconSun'); var moon = document.getElementById('iconMoon'); var btn = document.getElementById('themeToggle'); if (sun) sun.style.display = (t === 'dark') ? 'block' : 'none'; if (moon) moon.style.display = (t === 'dark') ? 'none' : 'block'; if (btn) btn.setAttribute('aria-label', t === 'dark' ? 'Switch to light mode' : 'Switch to dark mode'); } var saved = localStorage.getItem('lsci-theme') || (window.matchMedia('(prefers-color-scheme:dark)').matches ? 'dark' : 'light'); applyTheme(saved); var themeBtn = document.getElementById('themeToggle'); if (themeBtn) { themeBtn.addEventListener('click', function () { applyTheme(html.getAttribute('data-theme') === 'dark' ? 'light' : 'dark'); }); } /* ── NAVBAR SCROLL SHADOW ─────────────────────── */ var navbar = document.getElementById('navbar'); if (navbar) { window.addEventListener('scroll', function () { navbar.classList.toggle('scrolled', window.scrollY > 24); }, { passive: true }); } /* ── MOBILE MENU ───────────────────────────────── */ var menuToggle = document.getElementById('menuToggle'); var menuClose = document.getElementById('menuClose'); var mobileMenu = document.getElementById('mobileMenu'); var mobileOverlay = document.getElementById('mobileOverlay'); function openMenu() { if (!mobileMenu) return; mobileMenu.classList.add('open'); mobileOverlay.classList.add('open'); mobileOverlay.removeAttribute('aria-hidden'); menuToggle.setAttribute('aria-expanded', 'true'); document.body.style.overflow = 'hidden'; } function closeMenu() { if (!mobileMenu) return; mobileMenu.classList.remove('open'); mobileOverlay.classList.remove('open'); mobileOverlay.setAttribute('aria-hidden', 'true'); menuToggle.setAttribute('aria-expanded', 'false'); document.body.style.overflow = ''; } if (menuToggle) menuToggle.addEventListener('click', openMenu); if (menuClose) menuClose.addEventListener('click', closeMenu); if (mobileOverlay) mobileOverlay.addEventListener('click', closeMenu); document.querySelectorAll('.mobile-nav-link').forEach(function (l) { l.addEventListener('click', closeMenu); }); document.addEventListener('keydown', function (e) { if (e.key === 'Escape' && mobileMenu && mobileMenu.classList.contains('open')) closeMenu(); }); /* ── AUTH STATE → UPDATE NAV ───────────────────── */ // Wait for Firebase to be ready if (typeof firebase !== 'undefined') { firebase.auth().onAuthStateChanged(function (user) { var navRight = document.getElementById('navAuthArea'); var userNameEl = document.getElementById('navUserName'); var userAvatarEl = document.getElementById('navUserAvatar'); var loginLink = document.getElementById('navLoginLink'); if (!navRight) return; if (user) { // Show user name / avatar — clicking goes to dashboard if (userNameEl) { userNameEl.textContent = user.displayName ? user.displayName.split(' ')[0] : 'My Account'; userNameEl.style.display = 'block'; userNameEl.style.color = 'var(--orange)'; userNameEl.style.fontWeight = '700'; userNameEl.style.cursor = 'pointer'; userNameEl.style.textDecoration = 'none'; // Make it a link to the dashboard if (userNameEl.tagName !== 'A') { userNameEl.addEventListener('click', function () { window.location.href = 'dashboard.html'; }); } else { userNameEl.href = 'dashboard.html'; } } if (userAvatarEl && user.photoURL) { userAvatarEl.src = user.photoURL; userAvatarEl.style.display = 'block'; } if (loginLink) loginLink.style.display = 'none'; // Add logout to dropdown var logoutBtn = document.getElementById('navLogoutBtn'); if (logoutBtn) { logoutBtn.style.display = 'block'; logoutBtn.addEventListener('click', function () { lsciSignOut(); }); } } else { if (userNameEl) userNameEl.style.display = 'none'; if (userAvatarEl) userAvatarEl.style.display = 'none'; if (loginLink) loginLink.style.display = 'flex'; } }); } /* ── SMOOTH ANCHOR SCROLLING ───────────────────── */ document.querySelectorAll('a[href^="#"]').forEach(function (anchor) { anchor.addEventListener('click', function (e) { var id = this.getAttribute('href'); if (id === '#') return; var target = document.querySelector(id); if (target) { e.preventDefault(); var off = parseInt(getComputedStyle(html).getPropertyValue('--nav-h'), 10) || 66; window.scrollTo({ top: target.getBoundingClientRect().top + window.pageYOffset - off - 12, behavior: 'smooth' }); } }); }); /* ── SCROLL REVEAL ─────────────────────────────── */ var revealEls = document.querySelectorAll('.reveal'); if (revealEls.length) { var ro = new IntersectionObserver(function (entries) { entries.forEach(function (entry) { if (entry.isIntersecting) { entry.target.classList.add('visible'); ro.unobserve(entry.target); } }); }, { threshold: 0.08, rootMargin: '0px 0px -28px 0px' }); revealEls.forEach(function (el) { ro.observe(el); }); } /* ── RIPPLE ────────────────────────────────────── */ function addRipple(e) { var btn = e.currentTarget; var r = document.createElement('span'); var rect = btn.getBoundingClientRect(); r.style.cssText = 'position:absolute;border-radius:50%;background:rgba(255,255,255,0.28);' + 'width:120px;height:120px;margin:-60px 0 0 -60px;animation:lsci-ripple 0.65s linear;pointer-events:none;' + 'top:' + (e.clientY - rect.top) + 'px;left:' + (e.clientX - rect.left) + 'px;'; if (getComputedStyle(btn).position === 'static') btn.style.position = 'relative'; btn.style.overflow = 'hidden'; btn.appendChild(r); setTimeout(function () { r.remove(); }, 700); } if (!document.getElementById('lsciRippleStyle')) { var s = document.createElement('style'); s.id = 'lsciRippleStyle'; s.textContent = '@keyframes lsci-ripple{from{transform:scale(0);opacity:1}to{transform:scale(3.5);opacity:0}}'; document.head.appendChild(s); } document.querySelectorAll('.btn-primary,.btn-secondary,.watch-btn,.app-badge,.btn-outline,.page-cta-btn').forEach(function (btn) { btn.addEventListener('click', addRipple); }); /* ── ACTIVE NAV LINK HIGHLIGHT ─────────────────── */ var currentPage = window.location.pathname.split('/').pop() || 'index.html'; document.querySelectorAll('.nav-link, .mobile-nav-link').forEach(function (link) { var href = link.getAttribute('href') || ''; if (href && href !== '#' && currentPage.includes(href.replace('.html', ''))) { link.classList.add('active'); } }); })(); /* ── SHARED DATA ───────────────────────────────────── */ window.LSCI_CELL_GROUPS = [ { id: 'hcc1', name: 'Ikeja Powerhouse HCC', leader: 'Bro. Tunde Adeyemi', location: 'Ikeja, Lagos, Nigeria', country: 'Nigeria', day: 'saturday', type: 'mixed', time: '5:30 PM', size: '14 members', description: 'A vibrant mixed house cell centre focused on deep Bible study and practical discipleship.' }, { id: 'hcc2', name: 'Victoria Island Arise HCC', leader: 'Sis. Funke Okafor', location: 'VI, Lagos, Nigeria', country: 'Nigeria', day: 'saturday', type: 'mixed', time: '5:30 PM', size: '11 members', description: 'A dynamic women\'s house cell centre: prayer, growth, and sisterhood in the Holy Spirit.' }, { id: 'hcc3', name: 'Lekki Men of Valour HCC', leader: 'Bro. Emeka Eze', location: 'Lekki Phase 1, Lagos, Nigeria', country: 'Nigeria', day: 'saturday', type: 'mixed', time: '5:30 PM', size: '18 members', description: 'Men sharpening men — accountability, Bible depth, and kingdom purpose.' }, { id: 'hcc4', name: 'Surulere Covenant HCC', leader: 'Pst. Damilola & Temi Bello', location: 'Surulere, Lagos, Nigeria', country: 'Nigeria', day: 'saturday', type: 'mixed', time: '5:30 PM', size: '10 couples', description: 'Building God-honouring marriages and families — study, prayer, and community.' }, { id: 'hcc5', name: 'Yaba Youth Fire HCC', leader: 'Sis. Grace Nwosu', location: 'Yaba, Lagos, Nigeria', country: 'Nigeria', day: 'saturday', type: 'mixed', time: '5:30 PM', size: '22 members', description: 'A bold youth house cell centre on fire for God — worship, word, and mentorship.' }, { id: 'hcc6', name: 'Abuja Shalom HCC', leader: 'Sis. Ngozi Uche', location: 'Wuse 2, Abuja, Nigeria', country: 'Nigeria', day: 'saturday', type: 'mixed', time: '5:30 PM', size: '13 members', description: 'Shalom in the capital — intercession, word, and Kingdom community.' }, { id: 'hcc7', name: 'Port Harcourt Eagles HCC', leader: 'Bro. Victor Amadi', location: 'GRA Phase 2, Port Harcourt, Nigeria', country: 'Nigeria', day: 'saturday', type: 'mixed', time: '5:30 PM', size: '20 members', description: 'Eagles rising together — prayer, accountability, and outreach-focused.' }, { id: 'hcc8', name: 'Enugu Overcomers HCC', leader: 'Bro. Chukwuemeka Okonkwo', location: 'Independence Layout, Enugu, Nigeria', country: 'Nigeria', day: 'saturday', type: 'mixed', time: '5:30 PM', size: '15 members', description: 'Overcomers by faith — vibrant fellowship rooted in the Word of God.' }, { id: 'hcc9', name: 'London Zion HCC', leader: 'Pst. Kehinde Olawale', location: 'Peckham, London, UK', country: 'UK', day: 'saturday', type: 'mixed', time: '5:30 PM', size: '16 members', description: 'Bringing the fire of LSCI to the heart of London — community and the Word.' }, { id: 'hcc10', name: 'Manchester Rising HCC', leader: 'Sis. Adaeze Obi', location: 'Moss Side, Manchester, UK', country: 'UK', day: 'saturday', type: 'mixed', time: '5:30 PM', size: '12 members', description: 'Faith rising in the north of England — a warm, faith-filled house centre.' }, { id: 'hcc11', name: 'Houston Kingdom HCC', leader: 'Bro. Samuel Adebiyi', location: 'Sugar Land, Houston, TX, USA', country: 'USA', day: 'saturday', type: 'mixed', time: '5:30 PM', size: '17 members', description: 'Kingdom family in Texas — intercession, fellowship, and the Word made real.' }, { id: 'hcc12', name: 'Atlanta Glory HCC', leader: 'Sis. Toyin Bakare', location: 'Decatur, Atlanta, GA, USA', country: 'USA', day: 'saturday', type: 'mixed', time: '5:30 PM', size: '10 members', description: 'Women pursuing glory in Atlanta — prayer, purpose, and the Word of God.' }, { id: 'hcc13', name: 'Maryland Lighthouse HCC', leader: 'Pst. Jude & Chinwe Agu', location: 'Silver Spring, Maryland, USA', country: 'USA', day: 'saturday', type: 'mixed', time: '5:30 PM', size: '8 couples', description: 'Light shining in Maryland — couples growing together in faith and marriage.' }, { id: 'hcc14', name: 'Toronto Harvest HCC', leader: 'Bro. Olumide Savage', location: 'Scarborough, Toronto, Canada', country: 'Canada', day: 'saturday', type: 'mixed', time: '5:30 PM', size: '14 members', description: 'Harvest culture in Canada — a thriving multicultural house cell centre.' }, { id: 'hcc15', name: 'Johannesburg Faith HCC', leader: 'Sis. Blessing Dlamini', location: 'Soweto, Johannesburg, South Africa', country: 'South Africa', day: 'saturday', type: 'mixed', time: '5:30 PM', size: '19 members', description: 'Faith alive in Southern Africa — testimony, Bible, and kingdom community.' }, { id: 'hcc16', name: 'Dublin Covenant HCC', leader: 'Bro. Patrick Kelechi', location: 'Blanchardstown, Dublin, Ireland', country: 'Ireland', day: 'saturday', type: 'mixed', time: '5:30 PM', size: '11 members', description: 'Youth taking the covenant seriously in Dublin — Spirit-filled and Word-grounded.' }, { id: 'hcc17', name: 'Nairobi Rooftop HCC', leader: 'Pst. Andrew Mwangi', location: 'Westlands, Nairobi, Kenya', country: 'Kenya', day: 'saturday', type: 'mixed', time: '5:30 PM', size: '21 members', description: 'From the rooftop of Africa, declaring the Kingdom — prayer and praise.' }, { id: 'hcc18', name: 'Dubai Elevation HCC', leader: 'Sis. Adunola Sanni', location: 'Deira, Dubai, UAE', country: 'UAE', day: 'saturday', type: 'mixed', time: '5:30 PM', size: '15 members', description: 'Elevated faith in the Gulf — LSCI\'s presence in the Middle East.' }, { id: 'hcc19', name: 'Berlin Resurrection HCC', leader: 'Bro. Emmanuel Kofi', location: 'Neukolln, Berlin, Germany', country: 'Germany', day: 'saturday', type: 'mixed', time: '5:30 PM', size: '13 members', description: 'Resurrection power in Germany — a growing multicultural house cell centre.' }, { id: 'hcc20', name: 'Online Global HCC', leader: 'Sis. Chioma Ezuruike', location: 'Online — Worldwide', country: 'Online', day: 'saturday', type: 'mixed', time: '5:30 PM', size: '35+ members', description: 'No borders, no limits — join our fully online global house cell centre via Zoom.' } ]; /* ── GLOBAL SEARCH ENGINE ──────────────────────────── */ document.addEventListener('DOMContentLoaded', function () { var searchInputs = document.querySelectorAll('#navSearchInput'); var searchDropdowns = document.querySelectorAll('#navSearchDropdown'); // Unified Site Index var SEARCH_INDEX = [ // Top-Level Pages & Actions { title: 'House Cell Centres', type: 'Ministry', keywords: ['cell', 'group', 'community', 'fellowship', 'saturday', 'mixed', 'hcc', 'house'], url: 'cell-groups.html' }, { title: 'Watch Live Sermons (e-LSCI)', type: 'Media', keywords: ['live', 'sermon', 'video', 'broadcast', 'online'], url: 'e-lsci.html' }, { title: 'Find a Lifting Centre Near You', type: 'Location', keywords: ['lifting', 'centre', 'campus', 'branch', 'location'], url: 'lifting-centres.html' }, { title: 'Give Online', type: 'Action', keywords: ['give', 'tithe', 'offering', 'donate', 'seed'], url: 'give.html' }, { title: 'Volunteer & Serve', type: 'Action', keywords: ['serve', 'volunteer', 'join', 'work', 'usher', 'choir'], url: 'serve.html' }, { title: 'Upcoming Church Events', type: 'Event', keywords: ['calendar', 'events', 'schedule', 'retreat'], url: 'events.html' }, { title: 'Member Dashboard', type: 'Account', keywords: ['dashboard', 'account', 'login', 'profile', 'member'], url: 'dashboard.html' }, { title: 'About Pastor Femi Emmanuel', type: 'Info', keywords: ['pastor', 'femi', 'emmanuel', 'founder', 'leader', 'about'], url: 'about.html' }, // Sermons (from e-LSCI) { title: "Watch This Week's Full Sunday Message", type: 'Sermon', keywords: ['latest', 'message', 'sunday'], url: 'e-lsci.html' }, { title: "The Power of a Praying Church", type: 'Sermon', keywords: ['wednesday', 'prayer', 'church'], url: 'e-lsci.html' }, { title: "Walking in Your God-Given Purpose", type: 'Sermon', keywords: ['purpose', 'sunday', 'experience'], url: 'e-lsci.html' }, { title: "Encounter — A Night of Praise & Presence", type: 'Sermon', keywords: ['worship', 'praise', 'presence', 'night'], url: 'e-lsci.html' }, { title: "Prevailing in Prayer — How Faith Moves Mountains", type: 'Sermon', keywords: ['friday', 'prayer', 'faith', 'mountains'], url: 'e-lsci.html' }, { title: "The Abundant Life — John 10:10 Explained", type: 'Sermon', keywords: ['abundant', 'life', 'john'], url: 'e-lsci.html' }, { title: "Rise Up — A Word for This Generation", type: 'Sermon', keywords: ['youth', 'rally', 'generation', 'rise'], url: 'e-lsci.html' }, { title: "Unshakeable — Faith That Withstands Every Storm", type: 'Sermon', keywords: ['midweek', 'unshakeable', 'faith', 'storm'], url: 'e-lsci.html' }, // Events (from Events page) { title: "Good Friday Reflection & Communion Service", type: 'Event', keywords: ['good', 'friday', 'communion', 'special', 'service'], url: 'events.html' }, { title: "Easter Sunday Celebration — He Is Risen!", type: 'Event', keywords: ['easter', 'sunday', 'celebration', 'risen'], url: 'events.html' }, { title: "Sunday Experience — Open Heavens", type: 'Event', keywords: ['sunday', 'experience', 'open', 'heavens'], url: 'events.html' }, { title: "LSCI Youth Rally — Rise Up & Stand Firm", type: 'Event', keywords: ['youth', 'rally', 'rise', 'stand'], url: 'events.html' }, { title: "Hands & Hearts Outreach — Mushin Community", type: 'Event', keywords: ['outreach', 'mushin', 'community', 'hands'], url: 'events.html' }, { title: "Purpose Night — Discover Your Kingdom Assignment", type: 'Event', keywords: ['young', 'adults', 'purpose', 'kingdom'], url: 'events.html' }, { title: "Cell Group Leaders' Bootcamp — Quarter 2", type: 'Event', keywords: ['training', 'leadership', 'bootcamp', 'cell', 'group'], url: 'events.html' }, { title: "Freedom Flames — Prison Ministry Visit", type: 'Event', keywords: ['prison', 'outreach', 'freedom', 'flames'], url: 'events.html' }, { title: "Rivers of Living Water — LSCI Night of Worship", type: 'Event', keywords: ['worship', 'rivers', 'living', 'water', 'night'], url: 'events.html' }, // Serving Teams (from Serve page) { title: "Hospitality & Welcome", type: 'Serving Team', keywords: ['usher', 'greeter', 'hospitality', 'welcome', 'serve', 'car', 'park'], url: 'serve.html' }, { title: "Media, Tech & Broadcast", type: 'Serving Team', keywords: ['media', 'tech', 'broadcast', 'camera', 'console', 'stream'], url: 'serve.html' }, { title: "LSCI Kids & Children", type: 'Serving Team', keywords: ['kids', 'children', 'teach', 'play', 'school'], url: 'serve.html' }, { title: "Praise & Worship", type: 'Serving Team', keywords: ['praise', 'worship', 'choir', 'sing', 'band', 'instrumentalist'], url: 'serve.html' }, { title: "Outreach & Evangelism", type: 'Serving Team', keywords: ['outreach', 'evangelism', 'streets', 'missions'], url: 'serve.html' }, { title: "Prayer & Intercession", type: 'Serving Team', keywords: ['prayer', 'intercession', 'warriors'], url: 'serve.html' }, // Top Lifting Centres (from Lifting Centres page) { title: "LSCI HQ Ikeja", type: 'Lifting Centre', keywords: ['ikeja', 'headquarters', 'hq', 'lagos', 'nigeria'], url: 'lifting-centres.html' }, { title: "LSCI Lekki", type: 'Lifting Centre', keywords: ['lekki', 'phase 1', 'lagos', 'nigeria'], url: 'lifting-centres.html' }, { title: "LSCI Abuja Central", type: 'Lifting Centre', keywords: ['abuja', 'fct', 'central', 'nigeria'], url: 'lifting-centres.html' }, { title: "LSCI Peckham, London", type: 'Lifting Centre', keywords: ['peckham', 'london', 'uk', 'europe', 'united', 'kingdom'], url: 'lifting-centres.html' }, { title: "LSCI Houston", type: 'Lifting Centre', keywords: ['houston', 'texas', 'tx', 'usa', 'america'], url: 'lifting-centres.html' }, { title: "LSCI Toronto", type: 'Lifting Centre', keywords: ['toronto', 'canada', 'ontario', 'scarborough'], url: 'lifting-centres.html' }, { title: "e-LSCI Online (Global)", type: 'Lifting Centre', keywords: ['online', 'global', 'worldwide', 'internet', 'e-lsci'], url: 'lifting-centres.html' } ]; // Dynamically inject House Cell Centres into SEARCH_INDEX if (window.LSCI_CELL_GROUPS) { var addedHccs = window.LSCI_CELL_GROUPS.map(function(g) { // Split location into searchable keywords var kw = ['cell', 'group', 'hcc']; kw = kw.concat(g.name.toLowerCase().split(' ')); kw = kw.concat(g.location.toLowerCase().replace(/,/g, '').split(' ')); if (g.country) kw = kw.concat(g.country.toLowerCase().split(' ')); if (g.leader) kw = kw.concat(g.leader.toLowerCase().replace(/\./g, '').split(' ')); return { title: g.name, type: 'House Cell Centre', keywords: kw, url: 'cell-groups.html?search=' + encodeURIComponent(g.name) }; }); SEARCH_INDEX = SEARCH_INDEX.concat(addedHccs); } searchInputs.forEach(function(input, index) { var dropdown = searchDropdowns[index]; if(!dropdown) return; input.addEventListener('input', function(e) { var query = e.target.value.toLowerCase().trim(); if(query.length < 2) { dropdown.classList.remove('active'); return; } var hits=SEARCH_INDEX.filter(function(item) { if(item.title.toLowerCase().indexOf(query)> -1) return true; if(item.type.toLowerCase().indexOf(query) > -1) return true; for(var i=0; i -1) return true; } return false; }); var html = ''; if(hits.length === 0) { html = '
No matching resources found.
'; } else { hits.forEach(function(item) { html += ''; html += ' ' + item.title + ''; html += ' ' + item.type + ''; html += ''; }); } dropdown.innerHTML = html; dropdown.classList.add('active'); }); document.addEventListener('click', function(e) { if(!input.contains(e.target) && !dropdown.contains(e.target)) { dropdown.classList.remove('active'); } }); input.addEventListener('focus', function() { if(input.value.trim().length >= 2) { dropdown.classList.add('active'); } }); }); });