diff --git a/README.md b/README.md index c5e7cc9..2eab6be 100644 --- a/README.md +++ b/README.md @@ -7,15 +7,14 @@ An immersive RPG extension for browsers that tracks character stats, scene infor ## 🆕 What's New -### v3.3.0 +### v3.3.1 -- Small upgrades to the combat system. -- Regex fix. -- Fixed External API logic. -- Even more minor bug fixes. +- Thought bubble can now be collapsed into an icon. +- Fixed a bug for Past Events being parsed incorrectly. +- Added event emission on when the tracker generation is complete. **Special thanks to all the other contributors for this project:** -Paperboygold, Munimunigamer, Subarashimo, Lilminzyu, Claude, IDeathByte, Chungchandev, Joenunezb, and Amauragis. +Paperboygold, Munimunigamer, Subarashimo, Lilminzyu, Claude, IDeathByte, Chungchandev, Joenunezb, Amauragis, and Tomt610. ## 📥 Installation @@ -268,7 +267,7 @@ If you enjoy this extension, consider supporting development: ## 🙏 Credits **Contributors:** -SpicyMarinara, Paperboygold, Munimunigamer, Subarashimo, Lilminzyu, Claude, IDeathByte, Chungchandev, Joenunezb, and Amauragis. +SpicyMarinara, Paperboygold, Munimunigamer, Subarashimo, Lilminzyu, Claude, IDeathByte, Chungchandev, Joenunezb, Amauragis, and Tomt610. ## 🚀 Planned Features diff --git a/manifest.json b/manifest.json index 97a1a31..6cc5b3c 100644 --- a/manifest.json +++ b/manifest.json @@ -6,6 +6,6 @@ "js": "index.js", "css": "style.css", "author": "Marinara", - "version": "3.3.0", + "version": "3.3.1", "homePage": "https://github.com/SpicyMarinara/rpg-companion-sillytavern" } diff --git a/settings.html b/settings.html index a04a767..11548d6 100644 --- a/settings.html +++ b/settings.html @@ -43,12 +43,12 @@ Contributors:
- SpicyMarinara, Paperboygold, Munimunigamer, Subarashimo, Lilminzyu, Claude, IDeathByte, Chungchandev, Joenunezb, and Amauragis. + SpicyMarinara, Paperboygold, Munimunigamer, Subarashimo, Lilminzyu, Claude, IDeathByte, Chungchandev, Joenunezb, Amauragis, and Tomt610.
- v3.2.6 + v3.3.1
diff --git a/src/systems/rendering/infoBox.js b/src/systems/rendering/infoBox.js index 89f39de..6790500 100644 --- a/src/systems/rendering/infoBox.js +++ b/src/systems/rendering/infoBox.js @@ -498,19 +498,19 @@ export function renderInfoBox() { if (config?.widgets?.recentEvents?.enabled) { // Parse Recent Events from infoBox (supports both JSON and text formats) let recentEvents = []; - if (committedTrackerData.infoBox) { + if (infoBoxData) { // Try JSON format first try { - const parsed = typeof committedTrackerData.infoBox === 'string' - ? JSON.parse(committedTrackerData.infoBox) - : committedTrackerData.infoBox; + const parsed = typeof infoBoxData === 'string' + ? JSON.parse(infoBoxData) + : infoBoxData; if (parsed && Array.isArray(parsed.recentEvents)) { recentEvents = parsed.recentEvents; } } catch (e) { // Fall back to old text format - const recentEventsLine = committedTrackerData.infoBox.split('\n').find(line => line.startsWith('Recent Events:')); + const recentEventsLine = infoBoxData.split('\n').find(line => line.startsWith('Recent Events:')); if (recentEventsLine) { const eventsString = recentEventsLine.replace('Recent Events:', '').trim(); if (eventsString) { diff --git a/src/systems/rendering/thoughts.js b/src/systems/rendering/thoughts.js index c916fc7..4815ef3 100644 --- a/src/systems/rendering/thoughts.js +++ b/src/systems/rendering/thoughts.js @@ -1847,9 +1847,9 @@ export function createThoughtPanel($message, thoughtsArray) { }, 100); } } else { - // Desktop: show panel, hide icon with class + // Desktop: always start with panel expanded on page load/refresh $thoughtPanel.css('display', 'block'); - $thoughtIcon.addClass('rpg-force-hide'); + $thoughtIcon.addClass('rpg-force-hide').removeClass('rpg-collapsed-desktop'); } // Handle viewport changes between mobile and desktop @@ -1880,24 +1880,62 @@ export function createThoughtPanel($message, thoughtsArray) { wasMobileView = isMobileNow; }); - // Close button functionality (mobile only) - support both click and touch + // Close button functionality - support both click and touch $thoughtPanel.find('.rpg-thought-close').on('click touchend', function(e) { e.preventDefault(); e.stopPropagation(); - // Only hide/show in mobile view - if (window.innerWidth <= 1000) { + + const isMobileView = window.innerWidth <= 1000; + + if (isMobileView) { + // Mobile: hide panel and show icon $thoughtPanel.fadeOut(200, function() { // Make sure icon is visible and clean state when panel closes (use selector, not variable) const $icon = $('#rpg-thought-icon'); $icon.removeClass('rpg-hidden dragging'); $icon.data('just-dragged', false); }); + } else { + // Desktop: collapse to icon at panel position + const panelRect = $thoughtPanel[0].getBoundingClientRect(); + const $icon = $('#rpg-thought-icon'); + + // Position icon where the panel is + $icon.css({ + top: `${panelRect.top}px`, + left: isRightPanel ? `${panelRect.left}px` : 'auto', + right: isRightPanel ? 'auto' : `${window.innerWidth - panelRect.right}px` + }); + + // Mark as collapsed desktop state (session only, not persisted) + $icon.addClass('rpg-collapsed-desktop'); + + // Hide panel and show icon + $thoughtPanel.fadeOut(200, function() { + $icon.removeClass('rpg-hidden rpg-force-hide'); + }); } }); - // Icon click/tap to show panel (mobile only) + // Icon click/tap to show panel const handleThoughtIconTap = function(e) { - // Skip if we just finished dragging + const isMobileView = window.innerWidth <= 1000; + const $icon = $('#rpg-thought-icon'); + + // Desktop collapsed state: expand panel and hide icon + if (!isMobileView && $icon.hasClass('rpg-collapsed-desktop')) { + e.preventDefault(); + e.stopPropagation(); + + // Remove collapsed state (no need to save, state is session-only) + $icon.addClass('rpg-force-hide').removeClass('rpg-collapsed-desktop'); + + // Show panel + $('#rpg-thought-panel').fadeIn(200); + return; + } + + // Skip if we just finished dragging (mobile only) if ($thoughtIcon.data('just-dragged')) { return; } @@ -1995,3 +2033,4 @@ export function createThoughtPanel($message, thoughtsArray) { } }); } + diff --git a/style.css b/style.css index 9580df4..92d93a8 100644 --- a/style.css +++ b/style.css @@ -4732,11 +4732,16 @@ body:has(.rpg-panel.rpg-position-left) #sheld { } } -/* Force hide class for desktop mode - overrides media query */ -#rpg-thought-icon.rpg-force-hide { +/* Force hide class for desktop mode - overrides media query (unless collapsed) */ +#rpg-thought-icon.rpg-force-hide:not(.rpg-collapsed-desktop) { display: none !important; } +/* When collapsed in desktop, show icon */ +#rpg-thought-icon.rpg-collapsed-desktop { + display: flex !important; +} + /* Hidden state that allows transitions */ #rpg-thought-icon.rpg-hidden { opacity: 0; @@ -4780,10 +4785,10 @@ body:has(.rpg-panel.rpg-position-left) #sheld { color: var(--rpg-highlight, #e94560); } -/* Hide close button in desktop view (panel doesn't close) */ +/* Show close button in desktop view for collapsing */ @media (min-width: 1001px) { .rpg-thought-close { - display: none !important; + display: flex !important; } } diff --git a/template.html b/template.html index bcfd34a..c01e87e 100644 --- a/template.html +++ b/template.html @@ -948,7 +948,7 @@

Special thanks to all the other contributors for this project:

- Paperboygold, Munimunigamer, Subarashimo, Lilminzyu, Claude (???), IDeathByte, Chungchandev, Joenunezb, and Amauragis. + Paperboygold, Munimunigamer, Subarashimo, Lilminzyu, Claude (???), IDeathByte, Chungchandev, Joenunezb, Amauragis, and Tomt610.