-
-
Notifications
You must be signed in to change notification settings - Fork 125
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Enhance the paged mode reader #219
Enhance the paged mode reader #219
Conversation
public/js/reader.js
Outdated
@@ -52,6 +54,16 @@ const readerComponent = () => { | |||
if (savedMargin) { | |||
this.margin = savedMargin; | |||
} | |||
|
|||
// Preload Images | |||
this.preloadLookahead = +localStorage.getItem('preloadLookahead') ?? 3; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When the key doesn't exist in local storage, getItem
returns null
, but the +
sign turns it into 0
(because +null
evaluates to 0). I think we can remove the plus sign here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see! Since getItem()
returns a string and I want to keep this.preloadLookahead
as a number, I'll parenthesize them.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Splendid job! Thanks!
1. Preload next images
This resolve #196
Preload lookahead: 3 pages
Started from p32, it preloaded next 3 pages (pp.33-35)
After reading p33 and p34, it preloaded p36, p37 each.
2. Prevent to load unnecessary images
Fix #217
3. Fix CSS to fit image 'contain' properly
Fix #218
4. Option for enabling/disabling a flip animation
This resolve one of suggestion from #147
A below picture shows a modal menu when the mode is paged mode.
It has the checkbox for toggling flip animation and the range input to set preload pages
I'm curious that its layout looks good (especially about a position of the checkbox... 😜)