mirror of
https://github.com/Kornstalx/5etools-mirror-2.github.io.git
synced 2025-10-28 20:45:35 -05:00
v1.198.1
This commit is contained in:
36
js/adventure.js
Normal file
36
js/adventure.js
Normal file
@@ -0,0 +1,36 @@
|
||||
"use strict";
|
||||
|
||||
const CONTENTS_URL = "data/adventures.json";
|
||||
|
||||
window.addEventListener("load", async () => {
|
||||
BookUtil.$dispBook = $(`#pagecontent`);
|
||||
await Promise.all([
|
||||
PrereleaseUtil.pInit(),
|
||||
BrewUtil2.pInit(),
|
||||
]);
|
||||
ExcludeUtil.pInitialise().then(null); // don't await, as this is only used for search
|
||||
DataUtil.loadJSON(CONTENTS_URL).then(onJsonLoad);
|
||||
});
|
||||
|
||||
async function onJsonLoad (data) {
|
||||
BookUtil.baseDataUrl = "data/adventure/adventure-";
|
||||
BookUtil.allPageUrl = "adventures.html";
|
||||
BookUtil.propHomebrewData = "adventureData";
|
||||
BookUtil.typeTitle = "Adventure";
|
||||
BookUtil.initLinkGrabbers();
|
||||
BookUtil.initScrollTopFloat();
|
||||
|
||||
BookUtil.contentType = "adventure";
|
||||
|
||||
BookUtil.bookIndex = data?.adventure || [];
|
||||
|
||||
$(`.book-head-message`).text(`Select an adventure from the list on the left`);
|
||||
$(`.book-loading-message`).text(`Select an adventure to begin`);
|
||||
|
||||
BookUtil.bookIndexPrerelease = (await PrereleaseUtil.pGetBrewProcessed())?.adventure || [];
|
||||
BookUtil.bookIndexBrew = (await BrewUtil2.pGetBrewProcessed())?.adventure || [];
|
||||
|
||||
window.onhashchange = BookUtil.booksHashChange.bind(BookUtil);
|
||||
await BookUtil.booksHashChange();
|
||||
window.dispatchEvent(new Event("toolsLoaded"));
|
||||
}
|
||||
Reference in New Issue
Block a user