Skip to content
This repository has been archived by the owner on Dec 25, 2023. It is now read-only.

Nextprev improvements #130

Merged
merged 2 commits into from
Jul 15, 2019
Merged

Nextprev improvements #130

merged 2 commits into from
Jul 15, 2019

Conversation

kamil4
Copy link
Contributor

@kamil4 kamil4 commented Jul 15, 2019

Fixes #129.

The display of the thumbnail in the photo view while the larger-resolution image is being loaded is implemented using CSS background image (on the <img> object, no less). It actually looks pretty cool, I think.

Image prefetching code was extended to request both previous and next images. The prefetch request is initiated only after the main image has finished loading. We no longer prefetch movie files. There's now a fallback for browsers that don't support HTML5 link rel=prefetch. While the fallback was trivial, detecting whether it's needed was not. I thought I would be forced to hardcode it based on the user agent, but in the end I found some code that's supposed to detect it at run time.

Code was also extended in places to handle the case of previous or next image being empty, to fully support non-wraparound feature being added to the server.

Also prefetch the previous photo.

Add custom fallback prefetching code if HTML5 prefetch not supported.
Delay the prefetching until the current image has finished loading.
Copy link
Member

@ildyria ildyria left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See comment.

if (current2x) {
// If the currently displayed image uses the 2x variant,
// chances are that so will the next one.
href = preloadPhoto.medium2x
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes and no. I think you still need to check if medium2x is not empty.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is that not covered on line 161?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ho right. xD

if (current2x) {
// If the currently displayed image uses the 2x variant,
// chances are that so will the next one.
href = preloadPhoto.medium2x
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ho right. xD

@kamil4 kamil4 merged commit f8a429e into master Jul 15, 2019
@delete-merged-branch delete-merged-branch bot deleted the nextprev-improvements branch July 15, 2019 14:35
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Enhancement] Display of images within lightbox (preload and use of low-res)
3 participants