Rename __ID to __ID__
This commit is contained in:
parent
d9bea36444
commit
523d9c1da2
9 changed files with 43 additions and 33 deletions
|
|
@ -1 +1,11 @@
|
|||
export const __ID = `oft`;
|
||||
export const __ID__ = `oft`;
|
||||
|
||||
/**
|
||||
* @param {string} path
|
||||
*/
|
||||
export function filePath(path) {
|
||||
if (path.startsWith(`/`)) {
|
||||
path = path.slice(1);
|
||||
};
|
||||
return `modules/${__ID__}/${path}`;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
import { __ID } from "../consts.mjs";
|
||||
import { __ID__ } from "../consts.mjs";
|
||||
import { Logger } from "../utils/Logger.mjs";
|
||||
|
||||
const key = `chatSidebarBackground`;
|
||||
|
|
@ -7,7 +7,7 @@ export function chatSidebarBackground() {
|
|||
|
||||
// #region Registration
|
||||
Logger.log(`Registering setting: ${key}`);
|
||||
game.settings.register(__ID, key, {
|
||||
game.settings.register(__ID__, key, {
|
||||
name: `OFT.setting.${key}.name`,
|
||||
hint: `OFT.setting.${key}.hint`,
|
||||
scope: `user`,
|
||||
|
|
@ -17,15 +17,15 @@ export function chatSidebarBackground() {
|
|||
requiresReload: false,
|
||||
onChange: (newValue) => {
|
||||
Logger.debug(`setting:${key} | Setting to ${newValue}`);
|
||||
document.body.classList.toggle(`${__ID}-${key}`, newValue);
|
||||
document.body.classList.toggle(`${__ID__}-${key}`, newValue);
|
||||
},
|
||||
});
|
||||
// #endregion Registration
|
||||
|
||||
// #region Implementation
|
||||
if (game.settings.get(__ID, key)) {
|
||||
if (game.settings.get(__ID__, key)) {
|
||||
Logger.debug(`setting:${key} | Adding chat background`);
|
||||
document.body.classList.add(`${__ID}-${key}`);
|
||||
document.body.classList.add(`${__ID__}-${key}`);
|
||||
};
|
||||
// #endregion Implementation
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1,11 +1,11 @@
|
|||
import { __ID } from "../consts.mjs";
|
||||
import { __ID__ } from "../consts.mjs";
|
||||
import { Logger } from "../utils/Logger.mjs";
|
||||
|
||||
const key = `hotbarButtonGap`;
|
||||
|
||||
export function hotbarButtonGap() {
|
||||
|
||||
const prevented = Hooks.call(`${__ID}.preventSetting`, key);
|
||||
const prevented = Hooks.call(`${__ID__}.preventSetting`, key);
|
||||
if (!prevented) {
|
||||
Logger.log(`Preventing setting "${key}" from being registered`);
|
||||
return;
|
||||
|
|
@ -13,8 +13,8 @@ export function hotbarButtonGap() {
|
|||
|
||||
// #region Registration
|
||||
Logger.log(`Registering setting: ${key}`);
|
||||
document.body.classList.add(`${__ID}-${key}`);
|
||||
game.settings.register(__ID, key, {
|
||||
document.body.classList.add(`${__ID__}-${key}`);
|
||||
game.settings.register(__ID__, key, {
|
||||
name: `OFT.setting.${key}.name`,
|
||||
hint: `OFT.setting.${key}.hint`,
|
||||
scope: `user`,
|
||||
|
|
@ -33,7 +33,7 @@ export function hotbarButtonGap() {
|
|||
// #endregion Registration
|
||||
|
||||
// #region Implementation
|
||||
const buttonGap = game.settings.get(__ID, key);
|
||||
const buttonGap = game.settings.get(__ID__, key);
|
||||
document.body.style.setProperty(`--hotbar-button-gap`, `${buttonGap}px`);
|
||||
// #endregion Implementation
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1,11 +1,11 @@
|
|||
import { __ID } from "../consts.mjs";
|
||||
import { __ID__ } from "../consts.mjs";
|
||||
import { Logger } from "../utils/Logger.mjs";
|
||||
|
||||
const key = `hotbarButtonSize`;
|
||||
|
||||
export function hotbarButtonSize() {
|
||||
|
||||
const prevented = Hooks.call(`${__ID}.preventSetting`, key);
|
||||
const prevented = Hooks.call(`${__ID__}.preventSetting`, key);
|
||||
if (!prevented) {
|
||||
Logger.log(`Preventing setting "${key}" from being registered`);
|
||||
return;
|
||||
|
|
@ -13,8 +13,8 @@ export function hotbarButtonSize() {
|
|||
|
||||
// #region Registration
|
||||
Logger.log(`Registering setting: ${key}`);
|
||||
document.body.classList.add(`${__ID}-${key}`);
|
||||
game.settings.register(__ID, key, {
|
||||
document.body.classList.add(`${__ID__}-${key}`);
|
||||
game.settings.register(__ID__, key, {
|
||||
name: `OFT.setting.${key}.name`,
|
||||
hint: `OFT.setting.${key}.hint`,
|
||||
scope: `user`,
|
||||
|
|
@ -33,7 +33,7 @@ export function hotbarButtonSize() {
|
|||
// #endregion Registration
|
||||
|
||||
// #region Implementation
|
||||
const hotbarSize = game.settings.get(__ID, key);
|
||||
const hotbarSize = game.settings.get(__ID__, key);
|
||||
document.body.style.setProperty(`--hotbar-size`, `${hotbarSize}px`);
|
||||
// #endregion Implementation
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1,11 +1,11 @@
|
|||
import { __ID } from "../consts.mjs";
|
||||
import { __ID__ } from "../consts.mjs";
|
||||
import { Logger } from "../utils/Logger.mjs";
|
||||
|
||||
const key = `preventUserConfigOpen`;
|
||||
|
||||
export function preventUserConfigOpen() {
|
||||
|
||||
const prevented = Hooks.call(`${__ID}.preventSetting`, key);
|
||||
const prevented = Hooks.call(`${__ID__}.preventSetting`, key);
|
||||
if (!prevented) {
|
||||
Logger.log(`Preventing setting "${key}" from being registered`);
|
||||
return;
|
||||
|
|
@ -13,7 +13,7 @@ export function preventUserConfigOpen() {
|
|||
|
||||
// #region Registration
|
||||
Logger.log(`Registering setting: ${key}`);
|
||||
game.settings.register(__ID, key, {
|
||||
game.settings.register(__ID__, key, {
|
||||
name: `OFT.setting.${key}.name`,
|
||||
hint: `OFT.setting.${key}.hint`,
|
||||
scope: `user`,
|
||||
|
|
@ -26,7 +26,7 @@ export function preventUserConfigOpen() {
|
|||
|
||||
// #region Implementation
|
||||
Hooks.once(`renderUserConfig`, (app, element) => {
|
||||
if (!game.ready && game.settings.get(__ID, key)) {
|
||||
if (!game.ready && game.settings.get(__ID__, key)) {
|
||||
element.style.display = `none`;
|
||||
app.close();
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1,11 +1,11 @@
|
|||
import { __ID } from "../consts.mjs";
|
||||
import { __ID__ } from "../consts.mjs";
|
||||
import { Logger } from "../utils/Logger.mjs";
|
||||
|
||||
const key = `repositionHotbar`;
|
||||
|
||||
export function repositionHotbar() {
|
||||
|
||||
const prevented = Hooks.call(`${__ID}.preventSetting`, key);
|
||||
const prevented = Hooks.call(`${__ID__}.preventSetting`, key);
|
||||
if (!prevented) {
|
||||
Logger.log(`Preventing setting "${key}" from being registered`);
|
||||
return;
|
||||
|
|
@ -13,7 +13,7 @@ export function repositionHotbar() {
|
|||
|
||||
// #region Registration
|
||||
Logger.log(`Registering setting: ${key}`);
|
||||
game.settings.register(__ID, key, {
|
||||
game.settings.register(__ID__, key, {
|
||||
name: `OFT.setting.${key}.name`,
|
||||
hint: `OFT.setting.${key}.hint`,
|
||||
scope: `user`,
|
||||
|
|
@ -25,7 +25,7 @@ export function repositionHotbar() {
|
|||
// #endregion Registration
|
||||
|
||||
// #region Implementation
|
||||
if (game.settings.get(__ID, key)) {
|
||||
if (game.settings.get(__ID__, key)) {
|
||||
Logger.debug(`setting:${key} | Repositioning hotbar`);
|
||||
document.body.classList.add(`oft-${key}`);
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
import { __ID } from "../consts.mjs";
|
||||
import { __ID__ } from "../consts.mjs";
|
||||
import { Logger } from "../utils/Logger.mjs";
|
||||
|
||||
const key = `startSidebarExpanded`;
|
||||
|
|
@ -7,7 +7,7 @@ export function startSidebarExpanded() {
|
|||
|
||||
// #region Registration
|
||||
Logger.log(`Registering setting: ${key}`);
|
||||
game.settings.register(__ID, key, {
|
||||
game.settings.register(__ID__, key, {
|
||||
name: `OFT.setting.${key}.name`,
|
||||
hint: `OFT.setting.${key}.hint`,
|
||||
scope: `user`,
|
||||
|
|
@ -20,7 +20,7 @@ export function startSidebarExpanded() {
|
|||
|
||||
// #region Implementation
|
||||
Hooks.once(`renderSidebar`, (app) => {
|
||||
if (game.settings.get(__ID, key) && !game.ready) {
|
||||
if (game.settings.get(__ID__, key) && !game.ready) {
|
||||
Logger.debug(`setting:${key} | Expanding sidebar`);
|
||||
app.toggleExpanded(true);
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
import { __ID } from "../consts.mjs";
|
||||
import { __ID__ } from "../consts.mjs";
|
||||
import { Logger } from "../utils/Logger.mjs";
|
||||
|
||||
const key = `startingSidebarTab`;
|
||||
|
|
@ -7,7 +7,7 @@ export function startingSidebarTab() {
|
|||
|
||||
// #region Registration
|
||||
Logger.log(`Registering setting: ${key}`);
|
||||
game.settings.register(__ID, key, {
|
||||
game.settings.register(__ID__, key, {
|
||||
name: `OFT.setting.${key}.name`,
|
||||
hint: `OFT.setting.${key}.hint`,
|
||||
type: new foundry.data.fields.StringField({
|
||||
|
|
@ -41,7 +41,7 @@ export function startingSidebarTab() {
|
|||
|
||||
// #region Implementation
|
||||
Hooks.once(`ready`, () => {
|
||||
const defaultTab = game.settings.get(__ID, key);
|
||||
const defaultTab = game.settings.get(__ID__, key);
|
||||
if (defaultTab) {
|
||||
Logger.debug(`Changing tab to:`, defaultTab);
|
||||
ui.sidebar.changeTab(defaultTab, `primary`);
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
import { __ID } from "../consts.mjs";
|
||||
import { __ID__ } from "../consts.mjs";
|
||||
|
||||
const augmentedProps = new Set([
|
||||
`debug`,
|
||||
|
|
@ -28,7 +28,7 @@ export const Logger = new Proxy(console, {
|
|||
get(target, prop, _receiver) {
|
||||
|
||||
if (inDev == null) {
|
||||
inDev = game.modules.get(__ID).flags.inDev;
|
||||
inDev = game.modules.get(__ID__).flags.inDev;
|
||||
};
|
||||
|
||||
if (!inDev && !happensInProd.has(prop)) {
|
||||
|
|
@ -36,7 +36,7 @@ export const Logger = new Proxy(console, {
|
|||
};
|
||||
|
||||
if (augmentedProps.has(prop)) {
|
||||
return target[prop].bind(target, __ID, `|`);
|
||||
return target[prop].bind(target, __ID__, `|`);
|
||||
};
|
||||
return target[prop];
|
||||
},
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue