Files
FoundryVTT/src/macro_disable-history-tab.js
centron\schwoerer f054a31b20 zischenstand
2025-11-14 14:52:43 +01:00

26 lines
815 B
JavaScript

/**
* Remove the History tab hooks added by macro_enable-history-tab.js.
*/
const hooks = game.pf1?.historyTab?.renderHooks ?? (game.pf1?.historyTab?.renderHook ? [{ event: null, id: game.pf1.historyTab.renderHook }] : []);
if (!hooks.length) {
return ui.notifications.info("History tab hooks are not active.");
}
for (const hook of hooks) {
if (!hook) continue;
Hooks.off(hook.event ?? "renderActorSheet", hook.id ?? hook);
}
delete game.pf1.historyTab.renderHooks;
delete game.pf1.historyTab.renderHook;
if (game.pf1.historyTab.observers instanceof Map) {
for (const observer of game.pf1.historyTab.observers.values()) {
observer?.disconnect();
}
delete game.pf1.historyTab.observers;
}
ui.notifications.info("History tab hooks disabled. Close and reopen actor sheets to remove the tab.");