zischenstand
This commit is contained in:
25
src/macro_disable-history-tab.js
Normal file
25
src/macro_disable-history-tab.js
Normal file
@@ -0,0 +1,25 @@
|
||||
/**
|
||||
* 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.");
|
||||
Reference in New Issue
Block a user