fix: vérification /team au tout début du script et nettoyage triple

- Vérification de /team au tout début du script (avant Fast Refresh protection)
- Triple nettoyage dans le script Python (3 patterns différents)
- Redirection immédiate vers /team.html sans attendre

Cela devrait enfin fonctionner car :
- Le script s'exécute en premier
- Tous les formats de liens sont supprimés
- La redirection est immédiate
This commit is contained in:
syoul
2025-12-09 12:17:42 +01:00
parent 3d12bbdc8d
commit 112ba401d7

View File

@@ -1,5 +1,33 @@
// Script pour la gestion des pages de stratégie // Script pour la gestion des pages de stratégie
(function() { (function() {
// VÉRIFICATION IMMÉDIATE DE /team AVANT TOUT (s'exécute en premier)
(function checkTeamRouteFirst() {
if (typeof window === 'undefined') return;
function normalizePath(pathname) {
if (!pathname) return '/';
const cleaned = pathname.replace(/\/+$/, '');
return cleaned === '' ? '/' : cleaned;
}
const path = normalizePath(window.location.pathname);
if (path === '/team' || path === '/team/') {
console.log('🔍 Route /team détectée IMMÉDIATEMENT, redirection vers /team.html...');
// Rediriger immédiatement vers /team.html
if (document.body) {
document.body.innerHTML = '<div style="width:100vw;height:100vh;margin:0;padding:0;overflow:hidden;position:fixed;top:0;left:0;z-index:9999;background:#1a4d3a;"><iframe src="/team.html" style="width:100%;height:100%;border:none;display:block;" title="Équipe & Technologies"></iframe></div>';
window.history.pushState({page: 'team'}, 'Équipe & Technologies', '/team');
} else {
const checkBody = setInterval(() => {
if (document.body) {
clearInterval(checkBody);
document.body.innerHTML = '<div style="width:100vw;height:100vh;margin:0;padding:0;overflow:hidden;position:fixed;top:0;left:0;z-index:9999;background:#1a4d3a;"><iframe src="/team.html" style="width:100%;height:100%;border:none;display:block;" title="Équipe & Technologies"></iframe></div>';
window.history.pushState({page: 'team'}, 'Équipe & Technologies', '/team');
}
}, 10);
setTimeout(() => clearInterval(checkBody), 5000);
}
}
})();
// Protection contre Fast Refresh : ignorer les tentatives de hot-reload // Protection contre Fast Refresh : ignorer les tentatives de hot-reload
// Intercepter et ignorer les requêtes webpack hot-update pour éviter les rechargements en boucle // Intercepter et ignorer les requêtes webpack hot-update pour éviter les rechargements en boucle
if (typeof window !== 'undefined') { if (typeof window !== 'undefined') {