diff --git a/src/main/resources/templates/epub-index.html b/src/main/resources/templates/epub-index.html
index fe665e1..b644c4c 100644
--- a/src/main/resources/templates/epub-index.html
+++ b/src/main/resources/templates/epub-index.html
@@ -15,7 +15,7 @@
@@ -56,11 +56,19 @@
rendition.next();
});
}
+ function saveBookmark() {
+ document.cookie = "bookmark=" + rendition.currentLocation().start.cfi + "; Max-Age=31536000";
+ }
rendition.on("rendered", (e0,i) => {
setEvents(i.document);
});
setEvents(document);
- rendition.display();
+ var bookmarkCookie = document.cookie.split('; ').find(row => row.startsWith('bookmark='));
+ if (bookmarkCookie !== undefined) {
+ rendition.display(bookmarkCookie.split('=')[1]);
+ } else {
+ rendition.display();
+ }