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:
@@ -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é ...
|
||||
// }
|
||||
})();
|
||||
|
||||
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user