diff --git a/index.js b/index.js
index 9c3f2de..b5ae314 100644
--- a/index.js
+++ b/index.js
@@ -328,12 +328,34 @@ async function initUI() {
toggleAnimations();
});
- $('#rpg-manual-update').on('click', async function() {
+ // Bind to both desktop and mobile refresh buttons
+ $('#rpg-manual-update, #rpg-manual-update-mobile').on('click', async function() {
+ // Get mobile button reference
+ const $mobileBtn = $('#rpg-manual-update-mobile');
+
+ // Skip if we just finished dragging the mobile button
+ if ($mobileBtn.data('just-dragged')) {
+ console.log('[RPG Companion] Click blocked - just finished dragging refresh button');
+ return;
+ }
+
if (!extensionSettings.enabled) {
// console.log('[RPG Companion] Extension is disabled. Please enable it in the Extensions tab.');
return;
}
- await updateRPGData(renderUserStats, renderInfoBox, renderThoughts, renderInventory);
+
+ // Remove focus to prevent sticky black state on mobile
+ $(this).blur();
+
+ // Add spinning animation to mobile button
+ $mobileBtn.addClass('spinning');
+
+ try {
+ await updateRPGData(renderUserStats, renderInfoBox, renderThoughts, renderInventory);
+ } finally {
+ // Remove spinning animation when done
+ $mobileBtn.removeClass('spinning');
+ }
});
// Reset FAB positions button
diff --git a/src/systems/generation/apiClient.js b/src/systems/generation/apiClient.js
index 1f72fa3..e30bec0 100644
--- a/src/systems/generation/apiClient.js
+++ b/src/systems/generation/apiClient.js
@@ -97,16 +97,11 @@ export async function updateRPGData(renderUserStats, renderInfoBox, renderThough
try {
setIsGenerating(true);
- // Update desktop button to show "Updating..." state
+ // Update button to show "Updating..." state
const $updateBtn = $('#rpg-manual-update');
const originalHtml = $updateBtn.html();
$updateBtn.html(' Updating...').prop('disabled', true);
- // Update mobile FAB to show spinner (icon only)
- const $updateBtnMobile = $('#rpg-manual-update-mobile');
- const originalHtmlMobile = $updateBtnMobile.html();
- $updateBtnMobile.html('').prop('disabled', true);
-
// Save current preset name before switching (if we're going to switch)
if (extensionSettings.useSeparatePreset) {
originalPresetName = await getCurrentPresetName();
@@ -224,14 +219,10 @@ export async function updateRPGData(renderUserStats, renderInfoBox, renderThough
setIsGenerating(false);
- // Restore desktop button to original state
+ // Restore button to original state
const $updateBtn = $('#rpg-manual-update');
$updateBtn.html(' Refresh RPG Info').prop('disabled', false);
- // Restore mobile FAB to original state (icon only)
- const $updateBtnMobile = $('#rpg-manual-update-mobile');
- $updateBtnMobile.html('').prop('disabled', false);
-
// Reset the flag after tracker generation completes
// This ensures the flag persists through both main generation AND tracker generation
// console.log('[RPG Companion] 🔄 Tracker generation complete - resetting lastActionWasSwipe to false');
diff --git a/style.css b/style.css
index 5b6bb8a..4499224 100644
--- a/style.css
+++ b/style.css
@@ -3344,6 +3344,24 @@ body:has(.rpg-panel.rpg-position-left) #sheld {
transform: scale(0.95);
}
+/* Spinning animation when refreshing */
+.rpg-mobile-refresh.spinning i {
+ animation: rpg-spin 0.8s linear infinite;
+}
+
+.rpg-mobile-refresh i {
+ pointer-events: none;
+}
+
+@keyframes rpg-spin {
+ from {
+ transform: rotate(0deg);
+ }
+ to {
+ transform: rotate(360deg);
+ }
+}
+
/* Mobile overlay backdrop */
.rpg-mobile-overlay {
display: none;