Add some TAF-specific links into the settings sidebar
This commit is contained in:
parent
849da4bb54
commit
8cadd8318b
8 changed files with 122 additions and 4 deletions
|
|
@ -2,7 +2,7 @@ import { __ID__, filePath } from "../consts.mjs";
|
|||
import { createContextMenuOption, deleteItemFromElement, editItemFromElement } from "./utils.mjs";
|
||||
import { config } from "../config.mjs";
|
||||
import { Logger } from "../utils/Logger.mjs";
|
||||
import { TAFDocumentSheetConfig } from "./TAFDocumentSheetConfig.mjs";
|
||||
import { TAFDocumentSheetConfig } from "./overrides/TAFDocumentSheetConfig.mjs";
|
||||
import { TAFDocumentSheetMixin } from "./mixins/TAFDocumentSheetMixin.mjs";
|
||||
import { TAFActor } from "../documents/Actor.mjs";
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
import { __ID__, filePath } from "../consts.mjs";
|
||||
import { getDefaultSizing } from "../utils/getSizing.mjs";
|
||||
import { localizer } from "../utils/localizer.mjs";
|
||||
import { __ID__, filePath } from "../../consts.mjs";
|
||||
import { getDefaultSizing } from "../../utils/getSizing.mjs";
|
||||
import { localizer } from "../../utils/localizer.mjs";
|
||||
|
||||
const { diffObject, expandObject, flattenObject } = foundry.utils;
|
||||
const { DocumentSheetConfig } = foundry.applications.apps;
|
||||
30
module/apps/overrides/TAFSettingsSidebar.mjs
Normal file
30
module/apps/overrides/TAFSettingsSidebar.mjs
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
import { filePath } from "../../consts.mjs";
|
||||
|
||||
const { renderTemplate } = foundry.applications.handlebars;
|
||||
const { Settings } = foundry.applications.sidebar.tabs;
|
||||
|
||||
export class TAFSettingsSidebar extends Settings {
|
||||
// #region Lifecycle
|
||||
async _onRender() {
|
||||
// remove the row from the HTML
|
||||
const systemRow = this.element.querySelector(`.info .system`);
|
||||
systemRow?.remove();
|
||||
|
||||
// add the more customized system info into the sidebar
|
||||
const systemBlock = this.element.querySelector(`section.system`);
|
||||
if (!systemBlock) {
|
||||
const htmlString = await renderTemplate(
|
||||
filePath(`templates/settings-sidebar-addition.hbs`),
|
||||
{ system: game.system, },
|
||||
);
|
||||
|
||||
const temp = document.createElement(`div`);
|
||||
temp.innerHTML = htmlString;
|
||||
const rendered = temp.firstChild;
|
||||
|
||||
const info = this.element.querySelector(`section.info`);
|
||||
info.insertAdjacentElement(`afterend`, rendered);
|
||||
};
|
||||
};
|
||||
// #endregion Lifecycle
|
||||
};
|
||||
Loading…
Add table
Add a link
Reference in a new issue