v3.3.1: Fix Recent Events reading from lastGeneratedData and add desktop thought panel collapse
This commit is contained in:
@@ -7,15 +7,14 @@ An immersive RPG extension for browsers that tracks character stats, scene infor
|
|||||||
|
|
||||||
## 🆕 What's New
|
## 🆕 What's New
|
||||||
|
|
||||||
### v3.3.0
|
### v3.3.1
|
||||||
|
|
||||||
- Small upgrades to the combat system.
|
- Thought bubble can now be collapsed into an icon.
|
||||||
- Regex fix.
|
- Fixed a bug for Past Events being parsed incorrectly.
|
||||||
- Fixed External API logic.
|
- Added event emission on when the tracker generation is complete.
|
||||||
- Even more minor bug fixes.
|
|
||||||
|
|
||||||
**Special thanks to all the other contributors for this project:**
|
**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
|
## 📥 Installation
|
||||||
|
|
||||||
@@ -268,7 +267,7 @@ If you enjoy this extension, consider supporting development:
|
|||||||
## 🙏 Credits
|
## 🙏 Credits
|
||||||
|
|
||||||
**Contributors:**
|
**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
|
## 🚀 Planned Features
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -6,6 +6,6 @@
|
|||||||
"js": "index.js",
|
"js": "index.js",
|
||||||
"css": "style.css",
|
"css": "style.css",
|
||||||
"author": "Marinara",
|
"author": "Marinara",
|
||||||
"version": "3.3.0",
|
"version": "3.3.1",
|
||||||
"homePage": "https://github.com/SpicyMarinara/rpg-companion-sillytavern"
|
"homePage": "https://github.com/SpicyMarinara/rpg-companion-sillytavern"
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-2
@@ -43,12 +43,12 @@
|
|||||||
<i class="fa-solid fa-users"></i> <strong>Contributors:</strong>
|
<i class="fa-solid fa-users"></i> <strong>Contributors:</strong>
|
||||||
</div>
|
</div>
|
||||||
<div style="opacity: 0.8; font-size: 0.9em;">
|
<div style="opacity: 0.8; font-size: 0.9em;">
|
||||||
SpicyMarinara, Paperboygold, Munimunigamer, Subarashimo, Lilminzyu, Claude, IDeathByte, Chungchandev, Joenunezb, and Amauragis.
|
SpicyMarinara, Paperboygold, Munimunigamer, Subarashimo, Lilminzyu, Claude, IDeathByte, Chungchandev, Joenunezb, Amauragis, and Tomt610.
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div style="margin-top: 10px; text-align: center; opacity: 0.6; font-size: 0.85em;">
|
<div style="margin-top: 10px; text-align: center; opacity: 0.6; font-size: 0.85em;">
|
||||||
v3.2.6
|
v3.3.1
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -498,19 +498,19 @@ export function renderInfoBox() {
|
|||||||
if (config?.widgets?.recentEvents?.enabled) {
|
if (config?.widgets?.recentEvents?.enabled) {
|
||||||
// Parse Recent Events from infoBox (supports both JSON and text formats)
|
// Parse Recent Events from infoBox (supports both JSON and text formats)
|
||||||
let recentEvents = [];
|
let recentEvents = [];
|
||||||
if (committedTrackerData.infoBox) {
|
if (infoBoxData) {
|
||||||
// Try JSON format first
|
// Try JSON format first
|
||||||
try {
|
try {
|
||||||
const parsed = typeof committedTrackerData.infoBox === 'string'
|
const parsed = typeof infoBoxData === 'string'
|
||||||
? JSON.parse(committedTrackerData.infoBox)
|
? JSON.parse(infoBoxData)
|
||||||
: committedTrackerData.infoBox;
|
: infoBoxData;
|
||||||
|
|
||||||
if (parsed && Array.isArray(parsed.recentEvents)) {
|
if (parsed && Array.isArray(parsed.recentEvents)) {
|
||||||
recentEvents = parsed.recentEvents;
|
recentEvents = parsed.recentEvents;
|
||||||
}
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
// Fall back to old text format
|
// 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) {
|
if (recentEventsLine) {
|
||||||
const eventsString = recentEventsLine.replace('Recent Events:', '').trim();
|
const eventsString = recentEventsLine.replace('Recent Events:', '').trim();
|
||||||
if (eventsString) {
|
if (eventsString) {
|
||||||
|
|||||||
@@ -1847,9 +1847,9 @@ export function createThoughtPanel($message, thoughtsArray) {
|
|||||||
}, 100);
|
}, 100);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// Desktop: show panel, hide icon with class
|
// Desktop: always start with panel expanded on page load/refresh
|
||||||
$thoughtPanel.css('display', 'block');
|
$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
|
// Handle viewport changes between mobile and desktop
|
||||||
@@ -1880,24 +1880,62 @@ export function createThoughtPanel($message, thoughtsArray) {
|
|||||||
wasMobileView = isMobileNow;
|
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) {
|
$thoughtPanel.find('.rpg-thought-close').on('click touchend', function(e) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
e.stopPropagation();
|
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() {
|
$thoughtPanel.fadeOut(200, function() {
|
||||||
// Make sure icon is visible and clean state when panel closes (use selector, not variable)
|
// Make sure icon is visible and clean state when panel closes (use selector, not variable)
|
||||||
const $icon = $('#rpg-thought-icon');
|
const $icon = $('#rpg-thought-icon');
|
||||||
$icon.removeClass('rpg-hidden dragging');
|
$icon.removeClass('rpg-hidden dragging');
|
||||||
$icon.data('just-dragged', false);
|
$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) {
|
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')) {
|
if ($thoughtIcon.data('just-dragged')) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -1995,3 +2033,4 @@ export function createThoughtPanel($message, thoughtsArray) {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -4732,11 +4732,16 @@ body:has(.rpg-panel.rpg-position-left) #sheld {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Force hide class for desktop mode - overrides media query */
|
/* Force hide class for desktop mode - overrides media query (unless collapsed) */
|
||||||
#rpg-thought-icon.rpg-force-hide {
|
#rpg-thought-icon.rpg-force-hide:not(.rpg-collapsed-desktop) {
|
||||||
display: none !important;
|
display: none !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* When collapsed in desktop, show icon */
|
||||||
|
#rpg-thought-icon.rpg-collapsed-desktop {
|
||||||
|
display: flex !important;
|
||||||
|
}
|
||||||
|
|
||||||
/* Hidden state that allows transitions */
|
/* Hidden state that allows transitions */
|
||||||
#rpg-thought-icon.rpg-hidden {
|
#rpg-thought-icon.rpg-hidden {
|
||||||
opacity: 0;
|
opacity: 0;
|
||||||
@@ -4780,10 +4785,10 @@ body:has(.rpg-panel.rpg-position-left) #sheld {
|
|||||||
color: var(--rpg-highlight, #e94560);
|
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) {
|
@media (min-width: 1001px) {
|
||||||
.rpg-thought-close {
|
.rpg-thought-close {
|
||||||
display: none !important;
|
display: flex !important;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -948,7 +948,7 @@
|
|||||||
|
|
||||||
<h4 style="margin-top: 20px; margin-bottom: 10px;"><strong>Special thanks to all the other contributors for this project:</strong></h4>
|
<h4 style="margin-top: 20px; margin-bottom: 10px;"><strong>Special thanks to all the other contributors for this project:</strong></h4>
|
||||||
<p style="margin-left: 20px; line-height: 1.6;">
|
<p style="margin-left: 20px; line-height: 1.6;">
|
||||||
Paperboygold, Munimunigamer, Subarashimo, Lilminzyu, Claude (???), IDeathByte, Chungchandev, Joenunezb, and Amauragis.
|
Paperboygold, Munimunigamer, Subarashimo, Lilminzyu, Claude (???), IDeathByte, Chungchandev, Joenunezb, Amauragis, and Tomt610.
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<div style="margin-top: 20px; text-align: center;">
|
<div style="margin-top: 20px; text-align: center;">
|
||||||
|
|||||||
Reference in New Issue
Block a user