- Add intelligent content-game compatibility system with visual badges - Fix Adventure Reader to work with Dragon's Pearl content structure - Implement multi-column games grid for faster navigation - Add pronunciation display for Chinese vocabulary and sentences - Fix navigation breadcrumb to show proper hierarchy (Home > Levels > Content) - Add back buttons to all navigation pages - Improve JSONContentLoader to preserve story structure - Add comprehensive debugging and diagnostic tools 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
182 lines
7.1 KiB
JavaScript
182 lines
7.1 KiB
JavaScript
// === DIAGNOSTIC COMPLET DU SCAN DYNAMIQUE ===
|
||
|
||
// Script de diagnostic à exécuter dans la console pour identifier TOUS les problèmes
|
||
|
||
function diagnosticComplet() {
|
||
console.log('🔍 DIAGNOSTIC COMPLET DU SCAN DYNAMIQUE\n');
|
||
console.log('=====================================\n');
|
||
|
||
const issues = [];
|
||
const success = [];
|
||
|
||
// 1. Vérification des classes de base
|
||
console.log('1️⃣ VÉRIFICATION DES CLASSES DE BASE');
|
||
console.log('-------------------------------------');
|
||
|
||
if (!window.ContentScanner) {
|
||
issues.push('❌ ContentScanner non chargé');
|
||
console.log('❌ ContentScanner: NON CHARGÉ');
|
||
} else {
|
||
success.push('✅ ContentScanner chargé');
|
||
console.log('✅ ContentScanner: CHARGÉ');
|
||
}
|
||
|
||
if (!window.ContentGameCompatibility) {
|
||
issues.push('❌ ContentGameCompatibility non chargé');
|
||
console.log('❌ ContentGameCompatibility: NON CHARGÉ');
|
||
} else {
|
||
success.push('✅ ContentGameCompatibility chargé');
|
||
console.log('✅ ContentGameCompatibility: CHARGÉ');
|
||
}
|
||
|
||
if (!window.AppNavigation) {
|
||
issues.push('❌ AppNavigation non chargé');
|
||
console.log('❌ AppNavigation: NON CHARGÉ');
|
||
return { issues, success };
|
||
} else {
|
||
success.push('✅ AppNavigation chargé');
|
||
console.log('✅ AppNavigation: CHARGÉ');
|
||
}
|
||
|
||
// 2. Vérification de l'initialisation
|
||
console.log('\n2️⃣ VÉRIFICATION DE L\'INITIALISATION');
|
||
console.log('--------------------------------------');
|
||
|
||
if (!window.AppNavigation.contentScanner) {
|
||
issues.push('❌ ContentScanner non initialisé dans AppNavigation');
|
||
console.log('❌ AppNavigation.contentScanner: NON INITIALISÉ');
|
||
} else {
|
||
success.push('✅ ContentScanner initialisé');
|
||
console.log('✅ AppNavigation.contentScanner: INITIALISÉ');
|
||
}
|
||
|
||
if (!window.AppNavigation.compatibilityChecker) {
|
||
issues.push('❌ CompatibilityChecker non initialisé dans AppNavigation');
|
||
console.log('❌ AppNavigation.compatibilityChecker: NON INITIALISÉ');
|
||
} else {
|
||
success.push('✅ CompatibilityChecker initialisé');
|
||
console.log('✅ AppNavigation.compatibilityChecker: INITIALISÉ');
|
||
}
|
||
|
||
// 3. Vérification du contenu scanné
|
||
console.log('\n3️⃣ VÉRIFICATION DU CONTENU SCANNÉ');
|
||
console.log('----------------------------------');
|
||
|
||
if (!window.AppNavigation.scannedContent) {
|
||
issues.push('❌ Aucun contenu scanné trouvé');
|
||
console.log('❌ scannedContent: VIDE');
|
||
} else {
|
||
const found = window.AppNavigation.scannedContent.found || [];
|
||
console.log(`✅ scannedContent: ${found.length} modules trouvés`);
|
||
|
||
if (found.length === 0) {
|
||
issues.push('❌ Scanner n\'a trouvé aucun module');
|
||
} else {
|
||
success.push(`✅ ${found.length} modules détectés`);
|
||
|
||
console.log('\n 📋 MODULES DÉTECTÉS:');
|
||
found.forEach((content, index) => {
|
||
console.log(` ${index + 1}. "${content.name}" (ID: ${content.id})`);
|
||
console.log(` 📁 Fichier: ${content.filename}`);
|
||
console.log(` 📊 Vocab: ${content.stats?.vocabularyCount || 0}, Phrases: ${content.stats?.sentenceCount || 0}`);
|
||
});
|
||
|
||
// Chercher spécifiquement Dragon's Pearl
|
||
const dragonPearl = found.find(c =>
|
||
c.name.includes('Dragon') ||
|
||
c.id.includes('chinese-long-story') ||
|
||
c.filename.includes('chinese-long-story')
|
||
);
|
||
|
||
if (dragonPearl) {
|
||
success.push('✅ Dragon\'s Pearl détecté dans le scan');
|
||
console.log(`\n 🐉 DRAGON'S PEARL TROUVÉ:`);
|
||
console.log(` Nom: "${dragonPearl.name}"`);
|
||
console.log(` ID: "${dragonPearl.id}"`);
|
||
console.log(` Fichier: "${dragonPearl.filename}"`);
|
||
} else {
|
||
issues.push('❌ Dragon\'s Pearl non trouvé dans le scan');
|
||
console.log('\n ❌ DRAGON\'S PEARL: NON TROUVÉ');
|
||
}
|
||
}
|
||
}
|
||
|
||
// 4. Vérification des modules JavaScript
|
||
console.log('\n4️⃣ VÉRIFICATION DES MODULES JAVASCRIPT');
|
||
console.log('---------------------------------------');
|
||
|
||
if (!window.ContentModules) {
|
||
issues.push('❌ window.ContentModules non défini');
|
||
console.log('❌ window.ContentModules: NON DÉFINI');
|
||
} else {
|
||
const modules = Object.keys(window.ContentModules);
|
||
console.log(`✅ window.ContentModules: ${modules.length} modules`);
|
||
console.log(` Modules: ${modules.join(', ')}`);
|
||
|
||
if (window.ContentModules.ChineseLongStory) {
|
||
success.push('✅ Module ChineseLongStory chargé');
|
||
console.log('✅ ChineseLongStory: CHARGÉ');
|
||
|
||
const module = window.ContentModules.ChineseLongStory;
|
||
console.log(` Nom: "${module.name}"`);
|
||
console.log(` Vocabulaire: ${Object.keys(module.vocabulary || {}).length} mots`);
|
||
console.log(` Story: ${module.story ? 'OUI' : 'NON'}`);
|
||
} else {
|
||
issues.push('❌ Module ChineseLongStory non chargé');
|
||
console.log('❌ ChineseLongStory: NON CHARGÉ');
|
||
}
|
||
}
|
||
|
||
// 5. Test de compatibilité
|
||
console.log('\n5️⃣ TEST DE COMPATIBILITÉ');
|
||
console.log('-------------------------');
|
||
|
||
if (window.AppNavigation?.compatibilityChecker && window.ContentModules?.ChineseLongStory) {
|
||
try {
|
||
const checker = window.AppNavigation.compatibilityChecker;
|
||
const content = window.ContentModules.ChineseLongStory;
|
||
|
||
console.log('✅ Test de compatibilité possible');
|
||
|
||
const games = ['whack-a-mole', 'memory-match', 'quiz-game', 'text-reader'];
|
||
games.forEach(game => {
|
||
const result = checker.checkCompatibility(content, game);
|
||
const status = result.compatible ? '✅' : '❌';
|
||
console.log(` ${status} ${game}: ${result.score}% - ${result.reason}`);
|
||
});
|
||
|
||
success.push('✅ Système de compatibilité fonctionnel');
|
||
} catch (error) {
|
||
issues.push(`❌ Erreur test compatibilité: ${error.message}`);
|
||
console.log(`❌ ERREUR TEST: ${error.message}`);
|
||
}
|
||
} else {
|
||
issues.push('❌ Test de compatibilité impossible');
|
||
console.log('❌ Test de compatibilité: IMPOSSIBLE');
|
||
}
|
||
|
||
// 6. Rapport final
|
||
console.log('\n📊 RAPPORT FINAL');
|
||
console.log('================');
|
||
console.log(`✅ Succès: ${success.length}`);
|
||
console.log(`❌ Problèmes: ${issues.length}`);
|
||
|
||
if (issues.length > 0) {
|
||
console.log('\n🚨 PROBLÈMES IDENTIFIÉS:');
|
||
issues.forEach((issue, index) => {
|
||
console.log(`${index + 1}. ${issue}`);
|
||
});
|
||
}
|
||
|
||
if (success.length > 0) {
|
||
console.log('\n🎉 ÉLÉMENTS FONCTIONNELS:');
|
||
success.forEach((item, index) => {
|
||
console.log(`${index + 1}. ${item}`);
|
||
});
|
||
}
|
||
|
||
return { issues, success };
|
||
}
|
||
|
||
// Auto-exécution
|
||
diagnosticComplet(); |