(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: 85%; max-width: 350px; height: 100vh; background: linear-gradient(180deg, #0f0f0f, #1a1a1a); z-index: 999999; transition: left 0.3s cubic-bezier(0.4, 0, 0.2, 1); overflow-y: auto; border-right: 2px solid #41dc9c; box-shadow: 5px 0 25px rgba(0, 0, 0, 0.8); } @media (max-width: 1220px) { .FS-mobile-menu { display: block; } } .FS-mobile-menu.open { left: 0; } .FS-menu-overlay { display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0, 0, 0, 0.7); z-index: 999998; backdrop-filter: blur(3px); } .FS-menu-overlay.show { display: block; } .FS-menu-header { padding: 1px; background: linear-gradient(145deg, #1a1a1a, #2d2d2d); border-bottom: 2px solid rgba(244, 134, 37, 0.3); position: sticky; top: 0; z-index: 10; } .FS-menu-logo { display: flex; align-items: center; gap: 12px; margin-bottom: 1px; } .FS-menu-logo .container2 { pointer-events: none !important; transform: scale(0.8); } .FS-menu-logo .container2 .text { color: white !important; } .FS-menu-logo .container2 .logo { color: #41dc9c !important; } .FS-close-btn { position: absolute; top: 15px; right: 15px; width: 35px; height: 35px; background: rgba(244, 134, 37, 0.2); border: none; border-radius: 50%; color: #41dc9c; font-size: 18px; cursor: pointer; transition: all 0.3s ease; } .FS-close-btn:hover { background: #41dc9c; color: white; transform: rotate(90deg); } .FS-mobile-search { margin-bottom: 15px; } .FS-search-form { position: relative; } .FS-search-input { width: 100%; padding: 12px 45px 12px 15px; background: rgba(255, 255, 255, 0.1); border: 1px solid rgba(244, 134, 37, 0.3); border-radius: 8px; color: white; font-size: 14px; transition: all 0.3s ease; } .FS-search-input:focus { outline: none; border-color: #41dc9c; box-shadow: 0 0 10px rgba(244, 134, 37, 0.3); background: rgba(255, 255, 255, 0.15); } .FS-search-input::placeholder { color: rgba(255, 255, 255, 0.6); } .FS-search-btn { position: absolute; right: 5px; top: 53%; transform: translateY(-50%); width: 35px; height: 35px; background: linear-gradient(145deg, #41dc9c00, #ff853300); border: none; border-radius: 6px; color: white; cursor: pointer; transition: all 0.3s ease; } .FS-search-btn:hover { transform: translateY(-50%) scale(1.05); box-shadow: 0 2px 8px rgba(244, 134, 37, 0.4); } /* Boutons de connexion/panel */ .FS-user-actions { display: flex; gap: 8px; margin-bottom: 15px; } .FS-user-btn { flex: 1; padding: 10px; background: linear-gradient(145deg, #2c2c2c, #242424); border: 1px solid rgba(244, 134, 37, 0.3); border-radius: 6px; color: white; font-size: 12px; font-weight: 500; cursor: pointer; transition: all 0.3s ease; text-align: center; } .FS-user-btn:hover { background: linear-gradient(145deg, #41dc9c, #ff8533); border-color: #41dc9c; transform: translateY(-1px); box-shadow: 0 3px 8px rgba(244, 134, 37, 0.3); } .FS-user-btn i { margin-right: 6px; } .FS-modal-container { display: none; background: rgba(0, 0, 0, 0.3); border-radius: 8px; margin: 15px 0; padding: 20px; border: 1px solid rgba(244, 134, 37, 0.3); } .FS-modal-container.show { display: block; animation: slideDown 0.3s ease; } @keyframes slideDown { from { opacity: 0; transform: translateY(-20px); } to { opacity: 1; transform: translateY(0); } } .FS-modal-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 15px; padding-bottom: 10px; border-bottom: 1px solid rgba(244, 134, 37, 0.3); } .FS-modal-title { color: #41dc9c; font-size: 16px; font-weight: bold; } .FS-modal-close { background: none; border: none; color: #41dc9c; font-size: 18px; cursor: pointer; width: 25px; height: 25px; border-radius: 50%; transition: all 0.3s ease; } .FS-modal-close:hover { background: rgba(244, 134, 37, 0.2); transform: rotate(90deg); } .FS-login-form { display: flex; flex-direction: column; gap: 12px; } .FS-input-group { position: relative; } .FS-input-group input { width: 100%; padding: 10px 12px; background: rgba(255, 255, 255, 0.1); border: 1px solid rgba(244, 134, 37, 0.3); border-radius: 6px; color: white; font-size: 14px; transition: all 0.3s ease; box-sizing: border-box; } .FS-input-group input:focus { outline: none; border-color: #41dc9c; box-shadow: 0 0 8px rgba(244, 134, 37, 0.3); } .FS-input-group input::placeholder { color: rgba(255, 255, 255, 0.6); } .FS-checkbox-group { display: flex; align-items: center; gap: 8px; } .FS-checkbox-group input[type="checkbox"] { width: auto; } .FS-checkbox-group label { color: #ccc; font-size: 13px; } .FS-submit-btn { padding: 12px; background: linear-gradient(145deg, #41dc9c, #ff8533); border: none; border-radius: 6px; color: white; font-weight: bold; cursor: pointer; transition: all 0.3s ease; } .FS-submit-btn:hover { transform: translateY(-1px); box-shadow: 0 4px 12px rgba(244, 134, 37, 0.4); } .FS-form-links { display: flex; justify-content: space-between; margin-top: 10px; } .FS-form-links a { color: #41dc9c; font-size: 12px; text-decoration: none; transition: all 0.3s ease; } .FS-form-links a:hover { color: #ff8533; text-decoration: underline; } .FS-main-nav { padding: 0; } .FS-nav-item { display: flex; align-items: center; padding: 16px 20px; 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.1), transparent); transition: left 0.6s ease; } .FS-nav-item:hover::before { left: 100%; } .FS-nav-item:hover { background: rgba(244, 134, 37, 0.1); color: white; border-left-color: #41dc9c; } .FS-nav-item.active { background: rgba(244, 134, 37, 0.0); color: white; border-left-color: #41dc9c; } .FS-nav-icon { width: 24px; height: 24px; margin-right: 16px; font-size: 18px; color: #41dc9c; transition: all 0.3s ease; } .FS-nav-item:hover .FS-nav-icon { transform: scale(1.1); } .FS-nav-text { font-size: 15px; font-weight: 500; } .FS-menu-section { margin: 20px 0; } .FS-section-title { padding: 12px 20px; font-size: 13px; font-weight: bold; color: #888; text-transform: uppercase; letter-spacing: 1px; background: rgba(255, 255, 255, 0.05); border-top: 1px solid rgba(244, 134, 37, 0.2); border-bottom: 1px solid rgba(244, 134, 37, 0.2); } .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: 20px; } .FS-expand-icon { font-size: 14px; transition: transform 0.3s ease; color: #41dc9c; } .FS-expandable.expanded .FS-expand-icon { transform: rotate(90deg); } .FS-submenu { max-height: 0; overflow: hidden; transition: max-height 0.3s ease; background: rgba(0, 0, 0, 0.3); } .FS-expandable.expanded .FS-submenu { max-height: 1390px; } .FS-submenu-item { display: flex; align-items: center; padding: 12px 20px 12px 60px; color: #bbb; text-decoration: none; transition: all 0.3s ease; font-size: 14px; position: relative; } .FS-submenu-item::before { content: '•'; position: absolute; left: 45px; color: #41dc9c; font-size: 16px; } .FS-submenu-item:hover { background: rgba(244, 134, 37, 0.1); color: white; padding-left: 65px; } .FS-badge { background: linear-gradient(145deg, #41dc9c, #ff8533); color: white; font-size: 10px; padding: 2px 8px; border-radius: 12px; margin-left: auto; font-weight: bold; animation: pulse 2s infinite; } @keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.7; } } .FS-main-nav .menu-section { background: rgba(255, 255, 255, 0.05); border-radius: 12px; margin: 15px 30px; padding: 15px; border: 1px solid rgba(244, 134, 37, 0.2); } .FS-main-nav .menu-section-title { color: #41dc9c !important; font-size: 14px !important; font-weight: bold !important; margin-bottom: 12px !important; padding-bottom: 8px !important; border-bottom: 1px solid rgba(244, 134, 37, 0.3) !important; text-transform: uppercase; letter-spacing: 1px; } .FS-main-nav .menu-section a { display: flex !important; align-items: center !important; padding: 8px 1px !important; color: #ccc !important; text-decoration: none !important; border-radius: 1px !important; transition: all 0.3s ease !important; margin-bottom: 1px !important; font-size: 14px !important; border-left: 1px solid transparent !important; } .FS-main-nav .menu-section a:hover { background: rgba(244, 134, 37, 0.1) !important; color: white !important; border-left-color: #41dc9c !important; padding-left: 16px !important; } .FS-main-nav .menu-section a i { margin-right: 10px !important; color: #41dc9c !important; width: 16px !important; text-align: center !important; font-size: 14px !important; } .FS-mobile-menu::-webkit-scrollbar { width: 4px; } .FS-mobile-menu::-webkit-scrollbar-track { background: rgba(0, 0, 0, 0.2); } .FS-mobile-menu::-webkit-scrollbar-thumb { background: linear-gradient(180deg, #41dc9c, #ff8533); border-radius: 4px; } @media (max-width: 1220px) { .FS-mobile-menu { width: 75%; } .FS-nav-item { padding: 14px 15px; } .FS-submenu-item { padding: 10px 15px 10px 50px; } } `; 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 = ' '; } else if (linkText.toLowerCase().includes('anime')) { icon = 'fas fa-magic'; } else if (linkText.includes('TV') && linkText.includes('LIVE')) { icon = 'fas fa-tv'; 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: '
' }); 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() { const originalSearchForm = document.querySelector('#quicksearch'); if (!originalSearchForm) return ''; return ` `; } function createUserButtons() { const isLoggedIn = checkUserStatus(); if (isLoggedIn) { return `
`; } else { return `
`; } } function createLoginModal() { return `
Connexion
`; } function createPanelModal() { return `
`; } 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; }); function performSearch() { const query = mobileSearchInput.value.trim(); if (query.length > 0) { desktopSearchInput.value = query; closeMenu(); setTimeout(() => { const desktopForm = document.getElementById('quicksearch'); if (desktopForm) { const event = new Event('submit', { bubbles: true, cancelable: true }); desktopForm.dispatchEvent(event); } }, 300); } else { mobileSearchInput.focus(); mobileSearchInput.style.borderColor = '#ff4444'; setTimeout(() => { mobileSearchInput.style.borderColor = 'rgba(244, 134, 37, 0.3)'; }, 2000); } } 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'); 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(); })();