mirror of
https://github.com/Kornstalx/5etools-mirror-2.github.io.git
synced 2025-10-28 20:45:35 -05:00
37 lines
1.1 KiB
JavaScript
37 lines
1.1 KiB
JavaScript
"use strict";
|
|
|
|
const JSON_URL = "data/books.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(JSON_URL).then(onJsonLoad);
|
|
});
|
|
|
|
async function onJsonLoad (data) {
|
|
BookUtil.baseDataUrl = "data/book/book-";
|
|
BookUtil.allPageUrl = "books.html";
|
|
BookUtil.propHomebrewData = "bookData";
|
|
BookUtil.typeTitle = "Book";
|
|
BookUtil.initLinkGrabbers();
|
|
BookUtil.initScrollTopFloat();
|
|
|
|
BookUtil.contentType = "book";
|
|
|
|
BookUtil.bookIndex = data?.book || [];
|
|
|
|
$(`.book-head-message`).text(`Select a book from the list on the left`);
|
|
$(`.book-loading-message`).text(`Select a book to begin`);
|
|
|
|
BookUtil.bookIndexPrerelease = (await PrereleaseUtil.pGetBrewProcessed())?.book || [];
|
|
BookUtil.bookIndexBrew = (await BrewUtil2.pGetBrewProcessed())?.book || [];
|
|
|
|
window.onhashchange = BookUtil.booksHashChange.bind(BookUtil);
|
|
await BookUtil.booksHashChange();
|
|
window.dispatchEvent(new Event("toolsLoaded"));
|
|
}
|