add opds fetching

master
Adam Undus 2020-10-14 17:03:50 -04:00
parent e61f6f4ca2
commit c057e7b42d
1 changed files with 13 additions and 3 deletions

View File

@ -1,13 +1,23 @@
const displayUsingApi = false;
const displayUsingApi = true;
(function ($) {
if (displayUsingApi) {
// TODO
const list = JSON.parse(localStorage.getItem('booklist'))
console.log(list)
const body = $('#book-list')
Object.keys(list).forEach((bookId) => {
console.log(bookId)
jQuery.get(`https://www.gutenberg.org/ebooks/${bookId}.opds`, null, (data, status, jqxhr) => { // eslint-disable-line
// TODO parse
console.log(data)
body.html(data)
}, 'text')
})
} else {
const list = JSON.parse(localStorage.getItem('booklist'))
console.log(list)
const body = $('#book-list')
console.log()
Object.keys(list).forEach((bookId) => {
console.log(bookId)