(function() { 'use strict'; const mobileMenuCSS = ` @media (max-width: 1220px) { .side-panel { display: none !important; } } .FS-mobile-menu { display: none; position: fixed; top: 0; left: -100%; width: 90%; max-width: 380px; height: 100vh; background: linear-gradient(180deg, #0a0a0a 0%, #1a1a1a 50%, #0f0f0f 100%); z-index: 999999; transition: left 0.4s cubic-bezier(0.4, 0, 0.2, 1); overflow-y: auto; overflow-x: hidden; border-right: 3px solid transparent; border-image: linear-gradient(180deg, #41dc9c, #ff8533, #41dc9c) 1; box-shadow: 5px 0 30px rgba(244, 134, 37, 0.3), 0 0 50px rgba(0, 0, 0, 0.8); } @media (max-width: 1220px) { .FS-mobile-menu { display: block; } } .FS-mobile-menu.open { left: 0; animation: slideInMenu 0.4s ease; } @keyframes slideInMenu { 0% { left: -100%; opacity: 0; } 100% { left: 0; opacity: 1; } } .FS-menu-overlay { display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0, 0, 0, 0.85); z-index: 999998; backdrop-filter: blur(8px); transition: opacity 0.3s ease; } .FS-menu-overlay.show { display: block; animation: fadeIn 0.3s ease; } @keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } } .FS-menu-header { padding: 25px 20px; background: linear-gradient(145deg, #1a1a1a, #2d2d2d); border-bottom: 2px solid rgba(244, 134, 37, 0.4); position: sticky; top: 0; z-index: 10; box-shadow: 0 4px 15px rgba(0, 0, 0, 0.5); } .FS-menu-logo { display: flex; align-items: center; justify-content: center; gap: 15px; margin-bottom: 20px; animation: logoFloat 3s ease-in-out infinite; } @keyframes logoFloat { 0%, 100% { transform: translateY(0px); } 50% { transform: translateY(-5px); } } .FS-menu-logo .container2 { pointer-events: none !important; transform: scale(0.85); filter: drop-shadow(0 0 10px rgba(244, 134, 37, 0.5)); } .FS-menu-logo .container2 .text { color: white !important; text-shadow: 0 0 20px rgba(255, 255, 255, 0.5); } .FS-menu-logo .container2 .logo { color: #41dc9c !important; animation: pulse 2s ease-in-out infinite; } @keyframes pulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.1); } } .FS-close-btn { position: absolute; top: 20px; right: 20px; width: 40px; height: 40px; background: linear-gradient(145deg, rgba(244, 134, 37, 0.2), rgba(255, 133, 51, 0.3)); border: 2px solid rgba(244, 134, 37, 0.5); border-radius: 50%; color: #41dc9c; font-size: 20px; cursor: pointer; transition: all 0.3s ease; display: flex; align-items: center; justify-content: center; box-shadow: 0 4px 15px rgba(244, 134, 37, 0.3); } .FS-close-btn:hover { background: linear-gradient(145deg, #41dc9c, #ff8533); color: white; transform: rotate(90deg) scale(1.1); box-shadow: 0 6px 20px rgba(244, 134, 37, 0.6); } .FS-close-btn:active { transform: rotate(90deg) scale(0.95); } .FS-mobile-search { margin-bottom: 20px; position: relative; } .FS-search-form { position: relative; } .FS-search-input-container { position: relative; overflow: hidden; border-radius: 12px; } .FS-search-input-container::before { content: ''; position: absolute; top: -50%; left: -50%; width: 200%; height: 200%; background: linear-gradient(45deg, transparent, rgba(244, 134, 37, 0.1), transparent); animation: searchShine 3s linear infinite; } @keyframes searchShine { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } } .FS-search-input { width: 100%; padding: 15px 50px 15px 20px; background: rgba(255, 255, 255, 0.08); border: 2px solid rgba(244, 134, 37, 0.3); border-radius: 12px; color: white; font-size: 15px; transition: all 0.3s ease; position: relative; z-index: 1; box-sizing: border-box; } .FS-search-input:focus { outline: none; border-color: #41dc9c; box-shadow: 0 0 20px rgba(244, 134, 37, 0.4), inset 0 0 10px rgba(244, 134, 37, 0.1); background: rgba(255, 255, 255, 0.12); transform: scale(1.02); } .FS-search-input::placeholder { color: rgba(255, 255, 255, 0.5); } .FS-search-btn { position: absolute; right: 8px; top: 50%; transform: translateY(-50%); width: 40px; height: 40px; background: linear-gradient(145deg, #41dc9c, #ff8533); border: none; border-radius: 10px; color: white; cursor: pointer; transition: all 0.3s ease; z-index: 2; display: flex; align-items: center; justify-content: center; box-shadow: 0 4px 15px rgba(244, 134, 37, 0.4); } .FS-search-btn:hover { transform: translateY(-50%) scale(1.1) rotate(10deg); box-shadow: 0 6px 20px rgba(244, 134, 37, 0.6); } .FS-search-btn:active { transform: translateY(-50%) scale(0.95); } .FS-user-actions { display: flex; gap: 10px; margin-bottom: 20px; } .FS-user-btn { flex: 1; padding: 14px 12px; background: linear-gradient(145deg, #2c2c2c, #242424); border: 2px solid rgba(244, 134, 37, 0.3); border-radius: 10px; color: white; font-size: 13px; font-weight: 600; cursor: pointer; transition: all 0.3s ease; text-align: center; position: relative; overflow: hidden; } .FS-user-btn::before { content: ''; position: absolute; top: 50%; left: 50%; width: 0; height: 0; border-radius: 50%; background: rgba(244, 134, 37, 0.3); transform: translate(-50%, -50%); transition: width 0.5s, height 0.5s; } .FS-user-btn:hover::before { width: 300px; height: 300px; } .FS-user-btn:hover { background: linear-gradient(145deg, #41dc9c, #ff8533); border-color: #ff8533; transform: translateY(-3px); box-shadow: 0 6px 20px rgba(244, 134, 37, 0.5); } .FS-user-btn i { margin-right: 8px; position: relative; z-index: 1; } .FS-user-btn span { position: relative; z-index: 1; } .FS-modal-container { display: none; background: linear-gradient(145deg, rgba(0, 0, 0, 0.4), rgba(26, 26, 26, 0.6)); border-radius: 12px; margin: 20px 0; padding: 25px; border: 2px solid rgba(244, 134, 37, 0.3); backdrop-filter: blur(10px); box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5); } .FS-modal-container.show { display: block; animation: modalSlideDown 0.4s ease; } @keyframes modalSlideDown { from { opacity: 0; transform: translateY(-30px); } to { opacity: 1; transform: translateY(0); } } .FS-modal-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; padding-bottom: 15px; border-bottom: 2px solid rgba(244, 134, 37, 0.4); } .FS-modal-title { color: #41dc9c; font-size: 18px; font-weight: bold; text-shadow: 0 0 10px rgba(244, 134, 37, 0.5); } .FS-modal-close { background: rgba(244, 134, 37, 0.2); border: 2px solid rgba(244, 134, 37, 0.5); color: #41dc9c; font-size: 20px; cursor: pointer; width: 32px; height: 32px; border-radius: 50%; transition: all 0.3s ease; display: flex; align-items: center; justify-content: center; } .FS-modal-close:hover { background: #41dc9c; color: white; transform: rotate(90deg) scale(1.1); } .FS-login-form { display: flex; flex-direction: column; gap: 15px; } .FS-input-group { position: relative; } .FS-input-group input { width: 100%; padding: 14px 16px; background: rgba(255, 255, 255, 0.08); border: 2px solid rgba(244, 134, 37, 0.3); border-radius: 10px; color: white; font-size: 15px; transition: all 0.3s ease; box-sizing: border-box; } .FS-input-group input:focus { outline: none; border-color: #41dc9c; box-shadow: 0 0 15px rgba(244, 134, 37, 0.4); background: rgba(255, 255, 255, 0.12); transform: scale(1.02); } .FS-input-group input::placeholder { color: rgba(255, 255, 255, 0.5); } .FS-checkbox-group { display: flex; align-items: center; gap: 10px; padding: 10px 0; } .FS-checkbox-group input[type="checkbox"] { width: 20px; height: 20px; cursor: pointer; accent-color: #41dc9c; } .FS-checkbox-group label { color: #ccc; font-size: 14px; cursor: pointer; } .FS-submit-btn { padding: 15px; background: linear-gradient(145deg, #41dc9c, #ff8533); border: none; border-radius: 10px; color: white; font-weight: bold; font-size: 16px; cursor: pointer; transition: all 0.3s ease; box-shadow: 0 4px 15px rgba(244, 134, 37, 0.4); position: relative; overflow: hidden; } .FS-submit-btn::before { content: ''; position: absolute; top: 50%; left: 50%; width: 0; height: 0; border-radius: 50%; background: rgba(255, 255, 255, 0.3); transform: translate(-50%, -50%); transition: width 0.6s, height 0.6s; } .FS-submit-btn:hover::before { width: 300px; height: 300px; } .FS-submit-btn:hover { transform: translateY(-2px); box-shadow: 0 6px 25px rgba(244, 134, 37, 0.6); } .FS-submit-btn:active { transform: translateY(0); } .FS-form-links { display: flex; justify-content: space-between; margin-top: 15px; gap: 10px; } .FS-form-links a { color: #41dc9c; font-size: 13px; text-decoration: none; transition: all 0.3s ease; position: relative; } .FS-form-links a::after { content: ''; position: absolute; bottom: -2px; left: 0; width: 0; height: 2px; background: #41dc9c; transition: width 0.3s ease; } .FS-form-links a:hover::after { width: 100%; } .FS-form-links a:hover { color: #ff8533; } .FS-main-nav { padding: 0; } .FS-nav-item { display: flex; align-items: center; padding: 18px 22px; color: #ccc; text-decoration: none; transition: all 0.3s ease; border-left: 4px solid transparent; position: relative; overflow: hidden; } .FS-nav-item::before { content: ''; position: absolute; top: 0; left: -100%; width: 100%; height: 100%; background: linear-gradient(90deg, transparent, rgba(244, 134, 37, 0.15), transparent); transition: left 0.5s ease; } .FS-nav-item:hover::before { left: 100%; } .FS-nav-item:hover { background: rgba(244, 134, 37, 0.12); color: white; border-left-color: #41dc9c; padding-left: 28px; box-shadow: inset 0 0 20px rgba(244, 134, 37, 0.1); } .FS-nav-item.active { background: rgba(244, 134, 37, 0.15); color: white; border-left-color: #41dc9c; box-shadow: inset 0 0 20px rgba(244, 134, 37, 0.2); } .FS-nav-icon { width: 28px; height: 28px; margin-right: 18px; font-size: 20px; color: #41dc9c; transition: all 0.3s ease; display: flex; align-items: center; justify-content: center; } .FS-nav-item:hover .FS-nav-icon { transform: scale(1.2) rotate(5deg); filter: drop-shadow(0 0 8px rgba(244, 134, 37, 0.8)); } .FS-nav-text { font-size: 15px; font-weight: 500; } .FS-menu-section { margin: 25px 0; } .FS-section-title { padding: 14px 22px; font-size: 12px; font-weight: bold; color: #41dc9c; text-transform: uppercase; letter-spacing: 2px; background: linear-gradient(145deg, rgba(244, 134, 37, 0.1), rgba(255, 133, 51, 0.05)); border-top: 2px solid rgba(244, 134, 37, 0.3); border-bottom: 2px solid rgba(244, 134, 37, 0.3); text-shadow: 0 0 10px rgba(244, 134, 37, 0.5); } .FS-expandable { position: relative; } .FS-expand-btn { background: none; border: none; color: inherit; width: 100%; text-align: left; cursor: pointer; display: flex; align-items: center; justify-content: space-between; padding-right: 22px; } .FS-expand-icon { font-size: 16px; transition: transform 0.4s ease; color: #41dc9c; filter: drop-shadow(0 0 5px rgba(244, 134, 37, 0.5)); } .FS-expandable.expanded .FS-expand-icon { transform: rotate(90deg); } .FS-submenu { max-height: 0; overflow: hidden; transition: max-height 0.4s ease; background: rgba(0, 0, 0, 0.4); } .FS-expandable.expanded .FS-submenu { max-height: 2000px; } .FS-submenu-item { display: flex; align-items: center; padding: 14px 22px 14px 65px; color: #bbb; text-decoration: none; transition: all 0.3s ease; font-size: 14px; position: relative; } .FS-submenu-item::before { content: '?'; position: absolute; left: 48px; color: #41dc9c; font-size: 14px; transition: all 0.3s ease; } .FS-submenu-item:hover::before { left: 52px; color: #ff8533; } .FS-submenu-item:hover { background: rgba(244, 134, 37, 0.12); color: white; padding-left: 70px; box-shadow: inset 0 0 15px rgba(244, 134, 37, 0.1); } .FS-badge { background: linear-gradient(145deg, #41dc9c, #ff8533); color: white; font-size: 10px; padding: 4px 10px; border-radius: 15px; margin-left: auto; font-weight: bold; animation: badgePulse 2s infinite; box-shadow: 0 2px 10px rgba(244, 134, 37, 0.5); } @keyframes badgePulse { 0%, 100% { transform: scale(1); box-shadow: 0 2px 10px rgba(244, 134, 37, 0.5); } 50% { transform: scale(1.05); box-shadow: 0 4px 20px rgba(244, 134, 37, 0.8); } } .FS-main-nav .menu-section { background: linear-gradient(145deg, rgba(255, 255, 255, 0.05), rgba(26, 26, 26, 0.3)); border-radius: 15px; margin: 18px 20px; padding: 18px; border: 2px solid rgba(244, 134, 37, 0.25); backdrop-filter: blur(10px); box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3); } .FS-main-nav .menu-section-title { color: #41dc9c !important; font-size: 15px !important; font-weight: bold !important; margin-bottom: 15px !important; padding-bottom: 10px !important; border-bottom: 2px solid rgba(244, 134, 37, 0.4) !important; text-transform: uppercase; letter-spacing: 1.5px; text-shadow: 0 0 10px rgba(244, 134, 37, 0.5); } .FS-main-nav .menu-section a { display: flex !important; align-items: center !important; padding: 12px 10px !important; color: #ccc !important; text-decoration: none !important; border-radius: 8px !important; transition: all 0.3s ease !important; margin-bottom: 8px !important; font-size: 14px !important; border-left: 3px solid transparent !important; position: relative !important; } .FS-main-nav .menu-section a::before { content: ''; position: absolute; top: 0; left: 0; width: 0; height: 100%; background: linear-gradient(90deg, rgba(244, 134, 37, 0.2), transparent); transition: width 0.3s ease; border-radius: 8px 0 0 8px; } .FS-main-nav .menu-section a:hover::before { width: 100%; } .FS-main-nav .menu-section a:hover { background: rgba(244, 134, 37, 0.15) !important; color: white !important; border-left-color: #41dc9c !important; padding-left: 18px !important; transform: translateX(5px); box-shadow: 0 4px 15px rgba(244, 134, 37, 0.2); } .FS-main-nav .menu-section a i { margin-right: 12px !important; color: #41dc9c !important; width: 20px !important; text-align: center !important; font-size: 16px !important; transition: all 0.3s ease !important; } .FS-main-nav .menu-section a:hover i { transform: scale(1.2) rotate(5deg); filter: drop-shadow(0 0 8px rgba(244, 134, 37, 0.8)); } .FS-mobile-menu::-webkit-scrollbar { width: 6px; } .FS-mobile-menu::-webkit-scrollbar-track { background: rgba(0, 0, 0, 0.3); } .FS-mobile-menu::-webkit-scrollbar-thumb { background: linear-gradient(180deg, #41dc9c, #ff8533); border-radius: 6px; box-shadow: 0 0 10px rgba(244, 134, 37, 0.5); } .FS-mobile-menu::-webkit-scrollbar-thumb:hover { background: linear-gradient(180deg, #ff8533, #41dc9c); } @media (max-width: 768px) { .FS-mobile-menu { width: 85%; max-width: 350px; } .FS-nav-item { padding: 16px 18px; } .FS-submenu-item { padding: 12px 18px 12px 55px; } .FS-menu-header { padding: 20px 15px; } .FS-main-nav .menu-section { margin: 15px 15px; padding: 15px; } } @media (max-width: 480px) { .FS-mobile-menu { width: 90%; } .FS-nav-text { font-size: 14px; } .FS-search-input { font-size: 14px; padding: 13px 45px 13px 15px; } .FS-user-btn { font-size: 12px; padding: 12px 10px; } } `; const style = document.createElement('style'); style.textContent = mobileMenuCSS; document.head.appendChild(style); function checkUserStatus() { const loginButton = document.querySelector('#loginButtonContainer'); const panelButton = document.querySelector('#panelButtonContainer'); const userGroups = document.querySelector('[group="5"]') || document.querySelector('.group-5'); return !!(panelButton || userGroups || document.querySelector('.user-logged-in')); } function scanAndCopyMenu() { const extractedItems = []; extractedItems.push({ type: 'nav', icon: 'fas fa-home', text: 'Accueil', url: '/', html: ` Accueil ` }); extractedItems.push({ type: 'section', title: 'Contenu', html: '
Catégorie
' }); const navMenuItems = document.querySelectorAll('.nav-menu > li.submenu'); navMenuItems.forEach(navItem => { const mainLink = navItem.querySelector('a'); if (!mainLink) return; const linkText = mainLink.textContent.replace(/[|]/g, '').trim(); const linkHref = mainLink.getAttribute('href'); const hiddenMenu = navItem.querySelector('.hidden-menu'); let icon = 'fas fa-list'; let badge = ''; if (linkText.toLowerCase().includes('film')) { icon = 'fas fa-film'; } else if (linkText.toLowerCase().includes('série')) { icon = 'fas fa-tv'; badge = 'TOP'; } else if (linkText.toLowerCase().includes('anime')) { icon = 'fas fa-magic'; } else if (linkText.includes('TV') && linkText.includes('LIVE')) { icon = 'fas fa-broadcast-tower'; badge = 'LIVE'; } else if (linkText.toLowerCase().includes('contact')) { icon = 'fas fa-envelope'; } else if (linkText.toLowerCase().includes('favoris')) { icon = 'fas fa-heart'; } if (linkHref && linkHref.startsWith('http') && !hiddenMenu) { extractedItems.push({ type: 'nav', text: linkText, url: linkHref, html: ` ${linkText} ${badge} ` }); return; } if (hiddenMenu) { const menuContainer = hiddenMenu.querySelector('.menu-container'); if (menuContainer) { const clonedContent = menuContainer.cloneNode(true); extractedItems.push({ type: 'expandable', text: linkText, icon: icon, badge: badge, html: `
${clonedContent.innerHTML}
` }); } } }); extractedItems.push({ type: 'section', title: 'Personnel', html: '
Personnel
' }); const favLink = document.querySelector('a[href*="favorites"]'); if (favLink) { extractedItems.push({ type: 'nav', text: 'Favoris', url: favLink.getAttribute('href'), html: ` Favoris ` }); } const contactLink = document.querySelector('a[href*="feedback"]'); if (contactLink) { extractedItems.push({ type: 'nav', text: 'Contact', url: contactLink.getAttribute('href'), html: ` F.A.Q ` }); } return extractedItems; } function createSearchBar() { return ` `; } function createUserButtons() { const isLoggedIn = checkUserStatus(); if (isLoggedIn) { return `
`; } else { return `
`; } } function createLoginModal() { return `
Connexion
`; } function createPanelModal() { return `
Mon Panel
`; } function createMobileMenu() { const existingLogo = document.querySelector('.container2'); let logoHTML = ''; if (existingLogo) { logoHTML = existingLogo.outerHTML; } else { logoHTML = ` logo
`; } const menuItems = scanAndCopyMenu(); const searchBar = createSearchBar(); const userButtons = createUserButtons(); const loginModal = createLoginModal(); const panelModal = createPanelModal(); let menuHTML = `
${searchBar} ${userButtons} ${loginModal} ${panelModal}
`; document.body.insertAdjacentHTML('beforeend', menuHTML); } function setupEventListeners() { const overlay = document.getElementById('FS-menu-overlay'); const menu = document.getElementById('FS-mobile-menu'); const closeBtn = document.getElementById('FS-close-btn'); const loginBtn = document.getElementById('FS-login-btn'); const panelBtn = document.getElementById('FS-panel-btn'); const loginModal = document.getElementById('FS-login-modal'); const panelModal = document.getElementById('FS-panel-modal'); const loginClose = document.getElementById('FS-login-close'); const panelClose = document.getElementById('FS-panel-close'); const loginForm = document.getElementById('FS-login-form'); const existingMenuBtn = document.querySelector('.btn-menu'); function setupMobileSearchIntegration() { const mobileSearchInput = document.getElementById('FS-mobile-search-input'); const mobileSearchBtn = document.getElementById('FS-mobile-search-btn'); const desktopSearchInput = document.getElementById('story'); if (mobileSearchInput && mobileSearchBtn && desktopSearchInput) { mobileSearchInput.addEventListener('input', function() { desktopSearchInput.value = this.value; const event = new Event('input', { bubbles: true }); desktopSearchInput.dispatchEvent(event); }); mobileSearchInput.addEventListener('focus', function() { closeMenu(); setTimeout(() => { desktopSearchInput.value = this.value; desktopSearchInput.focus(); const event = new Event('focus', { bubbles: true }); desktopSearchInput.dispatchEvent(event); }, 400); }); function performSearch() { const query = mobileSearchInput.value.trim(); if (query.length > 0) { desktopSearchInput.value = query; closeMenu(); setTimeout(() => { desktopSearchInput.focus(); const desktopForm = document.getElementById('quicksearch'); if (desktopForm) { const event = new Event('submit', { bubbles: true, cancelable: true }); desktopForm.dispatchEvent(event); } }, 400); } else { closeMenu(); setTimeout(() => { desktopSearchInput.focus(); const event = new Event('focus', { bubbles: true }); desktopSearchInput.dispatchEvent(event); }, 400); } } mobileSearchBtn.addEventListener('click', performSearch); mobileSearchInput.addEventListener('keypress', function(e) { if (e.key === 'Enter') { e.preventDefault(); performSearch(); } }); } } function openMenu() { overlay.classList.add('show'); menu.classList.add('open'); document.body.style.overflow = 'hidden'; } function closeMenu() { overlay.classList.remove('show'); menu.classList.remove('open'); document.body.style.overflow = ''; if (loginModal) loginModal.classList.remove('show'); if (panelModal) panelModal.classList.remove('show'); } function openLoginModal() { if (loginModal) { loginModal.classList.add('show'); if (panelModal) panelModal.classList.remove('show'); } } function closeLoginModal() { if (loginModal) { loginModal.classList.remove('show'); } } function openPanelModal() { if (panelModal) { const originalLoginBox = document.getElementById('login-box'); const panelContent = document.getElementById('FS-panel-content'); if (originalLoginBox && panelContent) { panelContent.innerHTML = ''; const loginBoxClone = originalLoginBox.cloneNode(true); loginBoxClone.style.display = 'block'; panelContent.appendChild(loginBoxClone); } panelModal.classList.add('show'); if (loginModal) loginModal.classList.remove('show'); } } function closePanelModal() { if (panelModal) { panelModal.classList.remove('show'); } } function handleLoginSubmit(e) { e.preventDefault(); const formData = new FormData(loginForm); const originalLoginForm = document.querySelector('form[method="post"]'); if (originalLoginForm) { const originalLoginName = originalLoginForm.querySelector('input[name="login_name"]'); const originalLoginPassword = originalLoginForm.querySelector('input[name="login_password"]'); const originalLoginNotSave = originalLoginForm.querySelector('input[name="login_not_save"]'); if (originalLoginName) originalLoginName.value = formData.get('login_name'); if (originalLoginPassword) originalLoginPassword.value = formData.get('login_password'); if (originalLoginNotSave) originalLoginNotSave.checked = formData.get('login_not_save') === '1'; originalLoginForm.submit(); } else { loginForm.submit(); } } if (existingMenuBtn) { existingMenuBtn.addEventListener('click', function(e) { if (window.innerWidth <= 1220) { e.preventDefault(); e.stopPropagation(); openMenu(); } }); } if (closeBtn) closeBtn.addEventListener('click', closeMenu); if (overlay) overlay.addEventListener('click', closeMenu); if (loginBtn) { loginBtn.addEventListener('click', function(e) { e.preventDefault(); e.stopPropagation(); openLoginModal(); }); } if (panelBtn) { panelBtn.addEventListener('click', function(e) { e.preventDefault(); e.stopPropagation(); openPanelModal(); }); } if (loginClose) loginClose.addEventListener('click', closeLoginModal); if (panelClose) panelClose.addEventListener('click', closePanelModal); if (loginForm) { loginForm.addEventListener('submit', handleLoginSubmit); } document.querySelectorAll('.FS-expand-btn').forEach(btn => { btn.addEventListener('click', function(e) { e.preventDefault(); const parent = this.closest('.FS-expandable'); const wasExpanded = parent.classList.contains('expanded'); document.querySelectorAll('.FS-expandable').forEach(item => { if (item !== parent) { item.classList.remove('expanded'); } }); parent.classList.toggle('expanded'); }); }); const yearInput = document.querySelector('.FS-main-nav #customYearInput'); const yearBtn = document.querySelector('.FS-main-nav .year-go-btn'); if (yearInput && yearBtn) { yearBtn.addEventListener('click', function() { const year = yearInput.value.trim(); if (year && year.length === 4 && year >= 1900 && year <= 2030) { window.location.href = `/xfsearch/date-de-sortie/${year}/`; } }); yearInput.addEventListener('keypress', function(e) { if (e.key === 'Enter') { yearBtn.click(); } }); } document.addEventListener('keydown', function(e) { if (e.key === 'Escape') { closeMenu(); } }); const currentPath = window.location.pathname; document.querySelectorAll('.FS-nav-item:not(.FS-expand-btn)').forEach(item => { if (item.getAttribute('href') === currentPath) { item.classList.add('active'); } }); if (window.toggleLoginModal) { const originalToggleLogin = window.toggleLoginModal; window.toggleLoginModal = function() { if (window.innerWidth <= 1220 && menu && menu.classList.contains('open')) { openLoginModal(); } else { originalToggleLogin(); } }; } if (window.togglePanelModal) { const originalTogglePanel = window.togglePanelModal; window.togglePanelModal = function() { if (window.innerWidth <= 1220 && menu && menu.classList.contains('open')) { openPanelModal(); } else { originalTogglePanel(); } }; } setupMobileSearchIntegration(); } function init() { if (document.readyState === 'loading') { document.addEventListener('DOMContentLoaded', function() { setTimeout(() => { createMobileMenu(); setupEventListeners(); }, 100); }); } else { setTimeout(() => { createMobileMenu(); setupEventListeners(); }, 100); } } init(); })();