const AppConfig = { brand: { name: "港曲粤语AI", slogan: "聽歌學粵語,AI 助你掌握港樂精髓" }, navigation: [ { label: "主頁", href: "home.html", id: "home" }, { label: "學習功能", href: "features.html", id: "features" }, { label: "關於我們", href: "about_us.html", id: "about" }, { label: "聯繫我們", href: "contact_us.html", id: "contact" } ], socialLinks: [ { icon: "share", label: "Share", href: "#" }, { icon: "mail", label: "Email", href: "#" } ], footerLinks: { explore: [ { label: "Features", href: "features.html" }, { label: "Community Guide", href: "#" }, { label: "AI Ethics", href: "#" } ], legal: [ { label: "Privacy Policy", href: "#" }, { label: "Terms of Service", href: "#" } ] }, downloadModal: { title: "下載 港曲粤语AI App", description: "立即體驗 AI 粵語私教,掌握地道港樂發音", platforms: [ { name: "iOS App Store", icon: "phone_iphone", url: "#" }, { name: "Android Google Play", icon: "android", url: "#" }, { name: "Windows Desktop", icon: "desktop_windows", url: "#" }, { name: "macOS Desktop", icon: "desktop_mac", url: "#" } ] } }; const TailwindConfig = { darkMode: "class", theme: { extend: { colors: { "secondary-fixed-dim": "#b0c6ff", "inverse-primary": "#6833ea", "inverse-on-surface": "#303035", "surface-dim": "#131318", "inverse-surface": "#e4e1e9", "surface-container": "#1f1f24", "surface-container-high": "#2a292f", "secondary": "#b0c6ff", "surface-container-low": "#1b1b20", "outline-variant": "#494456", "error-container": "#93000a", "surface-container-highest": "#35343a", "tertiary-fixed": "#ffdf9e", "secondary-fixed": "#d9e2ff", "on-primary-fixed-variant": "#4f00d0", "on-primary": "#370096", "primary-fixed": "#e8deff", "on-surface": "#e4e1e9", "on-primary-container": "#cebfff", "surface-variant": "#35343a", "on-primary-fixed": "#20005f", "surface-bright": "#39383e", "secondary-container": "#0068ed", "on-error": "#690005", "outline": "#948da2", "primary-fixed-dim": "#cdbdff", "on-tertiary-container": "#fcbe00", "on-error-container": "#ffdad6", "on-surface-variant": "#cbc3d9", "on-secondary-fixed": "#001945", "background": "#131318", "surface-container-lowest": "#0e0e13", "error": "#ffb4ab", "on-secondary-container": "#f2f3ff", "on-secondary": "#002d6e", "primary": "#cdbdff", "tertiary": "#fabd00", "surface": "#131318", "on-tertiary-fixed-variant": "#5b4300", "on-secondary-fixed-variant": "#00429b", "tertiary-fixed-dim": "#fabd00", "on-tertiary": "#3f2e00", "primary-container": "#5d21df", "surface-tint": "#cdbdff", "on-tertiary-fixed": "#261a00", "on-background": "#e4e1e9", "tertiary-container": "#6b4f00" }, borderRadius: { "DEFAULT": "0.25rem", "lg": "0.5rem", "xl": "0.75rem", "full": "9999px" }, fontFamily: { "headline": ["Epilogue", "sans-serif"], "body": ["Manrope", "sans-serif"], "label": ["Space Grotesk", "sans-serif"] } } } }; const UIComponents = { renderNavbar(activePageId) { const navItems = AppConfig.navigation.map(item => { const isActive = item.id === activePageId; const activeClass = isActive ? 'text-amber-400 font-bold border-b-2 border-amber-400 pb-1' : 'text-neutral-300 font-medium hover:text-violet-200 transition-colors'; return `${item.label}`; }).join(''); return ` `; }, renderFooter() { const exploreLinks = AppConfig.footerLinks.explore.map(link => `
  • ${link.label}
  • ` ).join(''); const legalLinks = AppConfig.footerLinks.legal.map(link => `
  • ${link.label}
  • ` ).join(''); const socialIcons = AppConfig.socialLinks.map(link => ` ${link.icon} ` ).join(''); return ` `; }, renderHead(title) { return ` ${title} - ${AppConfig.brand.name} `; }, renderSectionTitle(label, title, description) { return `
    ${label}

    ${title}

    ${description}

    `; }, renderFeatureCard(icon, title, description, options = {}) { const { variant = 'default', size = 'normal' } = options; const bgClass = variant === 'high' ? 'bg-surface-container-high' : variant === 'highest' ? 'bg-surface-container-highest' : 'bg-surface-container-low'; return `
    ${icon}

    ${title}

    ${description}

    `; }, renderButton(text, options = {}) { const { variant = 'primary', size = 'normal', icon = null } = options; if (variant === 'primary') { return ` `; } else { return ` `; } }, renderDownloadModal() { const platforms = AppConfig.downloadModal.platforms.map(platform => ` ${platform.icon}
    ${platform.name}
    點擊下載
    ` ).join(''); return ` `; } }; const PageUtils = { init() { if (typeof tailwind !== 'undefined') { tailwind.config = TailwindConfig; } }, renderPage(activePageId, navbarContainerId = 'navbar-container', footerContainerId = 'footer-container') { this.init(); const navbarEl = document.getElementById(navbarContainerId); const footerEl = document.getElementById(footerContainerId); if (navbarEl) { navbarEl.innerHTML = UIComponents.renderNavbar(activePageId); } if (footerEl) { footerEl.innerHTML = UIComponents.renderFooter(); } this.renderDownloadModal(); this.setupEventListeners(); }, renderDownloadModal() { let modalContainer = document.getElementById('download-modal-container'); if (!modalContainer) { modalContainer = document.createElement('div'); modalContainer.id = 'download-modal-container'; document.body.appendChild(modalContainer); } modalContainer.innerHTML = UIComponents.renderDownloadModal(); }, setupEventListeners() { const launchButtons = document.querySelectorAll('.launch-app-btn'); launchButtons.forEach(button => { button.addEventListener('click', () => { this.showDownloadModal(); }); }); const modal = document.getElementById('download-modal'); if (modal) { const closeButtons = modal.querySelectorAll('[data-modal-close]'); closeButtons.forEach(button => { button.addEventListener('click', () => { this.hideDownloadModal(); }); }); modal.addEventListener('click', (e) => { if (e.target === modal || e.target.hasAttribute('data-modal-close')) { this.hideDownloadModal(); } }); document.addEventListener('keydown', (e) => { if (e.key === 'Escape' && !modal.classList.contains('hidden')) { this.hideDownloadModal(); } }); } }, showDownloadModal() { const modal = document.getElementById('download-modal'); if (modal) { modal.classList.remove('hidden'); document.body.style.overflow = 'hidden'; } }, hideDownloadModal() { const modal = document.getElementById('download-modal'); if (modal) { modal.classList.add('hidden'); document.body.style.overflow = ''; } } }; document.addEventListener('DOMContentLoaded', () => { PageUtils.init(); }); window.AppConfig = AppConfig; window.TailwindConfig = TailwindConfig; window.UIComponents = UIComponents; window.PageUtils = PageUtils;