From ba45a934cfef6f451baa7beed711140661e5e6e6 Mon Sep 17 00:00:00 2001 From: syoul Date: Sat, 6 Dec 2025 22:08:22 +0100 Subject: [PATCH] =?UTF-8?q?fix:=20ajout=20logs=20debug=20d=C3=A9taill?= =?UTF-8?q?=C3=A9s=20pour=20diagnostic=20lien=20=C3=89quipe?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Logs dans initWhenReady() pour voir si le header est trouvé - Logs dans addLinksToHeader() pour voir si la fonction est appelée - Retry avec limite de 10 tentatives pour trouver le header - Logs pour vérifier l'ajout du lien Équipe --- public/strategie-script.js | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/public/strategie-script.js b/public/strategie-script.js index bb8b959..bc9d512 100644 --- a/public/strategie-script.js +++ b/public/strategie-script.js @@ -984,15 +984,28 @@ Interface de pilotage pour les responsables sécurité des PME. document.querySelector('nav') || document.querySelector('div[role="banner"]'); + console.log('🔍 initWhenReady - header trouvé:', !!header, 'body:', !!document.body); + if (header || document.body) { checkAuth(); // Délai pour s'assurer que le header est complètement rendu setTimeout(() => { + console.log('🚀 Initialisation des liens de navigation...'); initStrategyLinks(); - }, 100); + }, 200); } else { - // Réessayer après un court délai - setTimeout(initWhenReady, 50); + // Réessayer après un court délai (max 10 tentatives = 500ms) + if (typeof initWhenReady.attempts === 'undefined') { + initWhenReady.attempts = 0; + } + initWhenReady.attempts++; + if (initWhenReady.attempts < 10) { + setTimeout(initWhenReady, 50); + } else { + console.warn('⚠️ Header non trouvé après 10 tentatives, initialisation quand même'); + checkAuth(); + initStrategyLinks(); + } } }