Add dynamic container creation as fallback if template fails to load

This commit is contained in:
Claude
2025-12-05 05:19:41 +00:00
parent ffed3aa1b5
commit 6a513bc0b5
+14
View File
@@ -542,6 +542,20 @@ async function initUI() {
initLorebookLimiter();
// Initialize character state display (NEW)
// First, ensure the container exists (in case template.html didn't load)
if ($('#rpg-character-state-container').length === 0) {
console.log('[Character Tracking] Container not found, creating it dynamically...');
// Try to add to existing content box
const $contentBox = $('.rpg-content-box');
if ($contentBox.length > 0) {
$contentBox.append('<div id="rpg-character-state-container" class="rpg-section rpg-character-state-section"></div>');
console.log('[Character Tracking] ✅ Container created dynamically');
} else {
console.warn('[Character Tracking] ❌ Could not find .rpg-content-box to add container');
}
}
updateCharacterStateDisplay();
}