feat: add reading progress display

This commit is contained in:
Cory Dransfeldt 2023-10-29 09:51:33 -07:00
parent 3c54506ce8
commit a4472722f6
6 changed files with 25 additions and 7 deletions

View file

@ -44,12 +44,17 @@ module.exports = async function () {
if (!data[index]) data.push({ percentage: percentage.textContent })
if (data[index]) data[index]['percentage'] = percentage.textContent
})
doc.querySelectorAll('.md\\:block .action-menu a > p').forEach((dateStarted, index) => {
const date = new Date(dateStarted.textContent.replace('Started ', '').split('\n')[0])
if (!data[index]) data.push({ dateAdded: date })
if (data[index]) data[index]['dateAdded'] = date
})
})
const books = data
.filter((book) => book.title)
.map((book) => {
book.type = 'book'
book.dateAdded = new Date()
if (!('dateAdded' in book)) book.dateAdded = new Date()
return book
})
await asset.save(books, 'json')

View file

@ -11,6 +11,7 @@ module.exports = async function () {
],
social: [
{ name: 'Email', url: 'mailto:coryd@fastmail.com', icon: 'at' },
{ name: 'Calendar', url: 'https://savvycal.com/ced/', icon: 'calendar-plus' },
{ name: 'GitHub', url: 'https://github.com/cdransf', icon: 'brand-github' },
{ name: 'Mastodon', url: 'https://social.lol/@cory', icon: 'brand-mastodon' },
{