mirror of
https://github.com/Kornstalx/5etools-mirror-2.github.io.git
synced 2025-10-28 20:45:35 -05:00
v1.202.0
This commit is contained in:
@@ -11,8 +11,6 @@ function cleanFolder (folder, {isFast = false} = {}) {
|
||||
console.log(`Cleaning directory ${folder}...`);
|
||||
const files = ut.listFiles({
|
||||
dir: folder,
|
||||
blocklistFilePrefixes: ut.FILE_PREFIX_BLOCKLIST
|
||||
.filter(it => it !== "foundry-"),
|
||||
});
|
||||
files
|
||||
.filter(file => file.endsWith(".json"))
|
||||
|
||||
@@ -7,6 +7,9 @@ import "../js/utils.js";
|
||||
const BLOCKLIST_FILE_PREFIXES = [
|
||||
...ut.FILE_PREFIX_BLOCKLIST,
|
||||
|
||||
"foundry-",
|
||||
"foundry.json",
|
||||
|
||||
// specific files
|
||||
"demo.json",
|
||||
];
|
||||
|
||||
@@ -18,17 +18,18 @@ class _HtmlGenerator {
|
||||
|
||||
class _HtmlGeneratorListButtons extends _HtmlGenerator {
|
||||
static getBtnPreviewToggle () {
|
||||
return `<button class="ve-col-0-3 btn btn-default btn-xs p-0 lst__btn-collapse-all-previews" name="list-toggle-all-previews">[+]</button>`;
|
||||
return `<button type="button" class="ve-col-0-3 btn btn-default btn-xs p-0 lst__btn-collapse-all-previews" name="list-toggle-all-previews">[+]</button>`;
|
||||
}
|
||||
|
||||
static getBtnSource () {
|
||||
return `<button class="sort btn btn-default btn-xs ve-grow" data-sort="source">Source</button>`;
|
||||
return `<button type="button" class="sort btn btn-default btn-xs ve-grow" data-sort="source">Source</button>`;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {string} width
|
||||
* @param {?string} sortIdent
|
||||
* @param {string} text
|
||||
* @param {?string} title
|
||||
* @param {?boolean} isDisabled
|
||||
* @param {?Array<string>} classListAdditional
|
||||
* @return {string}
|
||||
@@ -38,6 +39,7 @@ class _HtmlGeneratorListButtons extends _HtmlGenerator {
|
||||
width,
|
||||
sortIdent = null,
|
||||
text,
|
||||
title = null,
|
||||
isDisabled = false,
|
||||
classListAdditional = null,
|
||||
},
|
||||
@@ -45,28 +47,13 @@ class _HtmlGeneratorListButtons extends _HtmlGenerator {
|
||||
const attrs = [
|
||||
this._getAttrClass(`ve-col-${width} sort btn btn-default btn-xs`, {classListAdditional}),
|
||||
sortIdent ? `data-sort="${sortIdent}"` : null,
|
||||
title ? `title="${title}"` : null,
|
||||
isDisabled ? `disabled` : null,
|
||||
]
|
||||
.filter(Boolean)
|
||||
.join(" ");
|
||||
|
||||
return `<button ${attrs}>${text}</button>`;
|
||||
}
|
||||
}
|
||||
|
||||
class _HtmlGeneratorListToken extends _HtmlGenerator {
|
||||
/**
|
||||
* @param {?Array<string>} classListAdditional
|
||||
* @return {string}
|
||||
*/
|
||||
static getWrpToken ({classListAdditional = null} = {}) {
|
||||
const attrs = [
|
||||
`id="float-token"`,
|
||||
this._getAttrClass(`relative`, {classListAdditional}),
|
||||
]
|
||||
.filter(Boolean)
|
||||
.join(" ");
|
||||
return `<div ${attrs}></div>`;
|
||||
return `<button type="button" ${attrs}>${text}</button>`;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -133,9 +120,11 @@ class _PageGeneratorListBase extends _PageGeneratorBase {
|
||||
_isMultisource = false;
|
||||
_btnsList;
|
||||
_btnsSublist;
|
||||
_wrpToken;
|
||||
_isWrpToken;
|
||||
_onscrollPageContent;
|
||||
_styleListContainerAdditional;
|
||||
_styleContentWrapperAdditional;
|
||||
_stylePageContentAdditional;
|
||||
_isPrinterView = false;
|
||||
|
||||
_registerPartials () {
|
||||
@@ -158,6 +147,9 @@ class _PageGeneratorListBase extends _PageGeneratorBase {
|
||||
this._registerPartial({ident: "listScripts", filename: "list/template-list-scripts.hbs"});
|
||||
}
|
||||
|
||||
/**
|
||||
* @return {object}
|
||||
*/
|
||||
_getData () {
|
||||
return {
|
||||
titlePage: this._titlePage,
|
||||
@@ -172,10 +164,12 @@ class _PageGeneratorListBase extends _PageGeneratorBase {
|
||||
isMultisource: this._isMultisource,
|
||||
btnsList: this._btnsList,
|
||||
btnsSublist: this._btnsSublist,
|
||||
wrpToken: this._wrpToken,
|
||||
isWrpToken: this._isWrpToken,
|
||||
onscrollPageContent: this._onscrollPageContent,
|
||||
isStyleBook: this._isStyleBook,
|
||||
styleListContainerAdditional: this._styleListContainerAdditional,
|
||||
styleContentWrapperAdditional: this._styleContentWrapperAdditional,
|
||||
stylePageContentAdditional: this._stylePageContentAdditional,
|
||||
identPartialListListcontainer: "listListcontainer",
|
||||
identPartialListContentwrapper: "listContentwrapper",
|
||||
isPrinterView: this._isPrinterView,
|
||||
@@ -475,6 +469,321 @@ class _PageGeneratorListTrapsHazards extends _PageGeneratorListBase {
|
||||
];
|
||||
}
|
||||
|
||||
class _PageGeneratorListRewards extends _PageGeneratorListBase {
|
||||
_page = UrlUtil.PG_REWARDS;
|
||||
_titlePage = "Supernatural Gifts & Rewards";
|
||||
_scriptIdentList = "rewards";
|
||||
|
||||
_btnsList = [
|
||||
_HtmlGeneratorListButtons.getBtnPreviewToggle(),
|
||||
_HtmlGeneratorListButtons.getBtn({width: "2", sortIdent: "type", text: "Type"}),
|
||||
_HtmlGeneratorListButtons.getBtn({width: "7-7", sortIdent: "name", text: "Name"}),
|
||||
_HtmlGeneratorListButtons.getBtnSource(),
|
||||
];
|
||||
|
||||
_btnsSublist = [
|
||||
_HtmlGeneratorListButtons.getBtn({width: "2", sortIdent: "type", text: "Type"}),
|
||||
_HtmlGeneratorListButtons.getBtn({width: "10", sortIdent: "name", text: "Name"}),
|
||||
];
|
||||
}
|
||||
|
||||
class _PageGeneratorListLanguages extends _PageGeneratorListBase {
|
||||
_page = UrlUtil.PG_LANGUAGES;
|
||||
_titlePage = "Languages";
|
||||
_scriptIdentList = "languages";
|
||||
|
||||
_stylesheets = [
|
||||
"languages",
|
||||
];
|
||||
|
||||
_btnsList = [
|
||||
_HtmlGeneratorListButtons.getBtn({width: "6", sortIdent: "name", text: "Name"}),
|
||||
_HtmlGeneratorListButtons.getBtn({width: "2", sortIdent: "type", text: "Type"}),
|
||||
_HtmlGeneratorListButtons.getBtn({width: "2", sortIdent: "script", text: "Script"}),
|
||||
_HtmlGeneratorListButtons.getBtnSource(),
|
||||
];
|
||||
|
||||
_btnsSublist = [
|
||||
_HtmlGeneratorListButtons.getBtn({width: "8", sortIdent: "name", text: "Name"}),
|
||||
_HtmlGeneratorListButtons.getBtn({width: "2", sortIdent: "type", text: "Type"}),
|
||||
_HtmlGeneratorListButtons.getBtn({width: "2", sortIdent: "script", text: "Script"}),
|
||||
];
|
||||
}
|
||||
|
||||
class _PageGeneratorListObjects extends _PageGeneratorListBase {
|
||||
_page = UrlUtil.PG_OBJECTS;
|
||||
_titlePage = "Objects";
|
||||
_scriptIdentList = "objects";
|
||||
|
||||
_stylesheets = [
|
||||
"objects",
|
||||
];
|
||||
|
||||
_btnsList = [
|
||||
_HtmlGeneratorListButtons.getBtn({width: "8", sortIdent: "name", text: "Name"}),
|
||||
_HtmlGeneratorListButtons.getBtn({width: "2", sortIdent: "size", text: "Size"}),
|
||||
_HtmlGeneratorListButtons.getBtnSource(),
|
||||
];
|
||||
|
||||
_btnsSublist = [
|
||||
_HtmlGeneratorListButtons.getBtn({width: "9", sortIdent: "name", text: "Name"}),
|
||||
_HtmlGeneratorListButtons.getBtn({width: "3", sortIdent: "size", text: "Size"}),
|
||||
];
|
||||
|
||||
_isWrpToken = true;
|
||||
|
||||
_onscrollPageContent = `TokenUtil.handleStatblockScroll(event, this)`;
|
||||
}
|
||||
|
||||
class _PageGeneratorListOptionalFeatures extends _PageGeneratorListBase {
|
||||
_page = UrlUtil.PG_OPT_FEATURES;
|
||||
_titlePage = "Other Options and Features";
|
||||
_scriptIdentList = "optionalfeatures";
|
||||
|
||||
_isPrinterView = true;
|
||||
|
||||
_stylesheets = [
|
||||
"optionalfeatures",
|
||||
];
|
||||
|
||||
_styleListContainerAdditional = "ve-flex-6";
|
||||
_styleContentWrapperAdditional = "ve-flex-4";
|
||||
|
||||
_btnsList = [
|
||||
_HtmlGeneratorListButtons.getBtnPreviewToggle(),
|
||||
_HtmlGeneratorListButtons.getBtn({width: "3", sortIdent: "name", text: "Name"}),
|
||||
_HtmlGeneratorListButtons.getBtn({width: "1-5", sortIdent: "type", text: "Type"}),
|
||||
_HtmlGeneratorListButtons.getBtn({width: "4-7", sortIdent: "prerequisite", text: "Prerequisite"}),
|
||||
_HtmlGeneratorListButtons.getBtn({width: "1", sortIdent: "level", text: "Level"}),
|
||||
_HtmlGeneratorListButtons.getBtnSource(),
|
||||
];
|
||||
|
||||
_btnsSublist = [
|
||||
_HtmlGeneratorListButtons.getBtn({width: "4", sortIdent: "name", text: "Name"}),
|
||||
_HtmlGeneratorListButtons.getBtn({width: "2", sortIdent: "type", text: "Type"}),
|
||||
_HtmlGeneratorListButtons.getBtn({width: "4-5", sortIdent: "prerequisite", text: "Prerequisite"}),
|
||||
_HtmlGeneratorListButtons.getBtn({width: "1-5", sortIdent: "level", text: "Level"}),
|
||||
];
|
||||
}
|
||||
|
||||
class _PageGeneratorListPsionics extends _PageGeneratorListBase {
|
||||
_page = UrlUtil.PG_PSIONICS;
|
||||
_titlePage = "Psionics";
|
||||
_scriptIdentList = "psionics";
|
||||
|
||||
_scriptsUtilsAdditional = [
|
||||
"utils-tableview.js",
|
||||
];
|
||||
|
||||
_btnsList = [
|
||||
_HtmlGeneratorListButtons.getBtn({width: "6", sortIdent: "name", text: "Name"}),
|
||||
_HtmlGeneratorListButtons.getBtn({width: "2", sortIdent: "type", text: "Type"}),
|
||||
_HtmlGeneratorListButtons.getBtn({width: "2", sortIdent: "order", text: "Order"}),
|
||||
_HtmlGeneratorListButtons.getBtnSource(),
|
||||
];
|
||||
|
||||
_btnsSublist = [
|
||||
_HtmlGeneratorListButtons.getBtn({width: "6", sortIdent: "name", text: "Name"}),
|
||||
_HtmlGeneratorListButtons.getBtn({width: "3", sortIdent: "type", text: "Type"}),
|
||||
_HtmlGeneratorListButtons.getBtn({width: "3", sortIdent: "order", text: "Order"}),
|
||||
];
|
||||
|
||||
_registerPartials () {
|
||||
super._registerPartials();
|
||||
|
||||
this._registerPartial({
|
||||
ident: "listContentwrapperPsionics",
|
||||
filename: "list/template-list-contentwrapper--psionics.hbs",
|
||||
});
|
||||
}
|
||||
|
||||
_getData () {
|
||||
return {
|
||||
...super._getData(),
|
||||
identPartialListContentwrapper: "listContentwrapperPsionics",
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
class _PageGeneratorListRaces extends _PageGeneratorListBase {
|
||||
_page = UrlUtil.PG_RACES;
|
||||
_titlePage = "Races";
|
||||
_scriptIdentList = "races";
|
||||
|
||||
_btnsList = [
|
||||
_HtmlGeneratorListButtons.getBtn({width: "4", sortIdent: "name", text: "Name"}),
|
||||
_HtmlGeneratorListButtons.getBtn({width: "4", sortIdent: "ability", text: "Ability"}),
|
||||
_HtmlGeneratorListButtons.getBtn({width: "2", sortIdent: "size", text: "Size"}),
|
||||
_HtmlGeneratorListButtons.getBtnSource(),
|
||||
];
|
||||
|
||||
_btnsSublist = [
|
||||
_HtmlGeneratorListButtons.getBtn({width: "5", sortIdent: "name", text: "Name"}),
|
||||
_HtmlGeneratorListButtons.getBtn({width: "5", sortIdent: "ability", text: "Ability"}),
|
||||
_HtmlGeneratorListButtons.getBtn({width: "2", sortIdent: "size", text: "Size"}),
|
||||
];
|
||||
|
||||
_isPrinterView = true;
|
||||
}
|
||||
|
||||
class _PageGeneratorListRecipes extends _PageGeneratorListBase {
|
||||
_page = UrlUtil.PG_RECIPES;
|
||||
_titlePage = "Recipes";
|
||||
_scriptIdentList = "recipes";
|
||||
|
||||
_stylesheets = [
|
||||
"recipes",
|
||||
];
|
||||
|
||||
_isStyleBook = true;
|
||||
|
||||
_styleListContainerAdditional = "ve-flex-4";
|
||||
_styleContentWrapperAdditional = "ve-flex-7";
|
||||
_stylePageContentAdditional = "recipes__tbl-recipes";
|
||||
|
||||
_btnsList = [
|
||||
_HtmlGeneratorListButtons.getBtn({width: "6", sortIdent: "name", text: "Name"}),
|
||||
_HtmlGeneratorListButtons.getBtn({width: "4", sortIdent: "type", text: "Category"}),
|
||||
_HtmlGeneratorListButtons.getBtnSource(),
|
||||
];
|
||||
|
||||
_btnsSublist = [
|
||||
_HtmlGeneratorListButtons.getBtn({width: "9", sortIdent: "name", text: "Name"}),
|
||||
_HtmlGeneratorListButtons.getBtn({width: "3", sortIdent: "type", text: "Category"}),
|
||||
];
|
||||
|
||||
_registerPartials () {
|
||||
super._registerPartials();
|
||||
|
||||
this._registerPartial({
|
||||
ident: "listContentwrapperRecipes",
|
||||
filename: "list/template-list-contentwrapper--recipes.hbs",
|
||||
});
|
||||
}
|
||||
|
||||
_getData () {
|
||||
return {
|
||||
...super._getData(),
|
||||
identPartialListContentwrapper: "listContentwrapperRecipes",
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
class _PageGeneratorListSpells extends _PageGeneratorListBase {
|
||||
_page = UrlUtil.PG_SPELLS;
|
||||
_titlePage = "Spells";
|
||||
_scriptIdentList = "spells";
|
||||
|
||||
_stylesheets = [
|
||||
"spells",
|
||||
];
|
||||
|
||||
_styleListContainerAdditional = "ve-flex-7";
|
||||
_styleContentWrapperAdditional = "ve-flex-5";
|
||||
|
||||
_isMultisource = true;
|
||||
|
||||
_scriptsUtilsAdditional = [
|
||||
"utils-tableview.js",
|
||||
];
|
||||
|
||||
_btnsList = [
|
||||
_HtmlGeneratorListButtons.getBtn({width: "2-9", sortIdent: "name", text: "Name"}),
|
||||
_HtmlGeneratorListButtons.getBtn({width: "1-5", sortIdent: "level", text: "Level"}),
|
||||
_HtmlGeneratorListButtons.getBtn({width: "1-7", sortIdent: "time", text: "Time"}),
|
||||
_HtmlGeneratorListButtons.getBtn({width: "1-2", sortIdent: "school", text: "School"}),
|
||||
_HtmlGeneratorListButtons.getBtn({width: "0-6", sortIdent: "concentration", title: "Concentration", text: "C."}),
|
||||
_HtmlGeneratorListButtons.getBtn({width: "2-4", sortIdent: "range", text: "Range"}),
|
||||
_HtmlGeneratorListButtons.getBtnSource(),
|
||||
];
|
||||
|
||||
_btnsSublist = [
|
||||
_HtmlGeneratorListButtons.getBtn({width: "3-2", sortIdent: "name", text: "Name"}),
|
||||
_HtmlGeneratorListButtons.getBtn({width: "1-5", sortIdent: "level", text: "Level"}),
|
||||
_HtmlGeneratorListButtons.getBtn({width: "1-8", sortIdent: "time", text: "Time"}),
|
||||
_HtmlGeneratorListButtons.getBtn({width: "1-6", sortIdent: "school", text: "School"}),
|
||||
_HtmlGeneratorListButtons.getBtn({width: "0-7", sortIdent: "concentration", title: "Concentration", text: "C."}),
|
||||
_HtmlGeneratorListButtons.getBtn({width: "3-2", sortIdent: "range", text: "Range"}),
|
||||
];
|
||||
|
||||
_registerPartials () {
|
||||
super._registerPartials();
|
||||
|
||||
this._registerPartial({
|
||||
ident: "listContentwrapperSpells",
|
||||
filename: "list/template-list-contentwrapper--spells.hbs",
|
||||
});
|
||||
}
|
||||
|
||||
_getData () {
|
||||
return {
|
||||
...super._getData(),
|
||||
identPartialListContentwrapper: "listContentwrapperSpells",
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
class _PageGeneratorListTables extends _PageGeneratorListBase {
|
||||
_page = UrlUtil.PG_TABLES;
|
||||
_titlePage = "Tables";
|
||||
_scriptIdentList = "tables";
|
||||
|
||||
_styleListContainerAdditional = "ve-flex-4";
|
||||
_styleContentWrapperAdditional = "ve-flex-6";
|
||||
|
||||
_btnsList = [
|
||||
_HtmlGeneratorListButtons.getBtn({width: "10", sortIdent: "sortName", text: "Name"}),
|
||||
_HtmlGeneratorListButtons.getBtnSource(),
|
||||
];
|
||||
|
||||
_btnsSublist = [
|
||||
_HtmlGeneratorListButtons.getBtn({width: "12", sortIdent: "sortName", text: "Name"}),
|
||||
];
|
||||
}
|
||||
|
||||
class _PageGeneratorListVariantRules extends _PageGeneratorListBase {
|
||||
_page = UrlUtil.PG_VARIANTRULES;
|
||||
_titlePage = "Optional, Variant, and Expanded Rules";
|
||||
_navbarTitle = "Optional/etc. Rules";
|
||||
_scriptIdentList = "variantrules";
|
||||
|
||||
_btnsList = [
|
||||
_HtmlGeneratorListButtons.getBtn({width: "7", sortIdent: "name", text: "Name"}),
|
||||
_HtmlGeneratorListButtons.getBtn({width: "3", sortIdent: "ruleType", text: "Type"}),
|
||||
_HtmlGeneratorListButtons.getBtnSource(),
|
||||
];
|
||||
|
||||
_btnsSublist = [
|
||||
_HtmlGeneratorListButtons.getBtn({width: "9", sortIdent: "name", text: "Name"}),
|
||||
_HtmlGeneratorListButtons.getBtn({width: "3", sortIdent: "ruleType", text: "Type"}),
|
||||
];
|
||||
}
|
||||
|
||||
class _PageGeneratorListVehicles extends _PageGeneratorListBase {
|
||||
_page = UrlUtil.PG_VEHICLES;
|
||||
_titlePage = "Vehicles";
|
||||
_scriptIdentList = "vehicles";
|
||||
|
||||
_stylesheets = [
|
||||
"vehicles",
|
||||
];
|
||||
|
||||
_btnsList = [
|
||||
_HtmlGeneratorListButtons.getBtn({width: "6", sortIdent: "type", text: "Type"}),
|
||||
_HtmlGeneratorListButtons.getBtn({width: "4", sortIdent: "name", text: "Name"}),
|
||||
_HtmlGeneratorListButtons.getBtnSource(),
|
||||
];
|
||||
|
||||
_btnsSublist = [
|
||||
_HtmlGeneratorListButtons.getBtn({width: "8", sortIdent: "type", text: "Type"}),
|
||||
_HtmlGeneratorListButtons.getBtn({width: "4", sortIdent: "name", text: "Name"}),
|
||||
];
|
||||
|
||||
_isWrpToken = true;
|
||||
|
||||
_onscrollPageContent = `TokenUtil.handleStatblockScroll(event, this)`;
|
||||
}
|
||||
|
||||
const generators = [
|
||||
new _PageGeneratorListActions(),
|
||||
new _PageGeneratorListBackgrounds(),
|
||||
@@ -487,6 +796,17 @@ const generators = [
|
||||
new _PageGeneratorListFeats(),
|
||||
new _PageGeneratorListItems(),
|
||||
new _PageGeneratorListTrapsHazards(),
|
||||
new _PageGeneratorListRewards(),
|
||||
new _PageGeneratorListLanguages(),
|
||||
new _PageGeneratorListObjects(),
|
||||
new _PageGeneratorListOptionalFeatures(),
|
||||
new _PageGeneratorListPsionics(),
|
||||
new _PageGeneratorListRaces(),
|
||||
new _PageGeneratorListRecipes(),
|
||||
new _PageGeneratorListSpells(),
|
||||
new _PageGeneratorListTables(),
|
||||
new _PageGeneratorListVariantRules(),
|
||||
new _PageGeneratorListVehicles(),
|
||||
];
|
||||
|
||||
generators
|
||||
|
||||
@@ -12,15 +12,13 @@
|
||||
{{> "listWrpPagecontent" }}
|
||||
|
||||
<div class="ve-text-center mt-2 no-print best-ecgen__hidden">
|
||||
<button class="btn btn-success btn-xs" id="btn-encounterbuild">Encounter Builder</button>
|
||||
<button type="button" class="btn btn-success btn-xs" id="btn-encounterbuild">Encounter Builder</button>
|
||||
<div id="wrp-profbonusdice" class="ve-inline-block">
|
||||
<button class="btn btn-default btn-xs" id="profbonusdice"
|
||||
title="See the Dungeon Master's Guide, p263.">Use Proficiency Dice
|
||||
</button>
|
||||
<button type="button" class="btn btn-default btn-xs" id="profbonusdice" title="See the Dungeon Master's Guide, p263.">Use Proficiency Dice</button>
|
||||
</div>
|
||||
<button class="btn btn-default btn-xs" id="btn-book">Printer View</button>
|
||||
<button class="btn btn-default btn-xs" id="btn-show-table" title="View and Download Creatures in Tabular Format">Table View</button>
|
||||
<button class="btn btn-xs btn-info" id="manage-brew">Manage Homebrew</button>
|
||||
<button type="button" class="btn btn-default btn-xs" id="btn-book">Printer View</button>
|
||||
<button type="button" class="btn btn-default btn-xs" id="btn-show-table" title="View and Download Creatures in Tabular Format">Table View</button>
|
||||
<button type="button" class="btn btn-xs btn-info" id="manage-brew">Manage Homebrew</button>
|
||||
</div>
|
||||
|
||||
<div class="best-ecgen__visible--flex-col best-ecgen__wrp pb-1 px-2" id="wrp-encounterbuild-group-and-difficulty"></div>
|
||||
|
||||
@@ -6,8 +6,8 @@
|
||||
{{> "listWrpPagecontent" }}
|
||||
|
||||
<div class="ve-text-center mt-2 no-print">
|
||||
<button class="btn btn-default btn-xs" id="btn-book">Printer View</button>
|
||||
<button class="btn btn-default btn-xs" id="btn-show-table" title="View and Download Items in Tabular Format">Table View</button>
|
||||
<button class="btn btn-xs btn-info" id="manage-brew">Manage Homebrew</button>
|
||||
<button type="button" class="btn btn-default btn-xs" id="btn-book">Printer View</button>
|
||||
<button type="button" class="btn btn-default btn-xs" id="btn-show-table" title="View and Download Items in Tabular Format">Table View</button>
|
||||
<button type="button" class="btn btn-xs btn-info" id="manage-brew">Manage Homebrew</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
<div id="contentwrapper" class="view-col{{#if styleContentWrapperAdditional}} {{styleContentWrapperAdditional}}{{/if}}">
|
||||
{{> "listSublistContainer" }}
|
||||
|
||||
{{> "listStatsTabs" }}
|
||||
|
||||
{{> "listWrpPagecontent" }}
|
||||
|
||||
<div class="ve-text-center mt-2 no-print">
|
||||
<button type="button" class="btn btn-default btn-xs" id="btn-book">Book View</button>
|
||||
<button type="button" class="btn btn-default btn-xs" id="btn-show-table" title="View and Download Psionics in Tabular Format">Table View</button>
|
||||
<button type="button" class="btn btn-xs btn-info" id="manage-brew">Manage Homebrew</button>
|
||||
</div>
|
||||
</div>
|
||||
@@ -0,0 +1,12 @@
|
||||
<div id="contentwrapper" class="view-col{{#if styleContentWrapperAdditional}} {{styleContentWrapperAdditional}}{{/if}}">
|
||||
{{> "listSublistContainer" }}
|
||||
|
||||
{{> "listStatsTabs" }}
|
||||
|
||||
{{> "listWrpPagecontent" }}
|
||||
|
||||
<div class="split-v-center mt-2 no-print">
|
||||
<div class="ve-small ve-muted italic mr-2" title="We gratefully accept any and all corrections in our Discord, a link to which can be found on the homepage.">Please note that allergen and other dietary information may be incomplete and/or inaccurate.</div>
|
||||
<button type="button" class="btn btn-xs btn-info" id="manage-brew">Manage Homebrew</button>
|
||||
</div>
|
||||
</div>
|
||||
@@ -0,0 +1,14 @@
|
||||
<div id="contentwrapper" class="view-col{{#if styleContentWrapperAdditional}} {{styleContentWrapperAdditional}}{{/if}}">
|
||||
{{> "listSublistContainer" }}
|
||||
|
||||
{{> "listStatsTabs" }}
|
||||
|
||||
{{> "listWrpPagecontent" }}
|
||||
|
||||
<div class="ve-text-center mt-2 no-print">
|
||||
<button type="button" class="btn btn-default btn-xs" id="btn-book">Book View</button>
|
||||
<button type="button" class="btn btn-default btn-xs" id="btn-show-table" title="View and Download Spells in Tabular Format">Table View</button>
|
||||
<button type="button" class="btn btn-xs btn-info" id="manage-brew">Manage Homebrew</button>
|
||||
<button type="button" class="btn btn-default btn-xs" id="btn-list-settings" title="Settings"><span class="glyphicon glyphicon-cog"></span></button>
|
||||
</div>
|
||||
</div>
|
||||
@@ -2,7 +2,9 @@
|
||||
{{> "listSublistContainer" }}
|
||||
|
||||
{{> "listStatsTabs" }}
|
||||
{{#if isWrpToken}}
|
||||
|
||||
{{> "listRhsWrpToken" }}{{/if}}
|
||||
{{> "listWrpPagecontent" }}
|
||||
|
||||
{{> "listRhsWrpFooterControls" }}
|
||||
|
||||
@@ -4,5 +4,5 @@
|
||||
<div id="lst__search-glass" class="lst__wrp-search-glass no-events ve-flex-vh-center"><span class="glyphicon glyphicon-search"></span></div>
|
||||
<div class="lst__wrp-search-visible no-events ve-flex-vh-center"></div>
|
||||
</div>
|
||||
<button class="btn btn-default" id="reset">Reset</button>
|
||||
<button type="button" class="btn btn-default" id="reset">Reset</button>
|
||||
</div>
|
||||
|
||||
@@ -6,15 +6,15 @@
|
||||
<div id="lst__search-glass" class="lst__wrp-search-glass no-events ve-flex-vh-center"><span class="glyphicon glyphicon-search"></span></div>
|
||||
<div class="lst__wrp-search-visible no-events ve-flex-vh-center"></div>
|
||||
</div>
|
||||
<button class="btn btn-default" id="reset">Reset</button>
|
||||
<button type="button" class="btn btn-default" id="reset">Reset</button>
|
||||
</div>
|
||||
|
||||
<div id="filtertools-mundane" class="ele-mundane input-group input-group--bottom ve-flex no-shrink">
|
||||
<button class="ve-col-3-5 sort btn btn-default btn-xs" data-sort="name" data-sortby="asc">Name</button>
|
||||
<button class="ve-col-4-5 sort btn btn-default btn-xs" data-sort="type" data-sortby="asc">Type</button>
|
||||
<button class="ve-col-1-5 sort btn btn-default btn-xs" data-sort="cost" data-sortby="asc">Cost</button>
|
||||
<button class="ve-col-1-5 sort btn btn-default btn-xs" data-sort="weight" data-sortby="asc">Weight</button>
|
||||
<button class="sort btn btn-default btn-xs ve-grow" data-sort="source" data-sortby="asc">Source</button>
|
||||
<button type="button" class="ve-col-3-5 sort btn btn-default btn-xs" data-sort="name" data-sortby="asc">Name</button>
|
||||
<button type="button" class="ve-col-4-5 sort btn btn-default btn-xs" data-sort="type" data-sortby="asc">Type</button>
|
||||
<button type="button" class="ve-col-1-5 sort btn btn-default btn-xs" data-sort="cost" data-sortby="asc">Cost</button>
|
||||
<button type="button" class="ve-col-1-5 sort btn btn-default btn-xs" data-sort="weight" data-sortby="asc">Weight</button>
|
||||
<button type="button" class="sort btn btn-default btn-xs ve-grow" data-sort="source" data-sortby="asc">Source</button>
|
||||
</div>
|
||||
|
||||
<div class="list list--stats mundane ele-mundane"></div>
|
||||
@@ -25,12 +25,12 @@
|
||||
<div class="no-shrink itm__list-divider ele-mundane-and-magic"></div>
|
||||
|
||||
<div id="filtertools-magic" class="ele-magic input-group input-group--bottom ve-flex no-shrink">
|
||||
<button class="fullborder ve-col-3-5 sort btn btn-default btn-xs" data-sort="name" data-sortby="asc">Name</button>
|
||||
<button class="fullborder ve-col-4 sort btn btn-default btn-xs" data-sort="type" data-sortby="asc">Type</button>
|
||||
<button class="fullborder ve-col-1-5 sort btn btn-default btn-xs" data-sort="weight" data-sortby="asc">Weight</button>
|
||||
<button class="ve-col-0-6 sort btn btn-default btn-xs" data-sort="attunement" title="Can Be Attuned">A.</button>
|
||||
<button class="fullborder ve-col-1-4 sort btn btn-default btn-xs" data-sort="rarity" data-sortby="asc">Rarity</button>
|
||||
<button class="fullborder sort btn btn-default btn-xs ve-grow" data-sort="source" data-sortby="asc">Source</button>
|
||||
<button type="button" class="fullborder ve-col-3-5 sort btn btn-default btn-xs" data-sort="name" data-sortby="asc">Name</button>
|
||||
<button type="button" class="fullborder ve-col-4 sort btn btn-default btn-xs" data-sort="type" data-sortby="asc">Type</button>
|
||||
<button type="button" class="fullborder ve-col-1-5 sort btn btn-default btn-xs" data-sort="weight" data-sortby="asc">Weight</button>
|
||||
<button type="button" class="ve-col-0-6 sort btn btn-default btn-xs" data-sort="attunement" title="Can Be Attuned">A.</button>
|
||||
<button type="button" class="fullborder ve-col-1-4 sort btn btn-default btn-xs" data-sort="rarity" data-sortby="asc">Rarity</button>
|
||||
<button type="button" class="fullborder sort btn btn-default btn-xs ve-grow" data-sort="source" data-sortby="asc">Source</button>
|
||||
</div>
|
||||
|
||||
<div class="list list--stats magic ele-magic"></div>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<div class="ve-text-center mt-2 no-print">
|
||||
{{#if isPrinterView}}
|
||||
<button class="btn btn-default btn-xs" id="btn-book">Printer View</button>
|
||||
<button type="button" class="btn btn-default btn-xs" id="btn-book">Printer View</button>
|
||||
{{/if}}
|
||||
<button class="btn btn-xs btn-info" id="manage-brew">Manage Homebrew</button>
|
||||
<button type="button" class="btn btn-xs btn-info" id="manage-brew">Manage Homebrew</button>
|
||||
</div>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<div id="wrp-pagecontent" class="wrp-stats-table{{#if isStyleBook}} wrp-stats-table--book{{/if}}">
|
||||
<table id="pagecontent" class="w-100 stats{{#if isStyleBook}} stats--book{{/if}}">
|
||||
<table id="pagecontent" class="w-100 stats{{#if isStyleBook}} stats--book{{/if}}{{#if stylePageContentAdditional}} {{stylePageContentAdditional}}{{/if}}"{{#if onscrollPageContent}} onscroll="{{onscrollPageContent}}"{{/if}}>
|
||||
<tr><th class="border" colspan="6"></th></tr>
|
||||
<tr><td colspan="6" class="initial-message">Select an entry from the list to view it here</td></tr>
|
||||
<tr><th class="border" colspan="6"></th></tr>
|
||||
|
||||
@@ -12,8 +12,10 @@ const FILE_BLOCKLIST = new Set([
|
||||
"life.json",
|
||||
"makecards.json",
|
||||
"renderdemo.json",
|
||||
"foundry.json",
|
||||
"makebrew-creature.json",
|
||||
"sources.json",
|
||||
"fluff-index.json",
|
||||
"changelog.json",
|
||||
|
||||
"index-meta.json",
|
||||
"index-props.json",
|
||||
@@ -41,6 +43,7 @@ const _FILE_PROP_ORDER = [
|
||||
|
||||
"optionalfeature",
|
||||
"optionalfeatureFluff",
|
||||
"foundryOptionalfeature",
|
||||
|
||||
"background",
|
||||
"backgroundFeature",
|
||||
@@ -168,7 +171,21 @@ const _FILE_PROP_ORDER = [
|
||||
// endregion
|
||||
];
|
||||
|
||||
const KEY_BLOCKLIST = new Set(["data", "itemTypeAdditionalEntries", "itemType", "itemProperty", "itemEntry"]);
|
||||
const KEY_BLOCKLIST = new Set([
|
||||
"data",
|
||||
"itemTypeAdditionalEntries",
|
||||
"itemType",
|
||||
"itemProperty",
|
||||
"itemEntry",
|
||||
"raceFluffMeta",
|
||||
"linkedLootTables",
|
||||
]);
|
||||
|
||||
const PRIMITIVE_TYPES = new Set([
|
||||
"boolean",
|
||||
"number",
|
||||
"string",
|
||||
]);
|
||||
|
||||
const PROPS_TO_UNHANDLED_KEYS = {};
|
||||
|
||||
@@ -185,6 +202,7 @@ function getFnListSort (prop) {
|
||||
case "makebrewCreatureTrait":
|
||||
case "makebrewCreatureAction":
|
||||
case "action":
|
||||
case "foundryAction":
|
||||
case "background":
|
||||
case "legendaryGroup":
|
||||
case "language":
|
||||
@@ -199,6 +217,7 @@ function getFnListSort (prop) {
|
||||
case "foundryFeat":
|
||||
case "vehicle":
|
||||
case "vehicleUpgrade":
|
||||
case "foundryVehicleUpgrade":
|
||||
case "backgroundFluff":
|
||||
case "featFluff":
|
||||
case "optionalfeatureFluff":
|
||||
@@ -210,17 +229,22 @@ function getFnListSort (prop) {
|
||||
case "objectFluff":
|
||||
case "raceFluff":
|
||||
case "item":
|
||||
case "foundryItem":
|
||||
case "baseitem":
|
||||
case "magicvariant":
|
||||
case "foundryMagicvariant":
|
||||
case "itemGroup":
|
||||
case "itemMastery":
|
||||
case "object":
|
||||
case "optionalfeature":
|
||||
case "foundryOptionalfeature":
|
||||
case "psionic":
|
||||
case "reward":
|
||||
case "foundryReward":
|
||||
case "rewardFluff":
|
||||
case "variantrule":
|
||||
case "race":
|
||||
case "foundryRace":
|
||||
case "foundryRaceFeature":
|
||||
case "table":
|
||||
case "trap":
|
||||
@@ -244,6 +268,7 @@ function getFnListSort (prop) {
|
||||
case "foundryClass":
|
||||
return (a, b) => SortUtil.ascSortDateString(Parser.sourceJsonToDate(b.source), Parser.sourceJsonToDate(a.source)) || SortUtil.ascSortLower(a.name, b.name) || SortUtil.ascSortLower(a.source, b.source);
|
||||
case "subclass":
|
||||
case "foundrySubclass":
|
||||
return (a, b) => SortUtil.ascSortDateString(Parser.sourceJsonToDate(b.source), Parser.sourceJsonToDate(a.source)) || SortUtil.ascSortLower(a.name, b.name);
|
||||
case "classFeature":
|
||||
case "foundryClassFeature":
|
||||
@@ -277,24 +302,49 @@ function getFnListSort (prop) {
|
||||
}
|
||||
}
|
||||
|
||||
export const getPrettified = json => {
|
||||
export const getPrettified = (json, {isFoundryPrefixKeys = false} = {}) => {
|
||||
let isModified = false;
|
||||
|
||||
// region Sort keys within entities
|
||||
Object.entries(json)
|
||||
.filter(([k, v]) => !KEY_BLOCKLIST.has(k) && v instanceof Array)
|
||||
.filter(([k]) => !KEY_BLOCKLIST.has(k))
|
||||
.forEach(([k, v]) => {
|
||||
if (PropOrder.hasOrder(k)) {
|
||||
PROPS_TO_UNHANDLED_KEYS[k] = PROPS_TO_UNHANDLED_KEYS[k] || new Set();
|
||||
if (v == null || PRIMITIVE_TYPES.has(typeof v)) return;
|
||||
|
||||
json[k] = v.map(it => PropOrder.getOrdered(it, k, {fnUnhandledKey: uk => PROPS_TO_UNHANDLED_KEYS[k].add(uk)}));
|
||||
const kMod = isFoundryPrefixKeys && !k.startsWith("_") ? `foundry${k.uppercaseFirst()}` : k;
|
||||
|
||||
json[k].sort(getFnListSort(k));
|
||||
|
||||
isModified = true;
|
||||
if (!PropOrder.hasOrder(kMod)) {
|
||||
console.warn(`\t\tUnhandled property: "${kMod}"`);
|
||||
return;
|
||||
}
|
||||
console.warn(`\t\tUnhandled property: "${k}"`);
|
||||
|
||||
PROPS_TO_UNHANDLED_KEYS[kMod] = PROPS_TO_UNHANDLED_KEYS[kMod] || new Set();
|
||||
|
||||
if (json[k] instanceof Array) {
|
||||
json[k] = v.map(it => PropOrder.getOrdered(
|
||||
it,
|
||||
kMod,
|
||||
{
|
||||
fnUnhandledKey: uk => {
|
||||
PROPS_TO_UNHANDLED_KEYS[kMod].add(uk);
|
||||
},
|
||||
},
|
||||
));
|
||||
|
||||
json[k].sort(getFnListSort(kMod));
|
||||
} else {
|
||||
json[k] = PropOrder.getOrdered(
|
||||
v,
|
||||
kMod,
|
||||
{
|
||||
fnUnhandledKey: uk => {
|
||||
PROPS_TO_UNHANDLED_KEYS[kMod].add(uk);
|
||||
},
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
isModified = true;
|
||||
});
|
||||
// endregion
|
||||
|
||||
@@ -321,7 +371,12 @@ export const getPrettified = json => {
|
||||
export const prettifyFile = file => {
|
||||
console.log(`\tPrettifying ${file}...`);
|
||||
const json = ut.readJson(file);
|
||||
const {json: jsonPrettified, isModified} = getPrettified(json);
|
||||
const {json: jsonPrettified, isModified} = getPrettified(
|
||||
json,
|
||||
{
|
||||
isFoundryPrefixKeys: file.includes("foundry.json") || file.split("/").last().startsWith("foundry-"),
|
||||
},
|
||||
);
|
||||
if (isModified) fs.writeFileSync(file, CleanUtil.getCleanJson(jsonPrettified), "utf-8");
|
||||
};
|
||||
|
||||
|
||||
@@ -10,6 +10,9 @@ function run (args) {
|
||||
TagJsons._BLOCKLIST_FILE_PREFIXES = [
|
||||
...ut.FILE_PREFIX_BLOCKLIST,
|
||||
|
||||
"foundry-",
|
||||
"foundry.json",
|
||||
|
||||
// specific files
|
||||
"demo.json",
|
||||
];
|
||||
|
||||
@@ -22,13 +22,17 @@ const FILE_EXTENSION_ALLOWLIST = [
|
||||
|
||||
const FILE_PREFIX_BLOCKLIST = [
|
||||
"bookref-",
|
||||
"foundry-",
|
||||
"gendata-",
|
||||
];
|
||||
|
||||
const DIR_PREFIX_BLOCKLIST = [
|
||||
"_",
|
||||
];
|
||||
|
||||
const DIR_BLOCKLIST = [
|
||||
".git",
|
||||
".idea",
|
||||
"node_modules",
|
||||
];
|
||||
|
||||
/**
|
||||
@@ -40,6 +44,7 @@ const DIR_PREFIX_BLOCKLIST = [
|
||||
* @param [opts.allowlistFileExts] Allowlisted filename extensions (case sensitive).
|
||||
* @param [opts.dir] Directory to list.
|
||||
* @param [opts.allowlistDirs] Directory allowlist.
|
||||
* @param [opts.blocklistDirs] Directory blocklist.
|
||||
*/
|
||||
function listFiles (opts) {
|
||||
opts = opts || {};
|
||||
@@ -48,6 +53,7 @@ function listFiles (opts) {
|
||||
opts.blocklistDirPrefixes = opts.blocklistDirPrefixes === undefined ? DIR_PREFIX_BLOCKLIST : opts.blocklistDirPrefixes;
|
||||
opts.allowlistFileExts = opts.allowlistFileExts === undefined ? FILE_EXTENSION_ALLOWLIST : opts.allowlistFileExts;
|
||||
opts.allowlistDirs = opts.allowlistDirs || null;
|
||||
opts.blocklistDirs = opts.blocklistDirs === undefined ? DIR_BLOCKLIST : opts.blocklistDirs;
|
||||
|
||||
const dirContent = fs.readdirSync(opts.dir, "utf8")
|
||||
.filter(file => {
|
||||
@@ -55,6 +61,7 @@ function listFiles (opts) {
|
||||
|
||||
if (isDirectory(path)) {
|
||||
if (opts.blocklistDirPrefixes != null && opts.blocklistDirPrefixes.some(it => file.startsWith(it))) return false;
|
||||
if (opts.blocklistDirs != null && opts.blocklistDirs.some(it => it === file)) return false;
|
||||
return opts.allowlistDirs ? opts.allowlistDirs.includes(path) : true;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user