refactor(gowlers-tracking-ledger): simplify render hook by removing redundant jQuery tab handlers
- Remove jQuery event listeners for tab switching now handled by onclick attributes - Simplify render hook to focus solely on config button creation - Add debug logging to confirm render hook execution - Reduce potential conflicts between onclick and jQuery handlers - Update version to 0.1.7 Optimizes dialog rendering and improves code clarity. 🤖 Generated with Claude Code Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
|
|
||||||
const MODULE_ID = "gowlers-tracking-ledger";
|
const MODULE_ID = "gowlers-tracking-ledger";
|
||||||
const MODULE_VERSION = "0.1.6";
|
const MODULE_VERSION = "0.1.7";
|
||||||
const TRACK_SETTING = "actorSettings";
|
const TRACK_SETTING = "actorSettings";
|
||||||
const FLAG_SCOPE = "world";
|
const FLAG_SCOPE = "world";
|
||||||
const MAX_HISTORY_ROWS = 100;
|
const MAX_HISTORY_ROWS = 100;
|
||||||
@@ -350,22 +350,7 @@ function openHistoryDialog(actor, initialTab = "hp") {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Tab switching
|
console.log("[GowlersTracking] Dialog render hook called, adding config button...");
|
||||||
$root.find('.history-tab-btn').off('click').on('click', function(e) {
|
|
||||||
e.preventDefault();
|
|
||||||
const tabId = $(this).attr('data-tab-id');
|
|
||||||
console.log("[GowlersTracking] Tab button clicked:", tabId);
|
|
||||||
|
|
||||||
// Remove active from all tabs and hide all panels
|
|
||||||
$root.find('.history-tab-btn').removeClass('active');
|
|
||||||
$root.find('[data-history-panel]').hide();
|
|
||||||
|
|
||||||
// Add active to clicked tab and show its panel
|
|
||||||
$root.find(`.history-tab-btn[data-tab-id="${tabId}"]`).addClass('active');
|
|
||||||
$root.find(`[data-history-panel="${tabId}"]`).show();
|
|
||||||
|
|
||||||
console.log("[GowlersTracking] Panel switched to:", tabId);
|
|
||||||
});
|
|
||||||
|
|
||||||
// Add config icon to dialog header (GM only)
|
// Add config icon to dialog header (GM only)
|
||||||
if (game.user?.isGM) {
|
if (game.user?.isGM) {
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
"type": "module",
|
"type": "module",
|
||||||
"title": "Gowler's Tracking Ledger",
|
"title": "Gowler's Tracking Ledger",
|
||||||
"description": "Adds HP/XP/Currency log buttons to PF1 sheets and opens the tracking dialog preloaded with the actor's logs.",
|
"description": "Adds HP/XP/Currency log buttons to PF1 sheets and opens the tracking dialog preloaded with the actor's logs.",
|
||||||
"version": "0.1.6",
|
"version": "0.1.7",
|
||||||
"authors": [
|
"authors": [
|
||||||
{ "name": "Gowler", "url": "https://foundryvtt.com" }
|
{ "name": "Gowler", "url": "https://foundryvtt.com" }
|
||||||
],
|
],
|
||||||
|
|||||||
Reference in New Issue
Block a user