Compare commits

...

2 Commits

2 changed files with 19 additions and 20 deletions

View File

@ -16,20 +16,6 @@ function init() {
});
}
function apiResponseParsing(book) {
book.sortTitle = titleCleaner(book.title);
if (!book["isbn-10"] && book["isbn-13"]) {
book["isbn-10"] = ISBNfromEAN(book["isbn-13"]);
}
if (!book.coverurl && book["isbn-10"]) {
book.coverurl =
`https://images-na.ssl-images-amazon.com/images/P/` +
book["isbn-10"] +
`.01.LZZ.jpg`;
}
return book;
}
function renderTable(books, sortField) {
if (sortField) {
if (sortState.sortBy === sortField && sortState.sortOrder === "asc") {
@ -78,6 +64,20 @@ function renderTable(books, sortField) {
.classList.add(sortState.sortOrder);
}
function apiResponseParsing(book) {
book.sortTitle = titleCleaner(book.title);
if (!book["isbn-10"] && book["isbn-13"]) {
book["isbn-10"] = ISBNfromEAN(book["isbn-13"]);
}
if (!book.coverURL && book["isbn-10"]) {
book.coverURL =
`https://images-na.ssl-images-amazon.com/images/P/` +
book["isbn-10"] +
`.01.LZZ.jpg`;
}
return book;
}
function search(books, searchBy) {
searchBy = searchCleaner(searchBy);
if (searchBy !== "") {
@ -123,7 +123,7 @@ function ISBNfromEAN(EAN) {
function BookTemplate({
"isbn-13": isbn13,
authors,
coverurl,
coverURL,
description,
format,
notes,
@ -135,7 +135,7 @@ function BookTemplate({
volume,
year,
}) {
return `${coverurl ? `<img src="${coverurl}"/>` : ""}
return `${coverURL ? `<img src="${coverURL}"/>` : ""}
<h1 ${onLoan ? "class='onLoan' " : ""}>${title}</h1>
<h2>${authors}</h2>
<span>${isbn13}</span><br/>
@ -189,7 +189,3 @@ function TableTemplate(books) {
return acc.concat(TableRowTemplate(book));
}, "")} </table>`;
}
window.addEventListener("DOMContentLoaded", () => {
init();
});

View File

@ -14,6 +14,9 @@
rel="stylesheet preload prefetch"
/>
<script type="text/javascript" src="app.js"></script>
<script type="text/javascript">
window.addEventListener("DOMContentLoaded", init);
</script>
</head>
<body>
<div class="wrapper">