// KoalaSync Landing Page Logic document.addEventListener('DOMContentLoaded', () => { // Scroll Reveal Logic const revealElements = document.querySelectorAll('[data-reveal]'); const revealOnScroll = () => { const windowHeight = window.innerHeight; revealElements.forEach(el => { const elementTop = el.getBoundingClientRect().top; const revealPoint = 150; if (elementTop < windowHeight - revealPoint) { el.classList.add('revealed'); } }); }; // Initial check revealOnScroll(); // Scroll listener window.addEventListener('scroll', revealOnScroll); // Navbar scroll effect const nav = document.querySelector('nav'); window.addEventListener('scroll', () => { if (window.scrollY > 50) { nav.style.padding = '0.75rem 0'; nav.style.background = 'rgba(15, 23, 42, 0.9)'; } else { nav.style.padding = '1rem 0'; nav.style.background = 'rgba(30, 41, 59, 0.7)'; } }); // Smooth scroll for anchors document.querySelectorAll('a[href^="#"]').forEach(anchor => { anchor.addEventListener('click', function (e) { e.preventDefault(); const target = document.querySelector(this.getAttribute('href')); if (target) { target.scrollIntoView({ behavior: 'smooth', block: 'start' }); } }); }); // Invite Detection & Bridge const checkInvite = () => { const isJoinPage = window.location.pathname.includes('join.html'); // Use a short timeout to let the bridge script initialize its dataset attribute setTimeout(() => { const isInstalled = document.documentElement.dataset.koalasyncInstalled === 'true'; if (window.location.hash.startsWith('#join:')) { const parts = window.location.hash.split(':'); if (parts.length >= 3) { const roomId = parts[1]; const password = parts[2]; if (isJoinPage) { const displayRoom = document.getElementById('display-room-id'); const actions = document.getElementById('join-actions'); if (displayRoom) displayRoom.textContent = roomId; if (actions) { if (!isInstalled) { actions.innerHTML = ` GET IT ON CHROME WEBSTORE Download via GitHub
The extension is required to join and sync videos.
`; } else { actions.innerHTML = `✅ Extension detected and ready.
`; } } } else { // Fallback banner for index.html if (!document.getElementById('koala-banner')) { const banner = document.createElement('div'); banner.className = 'invite-banner'; banner.id = 'koala-banner'; banner.innerHTML = `