Compare commits
2 Commits
b52949f3e9
...
7ee118c1cd
Author | SHA1 | Date | |
---|---|---|---|
7ee118c1cd | |||
3e1b06e95a |
@ -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) {
|
function renderTable(books, sortField) {
|
||||||
if (sortField) {
|
if (sortField) {
|
||||||
if (sortState.sortBy === sortField && sortState.sortOrder === "asc") {
|
if (sortState.sortBy === sortField && sortState.sortOrder === "asc") {
|
||||||
@ -78,6 +64,20 @@ function renderTable(books, sortField) {
|
|||||||
.classList.add(sortState.sortOrder);
|
.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) {
|
function search(books, searchBy) {
|
||||||
searchBy = searchCleaner(searchBy);
|
searchBy = searchCleaner(searchBy);
|
||||||
if (searchBy !== "") {
|
if (searchBy !== "") {
|
||||||
@ -123,7 +123,7 @@ function ISBNfromEAN(EAN) {
|
|||||||
function BookTemplate({
|
function BookTemplate({
|
||||||
"isbn-13": isbn13,
|
"isbn-13": isbn13,
|
||||||
authors,
|
authors,
|
||||||
coverurl,
|
coverURL,
|
||||||
description,
|
description,
|
||||||
format,
|
format,
|
||||||
notes,
|
notes,
|
||||||
@ -135,7 +135,7 @@ function BookTemplate({
|
|||||||
volume,
|
volume,
|
||||||
year,
|
year,
|
||||||
}) {
|
}) {
|
||||||
return `${coverurl ? `<img src="${coverurl}"/>` : ""}
|
return `${coverURL ? `<img src="${coverURL}"/>` : ""}
|
||||||
<h1 ${onLoan ? "class='onLoan' " : ""}>${title}</h1>
|
<h1 ${onLoan ? "class='onLoan' " : ""}>${title}</h1>
|
||||||
<h2>${authors}</h2>
|
<h2>${authors}</h2>
|
||||||
<span>${isbn13}</span><br/>
|
<span>${isbn13}</span><br/>
|
||||||
@ -189,7 +189,3 @@ function TableTemplate(books) {
|
|||||||
return acc.concat(TableRowTemplate(book));
|
return acc.concat(TableRowTemplate(book));
|
||||||
}, "")} </table>`;
|
}, "")} </table>`;
|
||||||
}
|
}
|
||||||
|
|
||||||
window.addEventListener("DOMContentLoaded", () => {
|
|
||||||
init();
|
|
||||||
});
|
|
||||||
|
@ -14,6 +14,9 @@
|
|||||||
rel="stylesheet preload prefetch"
|
rel="stylesheet preload prefetch"
|
||||||
/>
|
/>
|
||||||
<script type="text/javascript" src="app.js"></script>
|
<script type="text/javascript" src="app.js"></script>
|
||||||
|
<script type="text/javascript">
|
||||||
|
window.addEventListener("DOMContentLoaded", init);
|
||||||
|
</script>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<div class="wrapper">
|
<div class="wrapper">
|
||||||
|
Loading…
Reference in New Issue
Block a user