Files
5etools-mirror-2.github.io/js/books.js
TheGiddyLimit f00d1f3833 v1.201.0
2024-03-10 21:53:34 +00:00

34 lines
894 B
JavaScript

"use strict";
class BooksList extends AdventuresBooksList {
constructor () {
super({
contentsUrl: "data/books.json",
fnSort: AdventuresBooksList._sortAdventuresBooks.bind(AdventuresBooksList),
sortByInitial: "group",
sortDirInitial: "asc",
dataProp: "book",
rootPage: "book.html",
enhanceRowDataFn: (bk) => {
bk._pubDate = new Date(bk.published || "1970-01-01");
},
rowBuilderFn: (bk) => {
return `
<span class="ve-col-1-3 ve-text-center">${AdventuresBooksList._getGroupStr(bk)}</span>
<span class="ve-col-8-5 bold">${bk.name}</span>
<span class="ve-grow ve-text-center code">${AdventuresBooksList._getDateStr(bk)}</span>
`;
},
});
}
}
const booksList = new BooksList();
window.addEventListener("load", () => booksList.pOnPageLoad());
function handleBrew (homebrew) {
booksList.addData(homebrew);
return Promise.resolve();
}