From 6a513bc0b58166be57c7b9f8e0d194504e625069 Mon Sep 17 00:00:00 2001 From: Claude Date: Fri, 5 Dec 2025 05:19:41 +0000 Subject: [PATCH] Add dynamic container creation as fallback if template fails to load --- index.js | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/index.js b/index.js index 89be7a8..6a6fbee 100644 --- a/index.js +++ b/index.js @@ -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('
'); + console.log('[Character Tracking] ✅ Container created dynamically'); + } else { + console.warn('[Character Tracking] ❌ Could not find .rpg-content-box to add container'); + } + } + updateCharacterStateDisplay(); }