add opds fetching
parent
e61f6f4ca2
commit
c057e7b42d
14
booklist.js
14
booklist.js
|
@ -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)
|
||||
|
|
Loading…
Reference in New Issue