mirror of
https://github.com/Kornstalx/5etools-mirror-2.github.io.git
synced 2025-10-28 20:45:35 -05:00
v1.206.0
This commit is contained in:
@@ -36,13 +36,13 @@ const baseSitemapData = (() => {
|
||||
return out;
|
||||
})();
|
||||
|
||||
const getTemplate = (page, source, hash, textStyle, isFluff) => `<!DOCTYPE html><html lang="en"><head>
|
||||
const getTemplate = ({page, name, source, hash, img, textStyle, isFluff}) => `<!DOCTYPE html><html lang="en"><head>
|
||||
<!--5ETOOLS_CMP-->
|
||||
<!--5ETOOLS_ANALYTICS-->
|
||||
<!--5ETOOLS_ADCODE-->
|
||||
<meta charset="utf-8"><meta name="description" content=""><meta http-equiv="X-UA-Compatible" content="IE=edge"><meta name="viewport" content="width=device-width, initial-scale=1, viewport-fit=cover"><meta name="apple-mobile-web-app-capable" content="yes"><title>5etools</title><link rel="stylesheet" href="/css/bootstrap.css?v=${version}"><link rel="stylesheet" href="/css/main.css"><link rel="icon" type="image/svg+xml" href="/favicon.svg"><link rel="icon" type="image/png" sizes="256x256" href="/favicon-256x256.png"><link rel="icon" type="image/png" sizes="144x144" href="/favicon-144x144.png"><link rel="icon" type="image/png" sizes="128x128" href="/favicon-128x128.png"><link rel="icon" type="image/png" sizes="64x64" href="/favicon-64x64.png"><link rel="icon" type="image/png" sizes="48x48" href="/favicon-48x48.png"><link rel="icon" type="image/png" sizes="32x32" href="/favicon-32x32.png"><link rel="icon" type="image/png" sizes="16x16" href="/favicon-16x16.png"><link rel="manifest" href="/manifest.webmanifest"><meta name="application-name" content="5etools"><meta name="theme-color" content="#006bc4"><meta name="msapplication-config" content="browserconfig.xml"/><meta name="msapplication-TileColor" content="#006bc4"><link rel="apple-touch-icon" sizes="180x180" href="/apple-touch-icon-180x180.png"><link rel="apple-touch-icon" sizes="360x360" href="/apple-touch-icon-360x360.png"><link rel="apple-touch-icon" sizes="167x167" href="/apple-touch-icon-167x167.png"><link rel="apple-touch-icon" sizes="152x152" href="/apple-touch-icon-152x152.png"><link rel="apple-touch-icon" sizes="120x120" href="/apple-touch-icon-120x120.png"><meta name="apple-mobile-web-app-title" content="5etools"><link rel="mask-icon" href="/safari-pinned-tab.svg" color="#006bc4"><link rel="search" href="/open-search.xml" title="Search 5etools" type="application/opensearchdescription+xml"><script type="text/javascript" src="/js/header.js?v=${VERSION_NUMBER}"></script><script>_SEO_PAGE="${page}";_SEO_SOURCE="${source}";_SEO_HASH="${hash}";_SEO_STYLE=${textStyle};_SEO_FLUFF=${isFluff}</script></head><body><div class="cancer__wrp-sidebar-rhs cancer__anchor"><div class="cancer__disp-cancer"></div><div class="cancer__sidebar-rhs-inner cancer__sidebar-rhs-inner--top"><!--5ETOOLS_AD_RIGHT_1--></div><div class="cancer__sidebar-rhs-inner cancer__sidebar-rhs-inner--bottom"><!--5ETOOLS_AD_RIGHT_2--></div></div><div class="cancer__wrp-leaderboard cancer__anchor"><div class="cancer__disp-cancer"></div><div class="cancer__wrp-leaderboard-inner"><!--5ETOOLS_AD_LEADERBOARD--></div></div><header class="hidden-xs hidden-sm page__header"><div class="container ve-flex-v-baseline"><h1 class="page__title no-wrap my-0"></h1></div></header><nav class="container page__nav" id="navigation"><ul class="nav nav-pills page__nav-inner" id="navbar"></ul></nav><main class="container"><div class="row"><div id="wrp-pagecontent"><table id="pagecontent" class="w-100 stats"><tr><th class="border" colspan="6"></th></tr><tr><td colspan="6" class="initial-message">Loading...</td></tr><tr><th class="border" colspan="6"></th></tr></table></div></div><div class="row" id="link-page"></div></main><script type="text/javascript" src="https://cdn.jsdelivr.net/combine/npm/jquery@3.4.1/dist/jquery.min.js,gh/weixsong/elasticlunr.js@0.9/elasticlunr.min.js"></script><script type="text/javascript" src="/lib/localforage.js"></script></script></script><script type="text/javascript" src="/js/shared.js?v=${VERSION_NUMBER}"></script><script type="text/javascript" src="/js/render-${page}.js?v=${VERSION_NUMBER}"></script><script type="text/javascript" src="/js/seo-loader.js?v=${VERSION_NUMBER}"></script></body></html>`;
|
||||
<meta charset="utf-8"><meta name="description" content=""><meta http-equiv="X-UA-Compatible" content="IE=edge"><meta name="viewport" content="width=device-width, initial-scale=1, viewport-fit=cover"><meta name="apple-mobile-web-app-capable" content="yes"><title>5etools</title><link rel="stylesheet" href="/css/bootstrap.css?v=${version}"><link rel="stylesheet" href="/css/main.css"><link rel="icon" type="image/svg+xml" href="/favicon.svg"><link rel="icon" type="image/png" sizes="256x256" href="/favicon-256x256.png"><link rel="icon" type="image/png" sizes="144x144" href="/favicon-144x144.png"><link rel="icon" type="image/png" sizes="128x128" href="/favicon-128x128.png"><link rel="icon" type="image/png" sizes="64x64" href="/favicon-64x64.png"><link rel="icon" type="image/png" sizes="48x48" href="/favicon-48x48.png"><link rel="icon" type="image/png" sizes="32x32" href="/favicon-32x32.png"><link rel="icon" type="image/png" sizes="16x16" href="/favicon-16x16.png"><link rel="manifest" href="/manifest.webmanifest"><meta name="application-name" content="5etools"><meta name="theme-color" content="#006bc4"><meta name="msapplication-config" content="browserconfig.xml"/><meta name="msapplication-TileColor" content="#006bc4"><link rel="apple-touch-icon" sizes="180x180" href="/apple-touch-icon-180x180.png"><link rel="apple-touch-icon" sizes="360x360" href="/apple-touch-icon-360x360.png"><link rel="apple-touch-icon" sizes="167x167" href="/apple-touch-icon-167x167.png"><link rel="apple-touch-icon" sizes="152x152" href="/apple-touch-icon-152x152.png"><link rel="apple-touch-icon" sizes="120x120" href="/apple-touch-icon-120x120.png"><meta name="apple-mobile-web-app-title" content="5etools"><link rel="mask-icon" href="/safari-pinned-tab.svg" color="#006bc4"><meta property="og:title" content="${name}"><meta property="og:url" content="${BASE_SITE_URL}${page}.html#${hash}">${img ? `<meta property="og:image" content="${BASE_SITE_URL}${img}">` : ""}<link rel="search" href="/open-search.xml" title="Search 5etools" type="application/opensearchdescription+xml"><script type="text/javascript" src="/js/header.js?v=${VERSION_NUMBER}"></script><script>_SEO_PAGE="${page}";_SEO_SOURCE="${source}";_SEO_HASH="${hash}";_SEO_STYLE=${textStyle};_SEO_FLUFF=${isFluff}</script></head><body><div class="cancer__wrp-sidebar-rhs cancer__anchor"><div class="cancer__disp-cancer"></div><div class="cancer__sidebar-rhs-inner cancer__sidebar-rhs-inner--top"><!--5ETOOLS_AD_RIGHT_1--></div><div class="cancer__sidebar-rhs-inner cancer__sidebar-rhs-inner--bottom"><!--5ETOOLS_AD_RIGHT_2--></div></div><div class="cancer__wrp-leaderboard cancer__anchor"><div class="cancer__disp-cancer"></div><div class="cancer__wrp-leaderboard-inner"><!--5ETOOLS_AD_LEADERBOARD--></div></div><header class="hidden-xs hidden-sm page__header"><div class="container ve-flex-v-baseline"><h1 class="page__title no-wrap my-0"></h1></div></header><nav class="container page__nav" id="navigation"><ul class="nav nav-pills page__nav-inner" id="navbar"></ul></nav><main class="container"><div class="row"><div id="wrp-pagecontent"><table id="pagecontent" class="w-100 stats"><tr><th class="border" colspan="6"></th></tr><tr><td colspan="6" class="initial-message">Loading...</td></tr><tr><th class="border" colspan="6"></th></tr></table></div></div><div class="row" id="link-page"></div></main><script type="text/javascript" src="https://cdn.jsdelivr.net/combine/npm/jquery@3.4.1/dist/jquery.min.js,gh/weixsong/elasticlunr.js@0.9/elasticlunr.min.js"></script><script type="text/javascript" src="/lib/localforage.js"></script></script></script><script type="text/javascript" src="/js/shared.js?v=${VERSION_NUMBER}"></script><script type="text/javascript" src="/js/render-${page}.js?v=${VERSION_NUMBER}"></script><script type="text/javascript" src="/js/seo-loader.js?v=${VERSION_NUMBER}"></script></body></html>`;
|
||||
|
||||
const getTemplateDev = (page, source, hash, textStyle, isFluff) => `<!DOCTYPE html><html lang="en"><head>
|
||||
const getTemplateDev = ({page, name, source, hash, img, textStyle, isFluff}) => `<!DOCTYPE html><html lang="en"><head>
|
||||
<!--5ETOOLS_CMP-->
|
||||
<!--5ETOOLS_ANALYTICS-->
|
||||
<!--5ETOOLS_ADCODE-->
|
||||
@@ -74,6 +74,9 @@ const getTemplateDev = (page, source, hash, textStyle, isFluff) => `<!DOCTYPE ht
|
||||
<link rel="apple-touch-icon" sizes="120x120" href="/apple-touch-icon-120x120.png">
|
||||
<meta name="apple-mobile-web-app-title" content="5etools">
|
||||
<link rel="mask-icon" href="/safari-pinned-tab.svg" color="#006bc4">
|
||||
<meta property="og:title" content="${name}">
|
||||
<meta property="og:url" content="${BASE_SITE_URL}${page}.html#${hash}">
|
||||
${img ? `<meta property="og:image" content="${BASE_SITE_URL}${img}">` : ""}
|
||||
<script type="text/javascript" src="/js/styleswitch.js"></script>
|
||||
<script type="text/javascript" src="/js/navigation.js"></script>
|
||||
<script type="text/javascript" src="/js/browsercheck.js"></script>
|
||||
@@ -107,38 +110,37 @@ const getTemplateDev = (page, source, hash, textStyle, isFluff) => `<!DOCTYPE ht
|
||||
const toGenerate = [
|
||||
{
|
||||
page: "spells",
|
||||
pGetEntries: () => {
|
||||
const index = ut.readJson(`data/spells/index.json`);
|
||||
const fileData = Object.entries(index)
|
||||
.filter(([source]) => !isSkipUaEtc || !SourceUtil.isNonstandardSourceWotc(source))
|
||||
.filter(([source]) => !isOnlyVanilla || Parser.SOURCES_VANILLA.has(source))
|
||||
.map(([_, filename]) => ut.readJson(`data/spells/${filename}`));
|
||||
return fileData.map(it => MiscUtil.copy(it.spell)).reduce((a, b) => a.concat(b));
|
||||
pGetEntityMetas: async () => {
|
||||
const entities = (await DataUtil.spell.pLoadAll())
|
||||
.filter(({source}) => !isSkipUaEtc || !SourceUtil.isNonstandardSourceWotc(source))
|
||||
.filter(({source}) => !isOnlyVanilla || Parser.SOURCES_VANILLA.has(source));
|
||||
return entities.pSerialAwaitMap(async ent => ({entity: ent, fluff: await Renderer.spell.pGetFluff(ent)}));
|
||||
},
|
||||
style: 1,
|
||||
isFluff: 1,
|
||||
},
|
||||
{
|
||||
page: "bestiary",
|
||||
pGetEntries: () => {
|
||||
const index = ut.readJson(`data/bestiary/index.json`);
|
||||
const fileData = Object.entries(index)
|
||||
.filter(([source]) => !isSkipUaEtc || !SourceUtil.isNonstandardSourceWotc(source))
|
||||
.filter(([source]) => !isOnlyVanilla || Parser.SOURCES_VANILLA.has(source))
|
||||
.map(([source, filename]) => ({source: source, json: ut.readJson(`data/bestiary/${filename}`)}));
|
||||
// Filter to prevent duplicates from "otherSources" copies
|
||||
return fileData.map(it => MiscUtil.copy(it.json.monster.filter(mon => mon.source === it.source))).reduce((a, b) => a.concat(b));
|
||||
pGetEntityMetas: async () => {
|
||||
const entities = (await DataUtil.monster.pLoadAll())
|
||||
.filter(({source}) => !isSkipUaEtc || !SourceUtil.isNonstandardSourceWotc(source))
|
||||
.filter(({source}) => !isOnlyVanilla || Parser.SOURCES_VANILLA.has(source));
|
||||
return entities.pSerialAwaitMap(async ent => ({
|
||||
entity: ent,
|
||||
fluff: await Renderer.monster.pGetFluff(ent),
|
||||
img: Renderer.monster.hasToken(ent) ? Renderer.monster.getTokenUrl(ent) : null,
|
||||
}));
|
||||
},
|
||||
style: 2,
|
||||
isFluff: 1,
|
||||
},
|
||||
{
|
||||
page: "items",
|
||||
pGetEntries: async () => {
|
||||
const out = (await Renderer.item.pBuildList()).filter(it => !it._isItemGroup);
|
||||
return out
|
||||
pGetEntityMetas: async () => {
|
||||
const entities = (await Renderer.item.pBuildList()).filter(it => !it._isItemGroup)
|
||||
.filter(it => !isSkipUaEtc || !SourceUtil.isNonstandardSourceWotc(it.source))
|
||||
.filter(it => !isOnlyVanilla || Parser.SOURCES_VANILLA.has(it.source));
|
||||
return entities.pSerialAwaitMap(async ent => ({entity: ent, fluff: await Renderer.item.pGetFluff(ent)}));
|
||||
},
|
||||
style: 1,
|
||||
isFluff: 1,
|
||||
@@ -161,14 +163,14 @@ async function main () {
|
||||
if (err.code !== "EEXIST") throw err;
|
||||
}
|
||||
|
||||
const entries = await meta.pGetEntries();
|
||||
const entityMetas = await meta.pGetEntityMetas();
|
||||
const builder = UrlUtil.URL_TO_HASH_BUILDER[`${meta.page}.html`];
|
||||
entries.forEach(ent => {
|
||||
entityMetas.forEach(({entity, fluff, img}) => {
|
||||
let offset = 0;
|
||||
let html;
|
||||
let path;
|
||||
while (true) {
|
||||
const hash = builder(ent);
|
||||
const hash = builder(entity);
|
||||
const sluggedHash = UrlUtil.getSluggedHash(hash);
|
||||
path = `${meta.page}/${sluggedHash}${offset ? `-${offset}` : ""}.html`;
|
||||
if (siteMapData[path]) {
|
||||
@@ -176,7 +178,19 @@ async function main () {
|
||||
continue;
|
||||
}
|
||||
|
||||
html = (IS_DEV_MODE ? getTemplateDev : getTemplate)(meta.page, ent.source, hash, meta.style, meta.isFluff);
|
||||
if (!img && fluff?.images?.length) {
|
||||
img = Renderer.utils.getEntryMediaUrl(fluff.images[0], "href", "img");
|
||||
}
|
||||
|
||||
html = (IS_DEV_MODE ? getTemplateDev : getTemplate)({
|
||||
page: meta.page,
|
||||
name: entity.name,
|
||||
source: entity.source,
|
||||
hash,
|
||||
img,
|
||||
textStyle: meta.style,
|
||||
isFluff: meta.isFluff,
|
||||
});
|
||||
|
||||
siteMapData[path] = true;
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user