Compare commits
No commits in common. "main" and "v1.0.0" have entirely different histories.
30 changed files with 60 additions and 619 deletions
|
|
@ -1,2 +0,0 @@
|
||||||
// Hooks
|
|
||||||
import "./hooks/ready.mjs";
|
|
||||||
|
|
@ -1,5 +0,0 @@
|
||||||
import { __ID__ } from "../../module/consts.mjs";
|
|
||||||
|
|
||||||
Hooks.on(`ready`, () => {
|
|
||||||
console.table(game.modules.get(__ID__).api.settings);
|
|
||||||
});
|
|
||||||
|
|
@ -9,10 +9,6 @@
|
||||||
"name": "Auto Unpause On Load",
|
"name": "Auto Unpause On Load",
|
||||||
"hint": "(v13+, GM-Only) Automatically unpauses the game when you load into the world. This will happen EVERY time you load into the world, including if you reload the website."
|
"hint": "(v13+, GM-Only) Automatically unpauses the game when you load into the world. This will happen EVERY time you load into the world, including if you reload the website."
|
||||||
},
|
},
|
||||||
"chatImageLinks": {
|
|
||||||
"name": "Image Shortcuts",
|
|
||||||
"hint": "(v13+) When attempting to send an image/gif in chat, this allows you to easily embed the actual image in the text by changing \"http\"/\"https\" into \"image\", automatically displaying the image after sending the message."
|
|
||||||
},
|
|
||||||
"chatSidebarBackground": {
|
"chatSidebarBackground": {
|
||||||
"name": "Chat Background",
|
"name": "Chat Background",
|
||||||
"hint": "(v13+) Adds a background to the chat tab of the right-hand sidebar."
|
"hint": "(v13+) Adds a background to the chat tab of the right-hand sidebar."
|
||||||
|
|
@ -25,17 +21,9 @@
|
||||||
"name": "Hotbar Button Size",
|
"name": "Hotbar Button Size",
|
||||||
"hint": "(v13+) Changes the size of the hotbar buttons to a size you prefer."
|
"hint": "(v13+) Changes the size of the hotbar buttons to a size you prefer."
|
||||||
},
|
},
|
||||||
"preventMovementHistory": {
|
|
||||||
"name": "Prevent Movement History",
|
|
||||||
"hint": "(v13+, GM-Only) This prevents Foundry from recording movement history of a token, but not disabling the movement ruler."
|
|
||||||
},
|
|
||||||
"preventTokenRotation": {
|
|
||||||
"name": "Prevent Token Auto-Rotation",
|
|
||||||
"hint": "(v13+, GM-Only) This prevents tokens from rotating while you are moving them allowing you to more easily use POG-style tokens without them being rotated automatically by Foundry."
|
|
||||||
},
|
|
||||||
"preventUserConfigOpen": {
|
"preventUserConfigOpen": {
|
||||||
"name": "Prevent Auto User Config",
|
"name": "Prevent Auto User Config",
|
||||||
"hint": "(v13+, Non-GMs) Prevents Foundry from opening the User Configuration when a player loads into the world."
|
"hint": "(v13+) Prevents Foundry from opening the User Configuration when a player loads into the world."
|
||||||
},
|
},
|
||||||
"repositionHotbar": {
|
"repositionHotbar": {
|
||||||
"name": "Reposition Hotbar",
|
"name": "Reposition Hotbar",
|
||||||
|
|
@ -58,37 +46,11 @@
|
||||||
"name": "Developer Settings",
|
"name": "Developer Settings",
|
||||||
"hint": "Tweaks that are relevant if you are developing something within Foundry, but are rarely useful outside of that context.",
|
"hint": "Tweaks that are relevant if you are developing something within Foundry, but are rarely useful outside of that context.",
|
||||||
"label": "Configure Dev Settings"
|
"label": "Configure Dev Settings"
|
||||||
},
|
|
||||||
"hotbarSettings": {
|
|
||||||
"name": "Hotbar Settings",
|
|
||||||
"hint": "Tweaks that modify Foundry's hotbar",
|
|
||||||
"label": "Configure Hotbar"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"keybindings": {
|
|
||||||
"toggleMouseBroadcast": {
|
|
||||||
"name": "Toggle Show Cursor",
|
|
||||||
"hint": "(v13+) Temporarily turns off the mouse cursor position that other players can see. Hides the cursor until you activate this keybind again."
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"apps": {
|
"apps": {
|
||||||
"no-settings-to-display": "No settings to display",
|
"no-settings-to-display": "No settings to display",
|
||||||
"make-global-reference": "Make Global Reference"
|
"make-global-reference": "Make Global Reference"
|
||||||
},
|
|
||||||
"dialogs": {
|
|
||||||
"chatImageLinks": {
|
|
||||||
"didYouKnowImageLink": "",
|
|
||||||
"convertAndDontShowAgain": "",
|
|
||||||
"justConvert": "",
|
|
||||||
"ignoreAndDontShowAgain": "",
|
|
||||||
"disableEntirely": ""
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"notifs": {
|
|
||||||
"toggleMouseBroadcast": {
|
|
||||||
"hidingCursor": "Hiding your cursor from others!",
|
|
||||||
"showingCursor": "Showing your cursor to others!"
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
{
|
{
|
||||||
"id": "oft",
|
"id": "oft",
|
||||||
"title": "Oliver's Foundry Tweaks",
|
"title": "Oliver's Foundry Tweaks",
|
||||||
"version": "1.1.0",
|
"version": "1.0.0",
|
||||||
"authors": [
|
"authors": [
|
||||||
{ "name": "Oliver" }
|
{ "name": "Oliver" }
|
||||||
],
|
],
|
||||||
|
|
@ -14,8 +14,7 @@
|
||||||
"maximum": 13
|
"maximum": 13
|
||||||
},
|
},
|
||||||
"esmodules": [
|
"esmodules": [
|
||||||
"module/oft.mjs",
|
"module/oft.mjs"
|
||||||
"dev/dev.mjs"
|
|
||||||
],
|
],
|
||||||
"styles": [
|
"styles": [
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
import { categories } from "../utils/SubMenuSettings.mjs";
|
import { devSettings } from "../utils/DevSettings.mjs";
|
||||||
import { OFTSettingsMenu } from "./OFTSettingsMenu.mjs";
|
import { OFTSettingsMenu } from "./OFTSettingsMenu.mjs";
|
||||||
|
|
||||||
export class DevSettingsMenu extends OFTSettingsMenu {
|
export class DevSettingsMenu extends OFTSettingsMenu {
|
||||||
|
|
@ -9,7 +9,6 @@ export class DevSettingsMenu extends OFTSettingsMenu {
|
||||||
};
|
};
|
||||||
|
|
||||||
static get _SETTINGS() {
|
static get _SETTINGS() {
|
||||||
const devSettings = categories.get(`dev`);
|
|
||||||
const settingIDs = [];
|
const settingIDs = [];
|
||||||
for (const [settingID, shown] of devSettings.entries()) {
|
for (const [settingID, shown] of devSettings.entries()) {
|
||||||
if (shown) {
|
if (shown) {
|
||||||
|
|
|
||||||
|
|
@ -1,21 +0,0 @@
|
||||||
import { categories } from "../utils/SubMenuSettings.mjs";
|
|
||||||
import { OFTSettingsMenu } from "./OFTSettingsMenu.mjs";
|
|
||||||
|
|
||||||
export class HotbarSettingsMenu extends OFTSettingsMenu {
|
|
||||||
static DEFAULT_OPTIONS = {
|
|
||||||
window: {
|
|
||||||
title: `OFT.menu.hotbarSettings.name`,
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
||||||
static get _SETTINGS() {
|
|
||||||
const settings = categories.get(`hotbar`);
|
|
||||||
const settingIDs = [];
|
|
||||||
for (const [settingID, shown] of settings.entries()) {
|
|
||||||
if (shown) {
|
|
||||||
settingIDs.push(settingID);
|
|
||||||
};
|
|
||||||
};
|
|
||||||
return settingIDs;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
import { __ID__, filePath } from "../consts.mjs";
|
import { filePath } from "../consts.mjs";
|
||||||
|
|
||||||
const { HandlebarsApplicationMixin: HAM, ApplicationV2 } = foundry.applications.api;
|
const { HandlebarsApplicationMixin: HAM, ApplicationV2 } = foundry.applications.api;
|
||||||
|
|
||||||
|
|
@ -7,7 +7,6 @@ export class OFTSettingsMenu extends HAM(ApplicationV2) {
|
||||||
// #region Options
|
// #region Options
|
||||||
static DEFAULT_OPTIONS = {
|
static DEFAULT_OPTIONS = {
|
||||||
tag: `form`,
|
tag: `form`,
|
||||||
classes: [ __ID__ ],
|
|
||||||
window: {
|
window: {
|
||||||
icon: `fa-solid fa-gears`,
|
icon: `fa-solid fa-gears`,
|
||||||
resizable: true,
|
resizable: true,
|
||||||
|
|
|
||||||
|
|
@ -1,19 +0,0 @@
|
||||||
// Settings
|
|
||||||
import { preventMovementHistory } from "../settings/preventMovementHistory.mjs";
|
|
||||||
import { toggleMouseBroadcast } from "../settings/toggleMouseBroadcast.mjs";
|
|
||||||
|
|
||||||
// Utils
|
|
||||||
import { Logger } from "../utils/Logger.mjs";
|
|
||||||
|
|
||||||
/*
|
|
||||||
This is only here for setting that **require** being registered during
|
|
||||||
initialization due to documentClass changes. If there is any way that
|
|
||||||
these settings can be implemented to work during the setup hook, that is
|
|
||||||
where they ideally should be implemented.
|
|
||||||
*/
|
|
||||||
Hooks.on(`init`, () => {
|
|
||||||
Logger.log(`Initializing`);
|
|
||||||
|
|
||||||
preventMovementHistory();
|
|
||||||
toggleMouseBroadcast();
|
|
||||||
});
|
|
||||||
|
|
@ -5,8 +5,7 @@ of incompatabilities for whatever reason. This can also be used
|
||||||
internally within this module if we discover incompatabilites with
|
internally within this module if we discover incompatabilites with
|
||||||
systems and want to disable it on our side.
|
systems and want to disable it on our side.
|
||||||
|
|
||||||
This file is meant more documentation than anything at this point in
|
This file is more as documentation than anything at this point in time.
|
||||||
time.
|
|
||||||
|
|
||||||
Call Signature: (settingKey: string) => (void | boolean)
|
Call Signature: (settingKey: string) => {}
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
|
|
@ -1,13 +0,0 @@
|
||||||
/*
|
|
||||||
This hook is used to enable any modules that attempt to disable settings
|
|
||||||
or just want to investigate what settings are enabled to be able to get
|
|
||||||
a ping with information about which settings where registered entirely
|
|
||||||
and which weren't. The object that is passed to this is frozen and is
|
|
||||||
not meant to be edited as you cannot de-register nor prevent setting
|
|
||||||
registration from this hook. For that see the "oft.preventSetting" hook.
|
|
||||||
|
|
||||||
This file is meant more documentation than anything at this point in
|
|
||||||
time.
|
|
||||||
|
|
||||||
Call Signature: (settings: Record<string, boolean>) => void
|
|
||||||
*/
|
|
||||||
|
|
@ -1,58 +0,0 @@
|
||||||
// Settings
|
|
||||||
import { addGlobalDocReferrer } from "../settings/addGlobalDocReferrer.mjs";
|
|
||||||
import { autoUnpauseOnLoad } from "../settings/autoUnpauseOnLoad.mjs";
|
|
||||||
import { chatImageLinks } from "../settings/chatImageLinks.mjs";
|
|
||||||
import { chatSidebarBackground } from "../settings/chatSidebarBackground.mjs";
|
|
||||||
import { hotbarButtonGap } from "../settings/hotbarButtonGap.mjs";
|
|
||||||
import { hotbarButtonSize } from "../settings/hotbarButtonSize.mjs";
|
|
||||||
import { preventTokenRotation } from "../settings/preventTokenRotation.mjs";
|
|
||||||
import { preventUserConfigOpen } from "../settings/preventUserConfigOpen.mjs";
|
|
||||||
import { repositionHotbar } from "../settings/repositionHotbar.mjs";
|
|
||||||
import { startingSidebarTab } from "../settings/startingSidebarTab.mjs";
|
|
||||||
import { startSidebarExpanded } from "../settings/startSidebarExpanded.mjs";
|
|
||||||
|
|
||||||
// Apps
|
|
||||||
import { DevSettingsMenu } from "../apps/DevSettingsMenu.mjs";
|
|
||||||
import { HotbarSettingsMenu } from "../apps/HotbarSettingsMenu.mjs";
|
|
||||||
|
|
||||||
// Misc
|
|
||||||
import { __ID__ } from "../consts.mjs";
|
|
||||||
import { status } from "../utils/SettingStatus.mjs";
|
|
||||||
|
|
||||||
const { deepFreeze } = foundry.utils;
|
|
||||||
|
|
||||||
Hooks.on(`setup`, () => {
|
|
||||||
|
|
||||||
game.settings.registerMenu(__ID__, `devSettings`, {
|
|
||||||
name: `OFT.menu.devSettings.name`,
|
|
||||||
hint: `OFT.menu.devSettings.hint`,
|
|
||||||
label: `OFT.menu.devSettings.label`,
|
|
||||||
restricted: false,
|
|
||||||
type: DevSettingsMenu,
|
|
||||||
});
|
|
||||||
addGlobalDocReferrer();
|
|
||||||
autoUnpauseOnLoad();
|
|
||||||
|
|
||||||
game.settings.registerMenu(__ID__, `hotbarSettings`, {
|
|
||||||
name: `OFT.menu.hotbarSettings.name`,
|
|
||||||
hint: `OFT.menu.hotbarSettings.hint`,
|
|
||||||
label: `OFT.menu.hotbarSettings.label`,
|
|
||||||
restricted: false,
|
|
||||||
type: HotbarSettingsMenu,
|
|
||||||
});
|
|
||||||
hotbarButtonSize();
|
|
||||||
hotbarButtonGap();
|
|
||||||
repositionHotbar();
|
|
||||||
|
|
||||||
chatImageLinks();
|
|
||||||
chatSidebarBackground();
|
|
||||||
startSidebarExpanded();
|
|
||||||
startingSidebarTab();
|
|
||||||
preventTokenRotation();
|
|
||||||
preventUserConfigOpen();
|
|
||||||
|
|
||||||
Hooks.callAll(`oft.settingStatuses`, deepFreeze(status));
|
|
||||||
game.modules.get(__ID__).api = deepFreeze({
|
|
||||||
settings: status,
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
@ -1,4 +1,40 @@
|
||||||
// Hooks
|
// Hooks
|
||||||
import "./hooks/init.mjs";
|
|
||||||
import "./hooks/setup.mjs";
|
|
||||||
import "./hooks/renderSettingsConfig.mjs";
|
import "./hooks/renderSettingsConfig.mjs";
|
||||||
|
|
||||||
|
// Settings
|
||||||
|
import { addGlobalDocReferrer } from "./settings/addGlobalDocReferrer.mjs";
|
||||||
|
import { autoUnpauseOnLoad } from "./settings/autoUnpauseOnLoad.mjs";
|
||||||
|
import { chatSidebarBackground } from "./settings/chatSidebarBackground.mjs";
|
||||||
|
import { hotbarButtonGap } from "./settings/hotbarButtonGap.mjs";
|
||||||
|
import { hotbarButtonSize } from "./settings/hotbarButtonSize.mjs";
|
||||||
|
import { preventUserConfigOpen } from "./settings/preventUserConfigOpen.mjs";
|
||||||
|
import { repositionHotbar } from "./settings/repositionHotbar.mjs";
|
||||||
|
import { startingSidebarTab } from "./settings/startingSidebarTab.mjs";
|
||||||
|
import { startSidebarExpanded } from "./settings/startSidebarExpanded.mjs";
|
||||||
|
|
||||||
|
// Apps
|
||||||
|
import { DevSettingsMenu } from "./apps/DevSettingsMenu.mjs";
|
||||||
|
|
||||||
|
// Misc
|
||||||
|
import { __ID__ } from "./consts.mjs";
|
||||||
|
|
||||||
|
Hooks.on(`setup`, () => {
|
||||||
|
|
||||||
|
game.settings.registerMenu(__ID__, `devSettings`, {
|
||||||
|
name: `OFT.menu.devSettings.name`,
|
||||||
|
hint: `OFT.menu.devSettings.hint`,
|
||||||
|
label: `OFT.menu.devSettings.label`,
|
||||||
|
restricted: false,
|
||||||
|
type: DevSettingsMenu,
|
||||||
|
});
|
||||||
|
addGlobalDocReferrer();
|
||||||
|
autoUnpauseOnLoad();
|
||||||
|
|
||||||
|
chatSidebarBackground();
|
||||||
|
startSidebarExpanded();
|
||||||
|
startingSidebarTab();
|
||||||
|
hotbarButtonSize();
|
||||||
|
hotbarButtonGap();
|
||||||
|
repositionHotbar();
|
||||||
|
preventUserConfigOpen();
|
||||||
|
});
|
||||||
|
|
|
||||||
|
|
@ -1,12 +1,10 @@
|
||||||
import { SettingStatusEnum, status } from "../utils/SettingStatus.mjs";
|
|
||||||
import { __ID__ } from "../consts.mjs";
|
import { __ID__ } from "../consts.mjs";
|
||||||
import { Logger } from "../utils/Logger.mjs";
|
import { Logger } from "../utils/Logger.mjs";
|
||||||
import { registerDevSetting } from "../utils/SubMenuSettings.mjs";
|
import { registerDevSetting } from "../utils/DevSettings.mjs";
|
||||||
|
|
||||||
const key = `addGlobalDocReferrer`;
|
const key = `addGlobalDocReferrer`;
|
||||||
|
|
||||||
export function addGlobalDocReferrer() {
|
export function addGlobalDocReferrer() {
|
||||||
status[key] = SettingStatusEnum.Unknown;
|
|
||||||
|
|
||||||
// #region Registration
|
// #region Registration
|
||||||
Logger.log(`Registering setting: ${key}`);
|
Logger.log(`Registering setting: ${key}`);
|
||||||
|
|
@ -35,5 +33,4 @@ export function addGlobalDocReferrer() {
|
||||||
});
|
});
|
||||||
// #endregion Implementation
|
// #endregion Implementation
|
||||||
|
|
||||||
status[key] = SettingStatusEnum.Registered;
|
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -1,17 +1,14 @@
|
||||||
import { SettingStatusEnum, status } from "../utils/SettingStatus.mjs";
|
|
||||||
import { __ID__ } from "../consts.mjs";
|
import { __ID__ } from "../consts.mjs";
|
||||||
import { Logger } from "../utils/Logger.mjs";
|
import { Logger } from "../utils/Logger.mjs";
|
||||||
import { registerDevSetting } from "../utils/SubMenuSettings.mjs";
|
import { registerDevSetting } from "../utils/DevSettings.mjs";
|
||||||
|
|
||||||
const key = `autoUnpauseOnLoad`;
|
const key = `autoUnpauseOnLoad`;
|
||||||
|
|
||||||
export function autoUnpauseOnLoad() {
|
export function autoUnpauseOnLoad() {
|
||||||
status[key] = SettingStatusEnum.Unknown;
|
|
||||||
|
|
||||||
const prevented = Hooks.call(`${__ID__}.preventSetting`, key);
|
const prevented = Hooks.call(`${__ID__}.preventSetting`, key);
|
||||||
if (!prevented) {
|
if (!prevented) {
|
||||||
Logger.log(`Preventing setting "${key}" from being registered`);
|
Logger.log(`Preventing setting "${key}" from being registered`);
|
||||||
status[key] = SettingStatusEnum.Blocked;
|
|
||||||
return;
|
return;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -37,6 +34,4 @@ export function autoUnpauseOnLoad() {
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
// #endregion Implementation
|
// #endregion Implementation
|
||||||
|
|
||||||
status[key] = SettingStatusEnum.Registered;
|
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -1,130 +0,0 @@
|
||||||
import { SettingStatusEnum, status } from "../utils/SettingStatus.mjs";
|
|
||||||
import { __ID__ } from "../consts.mjs";
|
|
||||||
import { Logger } from "../utils/Logger.mjs";
|
|
||||||
|
|
||||||
const { DialogV2 } = foundry.applications.api;
|
|
||||||
|
|
||||||
const key = `chatImageLinks`;
|
|
||||||
const IMAGE_TYPES = [
|
|
||||||
`png`,
|
|
||||||
`jpg`,
|
|
||||||
`jpeg`,
|
|
||||||
`webp`,
|
|
||||||
`svg`,
|
|
||||||
];
|
|
||||||
|
|
||||||
export function chatImageLinks() {
|
|
||||||
status[key] = SettingStatusEnum.Unknown;
|
|
||||||
|
|
||||||
const prevented = Hooks.call(`${__ID__}.preventSetting`, key);
|
|
||||||
if (!prevented) {
|
|
||||||
Logger.log(`Preventing setting "${key}" from being registered`);
|
|
||||||
status[key] = SettingStatusEnum.Blocked;
|
|
||||||
return;
|
|
||||||
};
|
|
||||||
|
|
||||||
// #region Registration
|
|
||||||
Logger.log(`Registering setting: ${key}`);
|
|
||||||
game.settings.register(__ID__, key, {
|
|
||||||
name: `OFT.setting.${key}.name`,
|
|
||||||
hint: `OFT.setting.${key}.hint`,
|
|
||||||
scope: `user`,
|
|
||||||
type: Boolean,
|
|
||||||
default: true,
|
|
||||||
config: true,
|
|
||||||
requiresReload: true,
|
|
||||||
});
|
|
||||||
|
|
||||||
game.settings.register(__ID__, key + `-showPromptAgain`, {
|
|
||||||
scope: `user`,
|
|
||||||
type: Boolean,
|
|
||||||
default: true,
|
|
||||||
config: false,
|
|
||||||
});
|
|
||||||
// #endregion Registration
|
|
||||||
|
|
||||||
// #region Implementation
|
|
||||||
if (game.settings.get(__ID__, key)) {
|
|
||||||
Logger.log(`setting:${key} | Adding text enricher`);
|
|
||||||
|
|
||||||
// MARK: Enricher
|
|
||||||
const pattern = new RegExp(
|
|
||||||
`(?<!=|")(image:\\/\\/.*\\.(?:${IMAGE_TYPES.join(`|`)}))`,
|
|
||||||
`gi`,
|
|
||||||
);
|
|
||||||
|
|
||||||
CONFIG.TextEditor.enrichers.push({
|
|
||||||
pattern,
|
|
||||||
replaceParent: true,
|
|
||||||
enricher: async (url) => {
|
|
||||||
Logger.debug(url);
|
|
||||||
url = url[0].replace(/^image:\/\//, ``);
|
|
||||||
const secure = `https://${url}`;
|
|
||||||
const insecure = `http://${url}`;
|
|
||||||
|
|
||||||
if (await isAcceptableImage(secure)) {
|
|
||||||
const img = document.createElement(`img`);
|
|
||||||
img.src = secure;
|
|
||||||
img.alt = secure;
|
|
||||||
return img;
|
|
||||||
};
|
|
||||||
|
|
||||||
if (await isAcceptableImage(insecure)) {
|
|
||||||
const img = document.createElement(`img`);
|
|
||||||
img.src = insecure;
|
|
||||||
img.alt = insecure;
|
|
||||||
return img;
|
|
||||||
};
|
|
||||||
|
|
||||||
return null;
|
|
||||||
},
|
|
||||||
});
|
|
||||||
|
|
||||||
// MARK: Chat Input
|
|
||||||
// Hooks.on(`chatMessage`, (chatLog, message, options) => {
|
|
||||||
// if (!game.settings.get(__ID__, key)) { return };
|
|
||||||
|
|
||||||
// const match = message.match(pattern);
|
|
||||||
// if (!match) { return };
|
|
||||||
|
|
||||||
// DialogV2.wait({
|
|
||||||
// rejectClose: false,
|
|
||||||
// content: game.i18n.localize(`OFT.dialogs.chatImageLinks.didYouKnowImageLink`),
|
|
||||||
// buttons: [
|
|
||||||
// { action: ``, label: `OFT.dialogs.chatImageLinks.convertAndDontShowAgain` },
|
|
||||||
// { action: ``, label: `OFT.dialogs.chatImageLinks.justConvert` },
|
|
||||||
// { action: ``, label: `OFT.dialogs.chatImageLinks.ignoreAndDontShowAgain` },
|
|
||||||
// { action: ``, label: `OFT.dialogs.chatImageLinks.disableEntirely` },
|
|
||||||
// ],
|
|
||||||
// })
|
|
||||||
// .then((selected) => {
|
|
||||||
// chatLog.processMessage(message, options);
|
|
||||||
// });
|
|
||||||
|
|
||||||
// return false;
|
|
||||||
// });
|
|
||||||
}
|
|
||||||
// #endregion Implementation
|
|
||||||
|
|
||||||
status[key] = SettingStatusEnum.Registered;
|
|
||||||
};
|
|
||||||
|
|
||||||
// #region Helpers
|
|
||||||
async function isAcceptableImage(url) {
|
|
||||||
try {
|
|
||||||
const response = await fetch(url, { method: `HEAD` });
|
|
||||||
const contentType = response.headers.get(`Content-Type`);
|
|
||||||
Logger.debug(`Image data:`, { url, contentType });
|
|
||||||
let [ superType, subtype ] = contentType.split(`/`);
|
|
||||||
if (superType !== `image`) {
|
|
||||||
return false;
|
|
||||||
};
|
|
||||||
if (subtype.includes(`+`)) {
|
|
||||||
subtype = subtype.split(`+`, 2).at(0);
|
|
||||||
};
|
|
||||||
return IMAGE_TYPES.includes(subtype);
|
|
||||||
} catch {
|
|
||||||
return false;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
// #endregion Helpers
|
|
||||||
|
|
@ -1,11 +1,9 @@
|
||||||
import { SettingStatusEnum, status } from "../utils/SettingStatus.mjs";
|
|
||||||
import { __ID__ } from "../consts.mjs";
|
import { __ID__ } from "../consts.mjs";
|
||||||
import { Logger } from "../utils/Logger.mjs";
|
import { Logger } from "../utils/Logger.mjs";
|
||||||
|
|
||||||
const key = `chatSidebarBackground`;
|
const key = `chatSidebarBackground`;
|
||||||
|
|
||||||
export function chatSidebarBackground() {
|
export function chatSidebarBackground() {
|
||||||
status[key] = SettingStatusEnum.Unknown;
|
|
||||||
|
|
||||||
// #region Registration
|
// #region Registration
|
||||||
Logger.log(`Registering setting: ${key}`);
|
Logger.log(`Registering setting: ${key}`);
|
||||||
|
|
@ -30,6 +28,4 @@ export function chatSidebarBackground() {
|
||||||
document.body.classList.add(`${__ID__}-${key}`);
|
document.body.classList.add(`${__ID__}-${key}`);
|
||||||
};
|
};
|
||||||
// #endregion Implementation
|
// #endregion Implementation
|
||||||
|
|
||||||
status[key] = SettingStatusEnum.Registered;
|
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -1,24 +1,20 @@
|
||||||
import { SettingStatusEnum, status } from "../utils/SettingStatus.mjs";
|
|
||||||
import { __ID__ } from "../consts.mjs";
|
import { __ID__ } from "../consts.mjs";
|
||||||
import { Logger } from "../utils/Logger.mjs";
|
import { Logger } from "../utils/Logger.mjs";
|
||||||
import { registerCategorySetting } from "../utils/SubMenuSettings.mjs";
|
|
||||||
|
|
||||||
const key = `hotbarButtonGap`;
|
const key = `hotbarButtonGap`;
|
||||||
|
|
||||||
export function hotbarButtonGap() {
|
export function hotbarButtonGap() {
|
||||||
status[key] = SettingStatusEnum.Unknown;
|
|
||||||
|
|
||||||
const prevented = Hooks.call(`${__ID__}.preventSetting`, key);
|
const prevented = Hooks.call(`${__ID__}.preventSetting`, key);
|
||||||
if (!prevented) {
|
if (!prevented) {
|
||||||
Logger.log(`Preventing setting "${key}" from being registered`);
|
Logger.log(`Preventing setting "${key}" from being registered`);
|
||||||
status[key] = SettingStatusEnum.Blocked;
|
|
||||||
return;
|
return;
|
||||||
};
|
};
|
||||||
|
|
||||||
// #region Registration
|
// #region Registration
|
||||||
Logger.log(`Registering setting: ${key}`);
|
Logger.log(`Registering setting: ${key}`);
|
||||||
document.body.classList.add(`${__ID__}-${key}`);
|
document.body.classList.add(`${__ID__}-${key}`);
|
||||||
registerCategorySetting(`hotbar`, __ID__, key, {
|
game.settings.register(__ID__, key, {
|
||||||
name: `OFT.setting.${key}.name`,
|
name: `OFT.setting.${key}.name`,
|
||||||
hint: `OFT.setting.${key}.hint`,
|
hint: `OFT.setting.${key}.hint`,
|
||||||
scope: `user`,
|
scope: `user`,
|
||||||
|
|
@ -40,6 +36,4 @@ export function hotbarButtonGap() {
|
||||||
const buttonGap = game.settings.get(__ID__, key);
|
const buttonGap = game.settings.get(__ID__, key);
|
||||||
document.body.style.setProperty(`--hotbar-button-gap`, `${buttonGap}px`);
|
document.body.style.setProperty(`--hotbar-button-gap`, `${buttonGap}px`);
|
||||||
// #endregion Implementation
|
// #endregion Implementation
|
||||||
|
|
||||||
status[key] = SettingStatusEnum.Registered;
|
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -1,24 +1,20 @@
|
||||||
import { SettingStatusEnum, status } from "../utils/SettingStatus.mjs";
|
|
||||||
import { __ID__ } from "../consts.mjs";
|
import { __ID__ } from "../consts.mjs";
|
||||||
import { Logger } from "../utils/Logger.mjs";
|
import { Logger } from "../utils/Logger.mjs";
|
||||||
import { registerCategorySetting } from "../utils/SubMenuSettings.mjs";
|
|
||||||
|
|
||||||
const key = `hotbarButtonSize`;
|
const key = `hotbarButtonSize`;
|
||||||
|
|
||||||
export function hotbarButtonSize() {
|
export function hotbarButtonSize() {
|
||||||
status[key] = SettingStatusEnum.Unknown;
|
|
||||||
|
|
||||||
const prevented = Hooks.call(`${__ID__}.preventSetting`, key);
|
const prevented = Hooks.call(`${__ID__}.preventSetting`, key);
|
||||||
if (!prevented) {
|
if (!prevented) {
|
||||||
Logger.log(`Preventing setting "${key}" from being registered`);
|
Logger.log(`Preventing setting "${key}" from being registered`);
|
||||||
status[key] = SettingStatusEnum.Blocked;
|
|
||||||
return;
|
return;
|
||||||
};
|
};
|
||||||
|
|
||||||
// #region Registration
|
// #region Registration
|
||||||
Logger.log(`Registering setting: ${key}`);
|
Logger.log(`Registering setting: ${key}`);
|
||||||
document.body.classList.add(`${__ID__}-${key}`);
|
document.body.classList.add(`${__ID__}-${key}`);
|
||||||
registerCategorySetting(`hotbar`, __ID__, key, {
|
game.settings.register(__ID__, key, {
|
||||||
name: `OFT.setting.${key}.name`,
|
name: `OFT.setting.${key}.name`,
|
||||||
hint: `OFT.setting.${key}.hint`,
|
hint: `OFT.setting.${key}.hint`,
|
||||||
scope: `user`,
|
scope: `user`,
|
||||||
|
|
@ -40,6 +36,4 @@ export function hotbarButtonSize() {
|
||||||
const hotbarSize = game.settings.get(__ID__, key);
|
const hotbarSize = game.settings.get(__ID__, key);
|
||||||
document.body.style.setProperty(`--hotbar-size`, `${hotbarSize}px`);
|
document.body.style.setProperty(`--hotbar-size`, `${hotbarSize}px`);
|
||||||
// #endregion Implementation
|
// #endregion Implementation
|
||||||
|
|
||||||
status[key] = SettingStatusEnum.Registered;
|
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -1,42 +0,0 @@
|
||||||
import { SettingStatusEnum, status } from "../utils/SettingStatus.mjs";
|
|
||||||
import { __ID__ } from "../consts.mjs";
|
|
||||||
import { Logger } from "../utils/Logger.mjs";
|
|
||||||
|
|
||||||
const key = `preventMovementHistory`;
|
|
||||||
|
|
||||||
export function preventMovementHistory() {
|
|
||||||
status[key] = SettingStatusEnum.Unknown;
|
|
||||||
|
|
||||||
const prevented = Hooks.call(`${__ID__}.preventSetting`, key);
|
|
||||||
if (!prevented) {
|
|
||||||
Logger.log(`Preventing setting "${key}" from being registered`);
|
|
||||||
status[key] = SettingStatusEnum.Blocked;
|
|
||||||
return;
|
|
||||||
};
|
|
||||||
|
|
||||||
// #region Registration
|
|
||||||
Logger.log(`Registering setting: ${key}`);
|
|
||||||
game.settings.register(__ID__, key, {
|
|
||||||
name: `OFT.setting.${key}.name`,
|
|
||||||
hint: `OFT.setting.${key}.hint`,
|
|
||||||
scope: `world`,
|
|
||||||
type: Boolean,
|
|
||||||
default: false,
|
|
||||||
config: true,
|
|
||||||
reloadRequired: true,
|
|
||||||
});
|
|
||||||
// #endregion Registration
|
|
||||||
|
|
||||||
// #region Implementation
|
|
||||||
if (game.settings.get(__ID__, key)) {
|
|
||||||
class OFTTokenDocument extends CONFIG.Token.documentClass {
|
|
||||||
_shouldRecordMovementHistory() {
|
|
||||||
return false;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
CONFIG.Token.documentClass = OFTTokenDocument;
|
|
||||||
};
|
|
||||||
// #endregion Implementation
|
|
||||||
|
|
||||||
status[key] = SettingStatusEnum.Registered;
|
|
||||||
};
|
|
||||||
|
|
@ -1,53 +0,0 @@
|
||||||
import { SettingStatusEnum, status } from "../utils/SettingStatus.mjs";
|
|
||||||
import { __ID__ } from "../consts.mjs";
|
|
||||||
import { Logger } from "../utils/Logger.mjs";
|
|
||||||
|
|
||||||
const key = `preventTokenRotation`;
|
|
||||||
|
|
||||||
export function preventTokenRotation() {
|
|
||||||
status[key] = SettingStatusEnum.Unknown;
|
|
||||||
|
|
||||||
const prevented = Hooks.call(`${__ID__}.preventSetting`, key);
|
|
||||||
if (!prevented) {
|
|
||||||
Logger.log(`Preventing setting "${key}" from being registered`);
|
|
||||||
status[key] = SettingStatusEnum.Blocked;
|
|
||||||
return;
|
|
||||||
};
|
|
||||||
|
|
||||||
/** @type {number|null} */
|
|
||||||
let hookID = null;
|
|
||||||
|
|
||||||
// #region Registration
|
|
||||||
Logger.log(`Registering setting: ${key}`);
|
|
||||||
game.settings.register(__ID__, key, {
|
|
||||||
name: `OFT.setting.${key}.name`,
|
|
||||||
hint: `OFT.setting.${key}.hint`,
|
|
||||||
scope: `world`,
|
|
||||||
type: Boolean,
|
|
||||||
default: true,
|
|
||||||
config: true,
|
|
||||||
requiresReload: false,
|
|
||||||
onChange: (newValue) => {
|
|
||||||
if (newValue) {
|
|
||||||
hookID = Hooks.on(`preMoveToken`, preMoveTokenHandler);
|
|
||||||
} else if (hookID != null) {
|
|
||||||
Hooks.off(`preMoveToken`, hookID);
|
|
||||||
};
|
|
||||||
},
|
|
||||||
});
|
|
||||||
// #endregion Registration
|
|
||||||
|
|
||||||
// #region Implementation
|
|
||||||
if (game.settings.get(__ID__, key)) {
|
|
||||||
hookID = Hooks.on(`preMoveToken`, preMoveTokenHandler);
|
|
||||||
};
|
|
||||||
// #endregion Implementation
|
|
||||||
|
|
||||||
status[key] = SettingStatusEnum.Registered;
|
|
||||||
};
|
|
||||||
|
|
||||||
// #region Helpers
|
|
||||||
function preMoveTokenHandler(_token, update) {
|
|
||||||
update.autoRotate = false;
|
|
||||||
};
|
|
||||||
// #endregion Helpers
|
|
||||||
|
|
@ -1,16 +1,13 @@
|
||||||
import { SettingStatusEnum, status } from "../utils/SettingStatus.mjs";
|
|
||||||
import { __ID__ } from "../consts.mjs";
|
import { __ID__ } from "../consts.mjs";
|
||||||
import { Logger } from "../utils/Logger.mjs";
|
import { Logger } from "../utils/Logger.mjs";
|
||||||
|
|
||||||
const key = `preventUserConfigOpen`;
|
const key = `preventUserConfigOpen`;
|
||||||
|
|
||||||
export function preventUserConfigOpen() {
|
export function preventUserConfigOpen() {
|
||||||
status[key] = SettingStatusEnum.Unknown;
|
|
||||||
|
|
||||||
const prevented = Hooks.call(`${__ID__}.preventSetting`, key);
|
const prevented = Hooks.call(`${__ID__}.preventSetting`, key);
|
||||||
if (!prevented) {
|
if (!prevented) {
|
||||||
Logger.log(`Preventing setting "${key}" from being registered`);
|
Logger.log(`Preventing setting "${key}" from being registered`);
|
||||||
status[key] = SettingStatusEnum.Blocked;
|
|
||||||
return;
|
return;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -22,7 +19,7 @@ export function preventUserConfigOpen() {
|
||||||
scope: `user`,
|
scope: `user`,
|
||||||
type: Boolean,
|
type: Boolean,
|
||||||
default: false,
|
default: false,
|
||||||
config: !game.user.isGM,
|
config: true,
|
||||||
requiresReload: false,
|
requiresReload: false,
|
||||||
});
|
});
|
||||||
// #endregion Registration
|
// #endregion Registration
|
||||||
|
|
@ -35,6 +32,4 @@ export function preventUserConfigOpen() {
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
// #endregion Implementation
|
// #endregion Implementation
|
||||||
|
|
||||||
status[key] = SettingStatusEnum.Registered;
|
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -1,23 +1,19 @@
|
||||||
import { SettingStatusEnum, status } from "../utils/SettingStatus.mjs";
|
|
||||||
import { __ID__ } from "../consts.mjs";
|
import { __ID__ } from "../consts.mjs";
|
||||||
import { Logger } from "../utils/Logger.mjs";
|
import { Logger } from "../utils/Logger.mjs";
|
||||||
import { registerCategorySetting } from "../utils/SubMenuSettings.mjs";
|
|
||||||
|
|
||||||
const key = `repositionHotbar`;
|
const key = `repositionHotbar`;
|
||||||
|
|
||||||
export function repositionHotbar() {
|
export function repositionHotbar() {
|
||||||
status[key] = SettingStatusEnum.Unknown;
|
|
||||||
|
|
||||||
const prevented = Hooks.call(`${__ID__}.preventSetting`, key);
|
const prevented = Hooks.call(`${__ID__}.preventSetting`, key);
|
||||||
if (!prevented) {
|
if (!prevented) {
|
||||||
Logger.log(`Preventing setting "${key}" from being registered`);
|
Logger.log(`Preventing setting "${key}" from being registered`);
|
||||||
status[key] = SettingStatusEnum.Blocked;
|
|
||||||
return;
|
return;
|
||||||
};
|
};
|
||||||
|
|
||||||
// #region Registration
|
// #region Registration
|
||||||
Logger.log(`Registering setting: ${key}`);
|
Logger.log(`Registering setting: ${key}`);
|
||||||
registerCategorySetting(`hotbar`, __ID__, key, {
|
game.settings.register(__ID__, key, {
|
||||||
name: `OFT.setting.${key}.name`,
|
name: `OFT.setting.${key}.name`,
|
||||||
hint: `OFT.setting.${key}.hint`,
|
hint: `OFT.setting.${key}.hint`,
|
||||||
scope: `user`,
|
scope: `user`,
|
||||||
|
|
@ -46,6 +42,4 @@ export function repositionHotbar() {
|
||||||
uiPosition.insertAdjacentElement(`beforeend`, container);
|
uiPosition.insertAdjacentElement(`beforeend`, container);
|
||||||
};
|
};
|
||||||
// #endregion Implementation
|
// #endregion Implementation
|
||||||
|
|
||||||
status[key] = SettingStatusEnum.Registered;
|
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -1,11 +1,9 @@
|
||||||
import { SettingStatusEnum, status } from "../utils/SettingStatus.mjs";
|
|
||||||
import { __ID__ } from "../consts.mjs";
|
import { __ID__ } from "../consts.mjs";
|
||||||
import { Logger } from "../utils/Logger.mjs";
|
import { Logger } from "../utils/Logger.mjs";
|
||||||
|
|
||||||
const key = `startSidebarExpanded`;
|
const key = `startSidebarExpanded`;
|
||||||
|
|
||||||
export function startSidebarExpanded() {
|
export function startSidebarExpanded() {
|
||||||
status[key] = SettingStatusEnum.Unknown;
|
|
||||||
|
|
||||||
// #region Registration
|
// #region Registration
|
||||||
Logger.log(`Registering setting: ${key}`);
|
Logger.log(`Registering setting: ${key}`);
|
||||||
|
|
@ -28,6 +26,4 @@ export function startSidebarExpanded() {
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
// #endregion Implementation
|
// #endregion Implementation
|
||||||
|
|
||||||
status[key] = SettingStatusEnum.Registered;
|
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -1,11 +1,9 @@
|
||||||
import { SettingStatusEnum, status } from "../utils/SettingStatus.mjs";
|
|
||||||
import { __ID__ } from "../consts.mjs";
|
import { __ID__ } from "../consts.mjs";
|
||||||
import { Logger } from "../utils/Logger.mjs";
|
import { Logger } from "../utils/Logger.mjs";
|
||||||
|
|
||||||
const key = `startingSidebarTab`;
|
const key = `startingSidebarTab`;
|
||||||
|
|
||||||
export function startingSidebarTab() {
|
export function startingSidebarTab() {
|
||||||
status[key] = SettingStatusEnum.Unknown;
|
|
||||||
|
|
||||||
// #region Registration
|
// #region Registration
|
||||||
Logger.log(`Registering setting: ${key}`);
|
Logger.log(`Registering setting: ${key}`);
|
||||||
|
|
@ -44,19 +42,10 @@ export function startingSidebarTab() {
|
||||||
// #region Implementation
|
// #region Implementation
|
||||||
Hooks.once(`ready`, () => {
|
Hooks.once(`ready`, () => {
|
||||||
const defaultTab = game.settings.get(__ID__, key);
|
const defaultTab = game.settings.get(__ID__, key);
|
||||||
if (defaultTab === ``) { return };
|
|
||||||
|
|
||||||
if (!(defaultTab in CONFIG.ui.sidebar.TABS)) {
|
|
||||||
Logger.error(`Failed to find starting tab with ID "${defaultTab}", skipping`);
|
|
||||||
return;
|
|
||||||
};
|
|
||||||
|
|
||||||
if (defaultTab) {
|
if (defaultTab) {
|
||||||
Logger.debug(`Changing tab to:`, defaultTab);
|
Logger.debug(`Changing tab to:`, defaultTab);
|
||||||
ui.sidebar.changeTab(defaultTab, `primary`);
|
ui.sidebar.changeTab(defaultTab, `primary`);
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
// #endregion Implementation
|
// #endregion Implementation
|
||||||
|
|
||||||
status[key] = SettingStatusEnum.Registered;
|
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -1,126 +0,0 @@
|
||||||
import { SettingStatusEnum, status } from "../utils/SettingStatus.mjs";
|
|
||||||
import { __ID__ } from "../consts.mjs";
|
|
||||||
import { Logger } from "../utils/Logger.mjs";
|
|
||||||
|
|
||||||
const key = `toggleMouseBroadcast`;
|
|
||||||
|
|
||||||
/** @type {number | null} */
|
|
||||||
let notifID = null;
|
|
||||||
|
|
||||||
export function toggleMouseBroadcast() {
|
|
||||||
status[key] = SettingStatusEnum.Unknown;
|
|
||||||
|
|
||||||
// #region Registration
|
|
||||||
const prevented = Hooks.call(`${__ID__}.preventSetting`, key);
|
|
||||||
if (!prevented) {
|
|
||||||
Logger.log(`Preventing setting "${key}" from being registered`);
|
|
||||||
status[key] = SettingStatusEnum.Blocked;
|
|
||||||
return;
|
|
||||||
};
|
|
||||||
Logger.log(`Registering setting: ${key}`);
|
|
||||||
|
|
||||||
// MARK: setting
|
|
||||||
game.settings.register(__ID__, key, {
|
|
||||||
scope: `client`,
|
|
||||||
config: false,
|
|
||||||
default: true,
|
|
||||||
});
|
|
||||||
|
|
||||||
// MARK: keybind
|
|
||||||
game.keybindings.register(__ID__, key, {
|
|
||||||
name: `OFT.keybindings.${key}.name`,
|
|
||||||
hint: `OFT.keybindings.${key}.hint`,
|
|
||||||
precedence: CONST.KEYBINDING_PRECEDENCE.NORMAL,
|
|
||||||
restricted: true,
|
|
||||||
editable: [
|
|
||||||
{ key: `KeyH` },
|
|
||||||
],
|
|
||||||
onDown: (event) => {
|
|
||||||
if (!game.user.hasPermission(`SHOW_CURSOR`)) { return };
|
|
||||||
event.preventDefault?.();
|
|
||||||
const current = game.settings.get(__ID__, key);
|
|
||||||
|
|
||||||
if (current) {
|
|
||||||
notifID = ui.notifications.warn(
|
|
||||||
`OFT.notifs.${key}.hidingCursor`,
|
|
||||||
{ console: false, localize: true, permanent: true },
|
|
||||||
).id;
|
|
||||||
} else {
|
|
||||||
if (notifID != null) {
|
|
||||||
ui.notifications.remove(notifID);
|
|
||||||
notifID = null;
|
|
||||||
};
|
|
||||||
ui.notifications.success(
|
|
||||||
`OFT.notifs.${key}.showingCursor`,
|
|
||||||
{ console: false, localize: true },
|
|
||||||
);
|
|
||||||
};
|
|
||||||
|
|
||||||
game.settings.set(__ID__, key, !current);
|
|
||||||
|
|
||||||
// Hide the existing cursor
|
|
||||||
game.user.broadcastActivity({ cursor: null });
|
|
||||||
return true;
|
|
||||||
},
|
|
||||||
});
|
|
||||||
// #endregion Registration
|
|
||||||
|
|
||||||
// #region Implementation
|
|
||||||
Hooks.on(`renderControlsConfig`, renderControlsConfigHandler);
|
|
||||||
Hooks.once(`ready`, readyHandler);
|
|
||||||
|
|
||||||
class OFTControlsLayer extends CONFIG.Canvas.layers.controls.layerClass {
|
|
||||||
_onMouseMove(currentPos) {
|
|
||||||
if (!game.settings.get(__ID__, key)) {
|
|
||||||
game.user.broadcastActivity({});
|
|
||||||
};
|
|
||||||
super._onMouseMove(currentPos);
|
|
||||||
};
|
|
||||||
};
|
|
||||||
CONFIG.Canvas.layers.controls.layerClass = OFTControlsLayer;
|
|
||||||
|
|
||||||
// #endregion Implementation
|
|
||||||
|
|
||||||
status[key] = SettingStatusEnum.Registered;
|
|
||||||
};
|
|
||||||
|
|
||||||
// #region Helpers
|
|
||||||
const tabGroup = `categories`;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Handle showing the "hiding your cursor" notification when the user
|
|
||||||
* connects to the server initially, allowing the current state to be
|
|
||||||
* correctly described to the user.
|
|
||||||
*/
|
|
||||||
function readyHandler() {
|
|
||||||
const hideCursor = !game.settings.get(__ID__, key);
|
|
||||||
const canShowCursor = game.user.hasPermission(`SHOW_CURSOR`);
|
|
||||||
if (hideCursor && canShowCursor) {
|
|
||||||
notifID = ui.notifications.warn(
|
|
||||||
`OFT.notifs.${key}.hidingCursor`,
|
|
||||||
{ console: false, localize: true, permanent: true },
|
|
||||||
).id;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Handles hiding the keybinding from the configuration if and when the user
|
|
||||||
* does not have the SHOW_CURSOR permission since this keybinding is really
|
|
||||||
* useless if they can't even broadcast their cursor in the first place.
|
|
||||||
*/
|
|
||||||
function renderControlsConfigHandler(_app, element) {
|
|
||||||
|
|
||||||
if (game.user.hasPermission(`SHOW_CURSOR`)) { return };
|
|
||||||
|
|
||||||
const keybindingList = element.querySelector(`section[data-group="${tabGroup}"][data-tab="${__ID__}"]`);
|
|
||||||
const tabButton = element.querySelector(`button[data-group="${tabGroup}"][data-tab="${__ID__}"]`);
|
|
||||||
|
|
||||||
const keybind = keybindingList.querySelector(`.form-group[data-action-id="${__ID__}.${key}"]`);
|
|
||||||
keybind?.remove();
|
|
||||||
|
|
||||||
if (keybindingList.childElementCount === 0) {
|
|
||||||
keybindingList.remove();
|
|
||||||
tabButton.remove();
|
|
||||||
};
|
|
||||||
};
|
|
||||||
// #endregion Helpers
|
|
||||||
9
module/utils/DevSettings.mjs
Normal file
9
module/utils/DevSettings.mjs
Normal file
|
|
@ -0,0 +1,9 @@
|
||||||
|
/** @type {Map<string, boolean>} */
|
||||||
|
export const devSettings = new Map();
|
||||||
|
|
||||||
|
export function registerDevSetting(namespace, key, config) {
|
||||||
|
const visible = config.config;
|
||||||
|
config.config = false;
|
||||||
|
game.settings.register(namespace, key, config);
|
||||||
|
devSettings.set(`${namespace}.${key}`, visible);
|
||||||
|
};
|
||||||
|
|
@ -1,11 +0,0 @@
|
||||||
/** @typedef {typeof SettingStatusEnum[keyof typeof SettingStatusEnum]} SettingStatus */
|
|
||||||
|
|
||||||
export const SettingStatusEnum = foundry.utils.deepFreeze({
|
|
||||||
Registered: `registered`,
|
|
||||||
Blocked: `blocked`,
|
|
||||||
Incompatible: `incompatible`,
|
|
||||||
Unknown: `unknown`,
|
|
||||||
});
|
|
||||||
|
|
||||||
/** @type {Record<string, SettingStatus>} */
|
|
||||||
export const status = {};
|
|
||||||
|
|
@ -1,22 +0,0 @@
|
||||||
/** @type {Map<string, Map<string, boolean>>} */
|
|
||||||
export const categories = new Map();
|
|
||||||
|
|
||||||
export function registerCategorySetting(category, namespace, key, config) {
|
|
||||||
let cat = categories.get(category);
|
|
||||||
if (!cat) {
|
|
||||||
cat = new Map();
|
|
||||||
categories.set(category, cat);
|
|
||||||
};
|
|
||||||
const visible = config.config;
|
|
||||||
config.config = false;
|
|
||||||
game.settings.register(namespace, key, config);
|
|
||||||
cat.set(`${namespace}.${key}`, visible);
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* A helper function that registers the setting to the "dev"
|
|
||||||
* category
|
|
||||||
*/
|
|
||||||
export function registerDevSetting(namespace, key, config) {
|
|
||||||
registerCategorySetting(`dev`, namespace, key, config);
|
|
||||||
};
|
|
||||||
|
|
@ -1,8 +0,0 @@
|
||||||
.application.oft {
|
|
||||||
> .window-content.standard-form .setting-list {
|
|
||||||
flex-grow: 1;
|
|
||||||
display: flex;
|
|
||||||
flex-direction: column;
|
|
||||||
gap: 1rem;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -3,7 +3,5 @@
|
||||||
@import url("./hotbarButtonSize.css");
|
@import url("./hotbarButtonSize.css");
|
||||||
@import url("./repositionHotbar.css");
|
@import url("./repositionHotbar.css");
|
||||||
|
|
||||||
@import url("./apps.css");
|
|
||||||
|
|
||||||
/* Make the chat sidebar the same width as all the other tabs */
|
/* Make the chat sidebar the same width as all the other tabs */
|
||||||
.chat-sidebar:not(.sidebar-popout) { width: unset; }
|
.chat-sidebar:not(.sidebar-popout) { width: unset; }
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue