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

33
js/books.js Normal file
View File

@@ -0,0 +1,33 @@
"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="col-1-3 ve-text-center">${AdventuresBooksList._getGroupStr(bk)}</span>
<span class="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();
}