diff options
author | Andrew Dolgov <[email protected]> | 2021-01-20 15:50:30 +0300 |
---|---|---|
committer | Andrew Dolgov <[email protected]> | 2021-01-20 15:50:30 +0300 |
commit | 8b815a3b42d08e48c70ec147b9043d7d4fc80bde (patch) | |
tree | b3725d5a649fdabb2a6eb7352b78b08153acab00 /js/reader.js | |
parent | f3b8ec34bb24b27cd97508aafa0b882cb3f32ab9 (diff) |
fallback to epub metadata if needed
Diffstat (limited to 'js/reader.js')
-rw-r--r-- | js/reader.js | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/js/reader.js b/js/reader.js index 71e783a..aa05703 100644 --- a/js/reader.js +++ b/js/reader.js @@ -481,10 +481,18 @@ const Reader = { return localforage.getItem(Reader.cacheId()).then((bookinfo) => { - console.log('bookinfo', bookinfo, Reader.cacheId()); + let title; + let author; - const title = bookinfo.title; - const author = bookinfo.author_sort; + if (bookinfo) { + title = bookinfo.title; + author = bookinfo.author_sort; + } else { + const metadata = book.package.metadata; + + title = metadata.title; + author = metadata.creator; + } document.title = title + " – " + author + " – The Epube"; $(".title") |