From 99cb96bbd6fdde6dece9851e91914e452a9cb4fa Mon Sep 17 00:00:00 2001 From: syoul Date: Tue, 9 Dec 2025 10:19:16 +0100 Subject: [PATCH] =?UTF-8?q?fix:=20d=C3=A9sactiver=20tous=20les=20scripts?= =?UTF-8?q?=20JavaScript=20qui=20ajoutent=20des=20liens=20dans=20le=20head?= =?UTF-8?q?er?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - désactivation de addLinksToHeader() dans strategie-script.js - désactivation de addStrategyLinkToHeader() dans strategie-link.js - tous les liens de navigation sont maintenant gérés uniquement par Navigation.tsx - évite les doublons de liens (Équipe, Stratégie, etc.) --- public/strategie-link.js | 24 +++++--------- public/strategie-script.js | 64 +++++--------------------------------- 2 files changed, 14 insertions(+), 74 deletions(-) diff --git a/public/strategie-link.js b/public/strategie-link.js index e6bfafb..164d1f1 100644 --- a/public/strategie-link.js +++ b/public/strategie-link.js @@ -9,7 +9,8 @@ function initStrategyLinks() { addStrategyLinkToFooter(); - addStrategyLinkToHeader(); + // DÉSACTIVÉ: addStrategyLinkToHeader() - Les liens sont maintenant gérés par Navigation.tsx + // addStrategyLinkToHeader(); handleStrategyRoute(); } @@ -123,20 +124,9 @@ } } - function addStrategyLinkToHeader() { - // Chercher le header ou la navigation - const header = document.querySelector('header') || document.querySelector('nav') || document.querySelector('[class*="header"]') || document.querySelector('[class*="nav"]'); - - if (header) { - const strategyLink = document.createElement('a'); - strategyLink.href = '/strategie'; - strategyLink.textContent = 'Stratégie'; - strategyLink.style.marginLeft = '15px'; - strategyLink.style.color = '#2ecc71'; - strategyLink.style.textDecoration = 'none'; - strategyLink.style.fontWeight = 'bold'; - - header.appendChild(strategyLink); - } - } + // FONCTION DÉSACTIVÉE: Les liens de navigation sont maintenant gérés par Navigation.tsx + // Cette fonction créait des doublons dans le header + // function addStrategyLinkToHeader() { + // ... code désactivé ... + // } })(); diff --git a/public/strategie-script.js b/public/strategie-script.js index 2f9b5b5..c311d24 100644 --- a/public/strategie-script.js +++ b/public/strategie-script.js @@ -774,7 +774,8 @@ Interface de pilotage pour les responsables sécurité des PME. // Marquer comme initialisé isInitialized = true; - addLinksToHeader(); + // DÉSACTIVÉ: addLinksToHeader() - Les liens sont maintenant gérés par Navigation.tsx + // addLinksToHeader(); handleRoute(); } @@ -886,62 +887,11 @@ Interface de pilotage pour les responsables sécurité des PME. }); } - function addLinksToHeader() { - console.log('🔗 addLinksToHeader() appelée'); - // Chercher le header - const header = document.querySelector('header') || - document.querySelector('nav') || - document.querySelector('div[role="banner"]'); - - console.log('🔍 Header trouvé:', !!header, header ? header.tagName : 'null'); - - let container = header; - - // Si pas de header, créer une barre fixe - if (!header) { - let fixedBar = document.getElementById('custom-nav-bar'); - if (!fixedBar) { - fixedBar = document.createElement('div'); - fixedBar.id = 'custom-nav-bar'; - fixedBar.style.cssText = 'position: fixed; top: 0; right: 0; padding: 10px 20px; z-index: 9999; display: flex; gap: 15px; background: rgba(255,255,255,0.9); border-bottom-left-radius: 8px; box-shadow: 0 2px 5px rgba(0,0,0,0.1);'; - document.body.appendChild(fixedBar); - } - container = fixedBar; - } else { - // Créer un conteneur pour nos liens s'il n'existe pas - let linkContainer = header.querySelector('#custom-nav-container'); - if (!linkContainer) { - linkContainer = document.createElement('div'); - linkContainer.id = 'custom-nav-container'; - linkContainer.style.cssText = 'display: flex; gap: 15px; margin-left: auto; align-items: center; padding-right: 20px;'; - header.appendChild(linkContainer); - } - container = linkContainer; - } - - - // Ajouter les liens des pages de stratégie - Object.keys(pageTitles).forEach(key => { - if (document.getElementById(`link-${key}`)) return; - - const link = document.createElement('a'); - link.id = `link-${key}`; - link.className = 'custom-nav-link'; - link.href = `#${key}`; - link.textContent = pageTitles[key]; - link.style.cssText = 'color: #2ecc71; text-decoration: none; font-weight: bold; cursor: pointer; font-size: 14px; padding: 5px 8px; border-radius: 4px; transition: background 0.2s;'; - - link.addEventListener('mouseenter', () => link.style.background = 'rgba(46, 204, 113, 0.1)'); - link.addEventListener('mouseleave', () => link.style.background = 'transparent'); - - link.addEventListener('click', (e) => { - e.preventDefault(); - showPage(key); - }); - - container.appendChild(link); - }); - } + // FONCTION DÉSACTIVÉE: Les liens de navigation sont maintenant gérés par Navigation.tsx + // Cette fonction créait des doublons dans le header + // function addLinksToHeader() { + // ... code désactivé ... + // } window.addEventListener('popstate', function(event) { if (event.state && event.state.page) {