This commit is contained in:
2025-11-07 13:34:32 -08:00
commit 1e8c5a972b
436 changed files with 11000 additions and 0 deletions

View File

@@ -0,0 +1,16 @@
import { setCookie, readCookie } from "helpers/cookie_helpers"
export function getReadingProgress(bookId) {
const progress = readCookie(`reading_progress_${bookId}`)
if (progress) {
const [ leafId, lastReadParagraph ] = progress.split("/")
return [ parseInt(leafId), parseInt(lastReadParagraph) || 0 ]
} else {
return [ undefined, 0 ]
}
}
export function storeReadingProgress(bookId, leafId, lastReadParagraphIndex) {
setCookie(`reading_progress_${bookId}`, `${leafId}/${lastReadParagraphIndex}`)
}