This commit is contained in:
TheGiddyLimit
2024-01-01 19:34:49 +00:00
parent 332769043f
commit 8117ebddc5
1748 changed files with 2544409 additions and 1 deletions

36
js/adventure.js Normal file
View 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"));
}