Compare commits

...

2 commits
v1.2.0 ... main

4 changed files with 16 additions and 2 deletions

View file

@ -9,6 +9,7 @@ export class DevSettingsMenu extends OFTSettingsMenu {
};
static get _SETTINGS() {
if (!categories.has(`dev`)) { return [] };
const devSettings = categories.get(`dev`);
const settingIDs = [];
for (const [settingID, shown] of devSettings.entries()) {

View file

@ -9,6 +9,7 @@ export class HotbarSettingsMenu extends OFTSettingsMenu {
};
static get _SETTINGS() {
if (!categories.has(`hotbar`)) { return [] };
const settings = categories.get(`hotbar`);
const settingIDs = [];
for (const [settingID, shown] of settings.entries()) {

View file

@ -47,6 +47,10 @@ export class OFTSettingsMenu extends HAM(ApplicationV2) {
};
static _SETTINGS = [];
static get isEmpty() {
return this._SETTINGS.length === 0;
};
// #endregion Options
// #region Data Prep

View file

@ -6,11 +6,19 @@ prevent it from being as attention-grabbing compared to being at the top of the
list.
*/
Hooks.on(`renderSettingsConfig`, (app) => {
// MARK: Hide empty menus
for (const [key, config] of game.settings.menus) {
if (!key.startsWith(__ID__)) { continue };
if (config.type.isEmpty) {
const entry = app.element.querySelector(`.form-group:has(button[data-key="${key}"])`);
entry?.remove();
};
};
// MARK: devSettings Menu
/** @type {Node | undefined} */
const settingList = app.element.querySelector(`.tab[data-group="categories"][data-tab="oft"]`);
// MARK: devSettings Menu
/** @type {Node | undefined} */
const devSettingsMenu = app.element.querySelector(`.form-group:has(button[data-key="${__ID__}.devSettings"])`);
if (settingList && devSettingsMenu) {