diff --git a/docs/css/styles.css b/docs/css/styles.css index 1b90b6a1..9364f3a1 100644 --- a/docs/css/styles.css +++ b/docs/css/styles.css @@ -9770,10 +9770,6 @@ input[type=text]:disabled{ font-size: 1.25rem; line-height: 1.75rem; } -.text-6xl{ - font-size: 3.75rem; - line-height: 1; -} .text-4xl{ font-size: 2.25rem; line-height: 2.5rem; diff --git a/docs/index.html b/docs/index.html index b33c640f..a959f087 100644 --- a/docs/index.html +++ b/docs/index.html @@ -760,23 +760,7 @@

Creature type -
+
@@ -1443,7 +1427,7 @@

Impor - + diff --git a/docs/js/app.js b/docs/js/app.js index 34125f60..85fcad3e 100644 --- a/docs/js/app.js +++ b/docs/js/app.js @@ -9722,7 +9722,24 @@ function app() { return monster; }).filter(Boolean); this.allMonsters = this.allMonsters.concat(newMonsters); - var environments = Object.values(this.environments); + var environments = {}; + var creatureTypes = new Set(); + var creatureSizes = new Set(); + this.allMonsters.forEach(function (monster) { + monster.environments.split(',').forEach(function (environment) { + if (environment && !environments[environment]) { + var label = environment = environment.trim(); + label = label.slice(0, 1).toUpperCase() + label.slice(1); + environments[environment] = { + value: environment, + label: label + }; + } + }); + creatureTypes.add(monster.data.type); + creatureSizes.add(monster.data.size); + }); + environments = Object.values(environments); environments.sort(function (a, b) { return a.value > b.label ? -1 : 1; }); @@ -9733,6 +9750,21 @@ function app() { window.dispatchEvent(new CustomEvent('set-environments', { detail: environments })); + creatureTypes = Array.from(creatureTypes); + creatureTypes.sort(); + creatureTypes = creatureTypes.map(function (type) { + return { + label: type, + value: type.toLowerCase() + }; + }); + creatureTypes.unshift({ + value: "any", + label: "Any Type" + }); + window.dispatchEvent(new CustomEvent('set-creature-types', { + detail: creatureTypes + })); }, deleteImportedSource: function deleteImportedSource(sourceName) { var sourceToDelete = this.sources[sourceName]; @@ -11541,7 +11573,7 @@ var Importer = /*#__PURE__*/function () { return response.json(); }).then(function (jsonifiedBody) { if (jsonifiedBody.error) { - return [false, "Google responded with an error: \"".concat(jsonifiedBody.error.message, "\" - is your sheet public?")]; + return [false, "Google responded with an error: \"".concat(jsonifiedBody.error.message, "\"")]; } var monsters = jsonifiedBody.sheets.find(function (sheet) { @@ -12349,16 +12381,16 @@ _defineProperty(Importer, "monstersRequiredHeaders", ["name", "cr", "size", "typ _defineProperty(Importer, "loadersHtml", { 'google-sheets': function googleSheets() { - return "\n \n \n "; + return "\n \n \n "; }, 'json-raw': function jsonRaw() { - return "\n \n
\n \n
\n "; + return "\n \n
\n \n
\n "; }, 'json-file': function jsonFile() { - return "\n \n \n "; + return "\n \n \n "; }, 'csv-file': function csvFile() { - return "\n \n
\n \n \n \n \n
\n "; + return "\n \n
\n \n \n \n \n
\n "; } }); @@ -12420,16 +12452,6 @@ var Monster = /*#__PURE__*/function () { this.lair = !!this.data.lair; this.unique = !!this.data.unique; this.alignment = this.data.alignment ? Monster.parseAlignment(this.data.alignment) : ""; - this.environments.split(',').forEach(function (environment) { - if (environment && !_this.app.environments[environment]) { - var label = environment = environment.trim(); - label = label.slice(0, 1).toUpperCase() + label.slice(1); - _this.app.environments[environment] = { - value: environment, - label: label - }; - } - }); this.searchable = [this.data.name, this.data.section, this.data.type, this.data.size, this.data.alignment ? this.alignment.text : "", this.data.cr.string].concat(this.tags).join("|").toLowerCase(); this.sources = this.data.sources.split(', ').map(function (str) { var _str$split = str.split(": "), diff --git a/src/index.html b/src/index.html index b33c640f..a959f087 100644 --- a/src/index.html +++ b/src/index.html @@ -760,23 +760,7 @@

Creature type -
+
@@ -1443,7 +1427,7 @@

Impor - + diff --git a/src/js/app.js b/src/js/app.js index 9ad2f38c..d3aa62a2 100644 --- a/src/js/app.js +++ b/src/js/app.js @@ -436,13 +436,40 @@ function app() { this.allMonsters = this.allMonsters.concat(newMonsters); - let environments = Object.values(this.environments); + let environments = {}; + let creatureTypes = new Set(); + let creatureSizes = new Set(); + this.allMonsters.forEach(monster => { + monster.environments.split(',').forEach(environment => { + if(environment && !environments[environment]){ + let label = environment = environment.trim(); + label = label.slice(0,1).toUpperCase() + label.slice(1); + environments[environment] = { + value: environment, + label: label + } + } + }); + + creatureTypes.add(monster.data.type) + creatureSizes.add(monster.data.size) + }); + + environments = Object.values(environments); environments.sort((a, b) => { return a.value > b.label ? -1 : 1; }); - environments.unshift({ value: "any", label: "Any Environment" }); window.dispatchEvent(new CustomEvent('set-environments', { detail: environments })); + + creatureTypes = Array.from(creatureTypes) + creatureTypes.sort(); + creatureTypes = creatureTypes.map(type => ({ + label: type, + value: type.toLowerCase(), + })); + creatureTypes.unshift({ value: "any", label: "Any Type" }); + window.dispatchEvent(new CustomEvent('set-creature-types', { detail: creatureTypes })); }, deleteImportedSource(sourceName){ diff --git a/src/js/importer.js b/src/js/importer.js index b6c08299..725c7298 100644 --- a/src/js/importer.js +++ b/src/js/importer.js @@ -1,8 +1,8 @@ import * as helpers from './helpers'; export default class Importer { - static key = 'AIzaSyCsGMnu4_lqVj1E0Hsyk7V8CbRpJJauSTM'; + static key = 'AIzaSyCsGMnu4_lqVj1E0Hsyk7V8CbRpJJauSTM'; static loaders = { 'google-sheets': this._importGoogleSheets, @@ -76,7 +76,7 @@ export default class Importer { .then(response => response.json()) .then(jsonifiedBody => { if (jsonifiedBody.error) { - return [false, `Google responded with an error: "${jsonifiedBody.error.message}" - is your sheet public?`]; + return [false, `Google responded with an error: "${jsonifiedBody.error.message}"`]; } const monsters = jsonifiedBody.sheets.find(sheet => sheet.properties.title === 'Monsters'); @@ -246,13 +246,13 @@ export default class Importer { static loadersHtml = { 'google-sheets': () => { return ` - + `; }, 'json-raw': () => { return ` - +
@@ -260,13 +260,13 @@ export default class Importer { }, 'json-file': () => { return ` - + `; }, 'csv-file': () => { return ` - +
diff --git a/src/js/monster.js b/src/js/monster.js index 27ffddb2..879b1213 100644 --- a/src/js/monster.js +++ b/src/js/monster.js @@ -21,18 +21,6 @@ export default class Monster { this.unique = !!this.data.unique; this.alignment = this.data.alignment ? Monster.parseAlignment(this.data.alignment) : ""; - this.environments.split(',').forEach(environment => { - - if(environment && !this.app.environments[environment]){ - let label = environment = environment.trim(); - label = label.slice(0,1).toUpperCase() + label.slice(1); - this.app.environments[environment] = { - value: environment, - label: label - } - } - }); - this.searchable = [ this.data.name, this.data.section,