fix: désactiver tous les scripts JavaScript qui ajoutent des liens dans le header

- 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.)
This commit is contained in:
syoul
2025-12-09 10:19:16 +01:00
parent 9894a8b2fb
commit 99cb96bbd6
2 changed files with 14 additions and 74 deletions

View File

@@ -9,7 +9,8 @@
function initStrategyLinks() { function initStrategyLinks() {
addStrategyLinkToFooter(); addStrategyLinkToFooter();
addStrategyLinkToHeader(); // DÉSACTIVÉ: addStrategyLinkToHeader() - Les liens sont maintenant gérés par Navigation.tsx
// addStrategyLinkToHeader();
handleStrategyRoute(); handleStrategyRoute();
} }
@@ -123,20 +124,9 @@
} }
} }
function addStrategyLinkToHeader() { // FONCTION DÉSACTIVÉE: Les liens de navigation sont maintenant gérés par Navigation.tsx
// Chercher le header ou la navigation // Cette fonction créait des doublons dans le header
const header = document.querySelector('header') || document.querySelector('nav') || document.querySelector('[class*="header"]') || document.querySelector('[class*="nav"]'); // function addStrategyLinkToHeader() {
// ... code désactivé ...
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);
}
}
})(); })();

View File

@@ -774,7 +774,8 @@ Interface de pilotage pour les responsables sécurité des PME.
// Marquer comme initialisé // Marquer comme initialisé
isInitialized = true; isInitialized = true;
addLinksToHeader(); // DÉSACTIVÉ: addLinksToHeader() - Les liens sont maintenant gérés par Navigation.tsx
// addLinksToHeader();
handleRoute(); handleRoute();
} }
@@ -886,62 +887,11 @@ Interface de pilotage pour les responsables sécurité des PME.
}); });
} }
function addLinksToHeader() { // FONCTION DÉSACTIVÉE: Les liens de navigation sont maintenant gérés par Navigation.tsx
console.log('🔗 addLinksToHeader() appelée'); // Cette fonction créait des doublons dans le header
// Chercher le header // function addLinksToHeader() {
const header = document.querySelector('header') || // ... code désactivé ...
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);
});
}
window.addEventListener('popstate', function(event) { window.addEventListener('popstate', function(event) {
if (event.state && event.state.page) { if (event.state && event.state.page) {