Fix strip refresh button visibility based on generation mode
This commit is contained in:
@@ -792,6 +792,14 @@ async function initUI() {
|
|||||||
await updateRPGData(renderUserStats, renderInfoBox, renderThoughts, renderInventory);
|
await updateRPGData(renderUserStats, renderInfoBox, renderThoughts, renderInventory);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// Strip widget refresh button - same functionality as main refresh button
|
||||||
|
$('#rpg-strip-refresh').on('click', async function() {
|
||||||
|
if (!extensionSettings.enabled) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
await updateRPGData(renderUserStats, renderInfoBox, renderThoughts, renderInventory);
|
||||||
|
});
|
||||||
|
|
||||||
$('#rpg-stat-bar-color-low').on('change', function() {
|
$('#rpg-stat-bar-color-low').on('change', function() {
|
||||||
extensionSettings.statBarColorLow = String($(this).val());
|
extensionSettings.statBarColorLow = String($(this).val());
|
||||||
saveSettings();
|
saveSettings();
|
||||||
|
|||||||
@@ -35,6 +35,7 @@ import { renderMusicPlayer } from '../rendering/musicPlayer.js';
|
|||||||
import { i18n } from '../../core/i18n.js';
|
import { i18n } from '../../core/i18n.js';
|
||||||
import { generateAvatarsForCharacters } from '../features/avatarGenerator.js';
|
import { generateAvatarsForCharacters } from '../features/avatarGenerator.js';
|
||||||
import { setFabLoadingState, updateFabWidgets } from '../ui/mobile.js';
|
import { setFabLoadingState, updateFabWidgets } from '../ui/mobile.js';
|
||||||
|
import { updateStripWidgets } from '../ui/desktop.js';
|
||||||
|
|
||||||
// Store the original preset name to restore after tracker generation
|
// Store the original preset name to restore after tracker generation
|
||||||
let originalPresetName = null;
|
let originalPresetName = null;
|
||||||
@@ -240,8 +241,10 @@ export async function updateRPGData(renderUserStats, renderInfoBox, renderThough
|
|||||||
|
|
||||||
// Update button to show "Updating..." state
|
// Update button to show "Updating..." state
|
||||||
const $updateBtn = $('#rpg-manual-update');
|
const $updateBtn = $('#rpg-manual-update');
|
||||||
|
const $stripRefreshBtn = $('#rpg-strip-refresh');
|
||||||
const updatingText = i18n.getTranslation('template.mainPanel.updating') || 'Updating...';
|
const updatingText = i18n.getTranslation('template.mainPanel.updating') || 'Updating...';
|
||||||
$updateBtn.html(`<i class="fa-solid fa-spinner fa-spin"></i> ${updatingText}`).prop('disabled', true);
|
$updateBtn.html(`<i class="fa-solid fa-spinner fa-spin"></i> ${updatingText}`).prop('disabled', true);
|
||||||
|
$stripRefreshBtn.html('<i class="fa-solid fa-spinner fa-spin"></i>').prop('disabled', true);
|
||||||
|
|
||||||
const prompt = await generateSeparateUpdatePrompt();
|
const prompt = await generateSeparateUpdatePrompt();
|
||||||
|
|
||||||
@@ -380,11 +383,14 @@ export async function updateRPGData(renderUserStats, renderInfoBox, renderThough
|
|||||||
setIsGenerating(false);
|
setIsGenerating(false);
|
||||||
setFabLoadingState(false); // Stop spinning FAB on mobile
|
setFabLoadingState(false); // Stop spinning FAB on mobile
|
||||||
updateFabWidgets(); // Update FAB widgets with new data
|
updateFabWidgets(); // Update FAB widgets with new data
|
||||||
|
updateStripWidgets(); // Update strip widgets with new data
|
||||||
|
|
||||||
// Restore button to original state
|
// Restore button to original state
|
||||||
const $updateBtn = $('#rpg-manual-update');
|
const $updateBtn = $('#rpg-manual-update');
|
||||||
|
const $stripRefreshBtn = $('#rpg-strip-refresh');
|
||||||
const refreshText = i18n.getTranslation('template.mainPanel.refreshRpgInfo') || 'Refresh RPG Info';
|
const refreshText = i18n.getTranslation('template.mainPanel.refreshRpgInfo') || 'Refresh RPG Info';
|
||||||
$updateBtn.html(`<i class="fa-solid fa-sync"></i> ${refreshText}`).prop('disabled', false);
|
$updateBtn.html(`<i class="fa-solid fa-sync"></i> ${refreshText}`).prop('disabled', false);
|
||||||
|
$stripRefreshBtn.html('<i class="fa-solid fa-sync"></i>').prop('disabled', false);
|
||||||
|
|
||||||
// Reset the flag after tracker generation completes
|
// Reset the flag after tracker generation completes
|
||||||
// This ensures the flag persists through both main generation AND tracker generation
|
// This ensures the flag persists through both main generation AND tracker generation
|
||||||
|
|||||||
@@ -434,6 +434,7 @@ export function updateGenerationModeUI() {
|
|||||||
if (extensionSettings.generationMode === 'together') {
|
if (extensionSettings.generationMode === 'together') {
|
||||||
// In "together" mode, manual update button is hidden
|
// In "together" mode, manual update button is hidden
|
||||||
$('#rpg-manual-update').hide();
|
$('#rpg-manual-update').hide();
|
||||||
|
$('#rpg-strip-refresh').hide();
|
||||||
$('#rpg-external-api-settings').slideUp(200);
|
$('#rpg-external-api-settings').slideUp(200);
|
||||||
$('#rpg-separate-mode-settings').slideUp(200);
|
$('#rpg-separate-mode-settings').slideUp(200);
|
||||||
// Hide auto-update toggle (not applicable in together mode)
|
// Hide auto-update toggle (not applicable in together mode)
|
||||||
@@ -441,6 +442,7 @@ export function updateGenerationModeUI() {
|
|||||||
} else if (extensionSettings.generationMode === 'separate') {
|
} else if (extensionSettings.generationMode === 'separate') {
|
||||||
// In "separate" mode, manual update button is visible
|
// In "separate" mode, manual update button is visible
|
||||||
$('#rpg-manual-update').show();
|
$('#rpg-manual-update').show();
|
||||||
|
$('#rpg-strip-refresh').show();
|
||||||
$('#rpg-external-api-settings').slideUp(200);
|
$('#rpg-external-api-settings').slideUp(200);
|
||||||
$('#rpg-separate-mode-settings').slideDown(200);
|
$('#rpg-separate-mode-settings').slideDown(200);
|
||||||
// Show auto-update toggle
|
// Show auto-update toggle
|
||||||
@@ -448,6 +450,7 @@ export function updateGenerationModeUI() {
|
|||||||
} else if (extensionSettings.generationMode === 'external') {
|
} else if (extensionSettings.generationMode === 'external') {
|
||||||
// In "external" mode, manual update button is visible AND both settings are shown
|
// In "external" mode, manual update button is visible AND both settings are shown
|
||||||
$('#rpg-manual-update').show();
|
$('#rpg-manual-update').show();
|
||||||
|
$('#rpg-strip-refresh').show();
|
||||||
$('#rpg-external-api-settings').slideDown(200);
|
$('#rpg-external-api-settings').slideDown(200);
|
||||||
$('#rpg-separate-mode-settings').slideDown(200);
|
$('#rpg-separate-mode-settings').slideDown(200);
|
||||||
// Show auto-update toggle for external mode too
|
// Show auto-update toggle for external mode too
|
||||||
|
|||||||
@@ -11227,6 +11227,38 @@ body:has(.rpg-panel[data-theme="light"]) .rpg-fab-widget:hover {
|
|||||||
font-family: 'Roboto Mono', 'Consolas', monospace;
|
font-family: 'Roboto Mono', 'Consolas', monospace;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Strip Refresh Button */
|
||||||
|
.rpg-strip-refresh-btn {
|
||||||
|
margin-top: auto;
|
||||||
|
padding: 8px;
|
||||||
|
background: var(--rpg-accent, rgba(22, 33, 62, 0.9));
|
||||||
|
border: 1px solid var(--rpg-border, rgba(100, 150, 255, 0.3));
|
||||||
|
border-radius: 6px;
|
||||||
|
color: var(--rpg-highlight, #4a90e2);
|
||||||
|
cursor: pointer;
|
||||||
|
font-size: 14px;
|
||||||
|
width: calc(100% - 8px);
|
||||||
|
transition: all 0.2s ease;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.rpg-strip-refresh-btn:hover {
|
||||||
|
background: var(--rpg-highlight, #4a90e2);
|
||||||
|
color: var(--rpg-bg, #1a1a2e);
|
||||||
|
box-shadow: 0 0 10px rgba(100, 150, 255, 0.4);
|
||||||
|
}
|
||||||
|
|
||||||
|
.rpg-strip-refresh-btn:disabled {
|
||||||
|
opacity: 0.6;
|
||||||
|
cursor: not-allowed;
|
||||||
|
}
|
||||||
|
|
||||||
|
.rpg-strip-refresh-btn i.fa-spin {
|
||||||
|
animation: fa-spin 1s linear infinite;
|
||||||
|
}
|
||||||
|
|
||||||
/* ============================================
|
/* ============================================
|
||||||
STRIP WIDGET THEME VARIATIONS
|
STRIP WIDGET THEME VARIATIONS
|
||||||
============================================ */
|
============================================ */
|
||||||
|
|||||||
@@ -38,6 +38,10 @@
|
|||||||
<div class="rpg-strip-widget rpg-strip-widget-attributes" data-widget="attributes">
|
<div class="rpg-strip-widget rpg-strip-widget-attributes" data-widget="attributes">
|
||||||
<div class="rpg-strip-attributes-grid"></div>
|
<div class="rpg-strip-attributes-grid"></div>
|
||||||
</div>
|
</div>
|
||||||
|
<!-- Refresh Button (bottom) -->
|
||||||
|
<button id="rpg-strip-refresh" class="rpg-strip-refresh-btn" title="Refresh RPG Info">
|
||||||
|
<i class="fa-solid fa-sync"></i>
|
||||||
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- Main Game Panel -->
|
<!-- Main Game Panel -->
|
||||||
|
|||||||
Reference in New Issue
Block a user