Skip to content

Overwrite img src with data-src #408

Merged
plateaukao merged 4 commits intoplateaukao:mainfrom
wanderor:main
Sep 23, 2024
Merged

Overwrite img src with data-src #408
plateaukao merged 4 commits intoplateaukao:mainfrom
wanderor:main

Conversation

@wanderor
Copy link
Copy Markdown
Contributor

Many website (e.g. Wechat) sets a placeholder for img src and loads the actual URL lazily. Mozilla Readability attempted to recognize and handle it, but the logic is narrow and does not cover many cases. Instead, this code change aggressively assume that we can overwrite img src with data-src, etc.

Also: Log console.log()

Many website (e.g. Wechat) sets a placeholder for img src and loads the actual URL lazily. Mozilla Readability attempted to recognize and handle it, but the logic is narrow and does not cover many cases. Instead, this code change aggressively assume that we can overwrite img src with data-src, etc.
@plateaukao
Copy link
Copy Markdown
Owner

@wanderor
Thanks for the pull request.
Could you provide several links that I can check the difference before and after the pr?

@wanderor
Copy link
Copy Markdown
Contributor Author

Hi @plateaukao

On second thought, maybe let's hold this pull request for a while?
Instead, I'm directly modifying Mozilla Readability to enhance its detection of lazy image:
mozilla/readability#910
If that is accepted, I can update the einkbro version accordingly. How about that?

FYI, one test URL would be:
https://mp.weixin.qq.com/s?__biz=MzIzNzcxMTU5OA==&mid=2247503512&idx=1&sn=e657b77bef1cf6f77410e3d8ba8b427b
In normal mode, when you scroll down the page, the images will be lazily loaded.
OTOH, if you scroll the page to top and reload the page to clear loaded images, then enter reader mode, the images will be missing.

@plateaukao plateaukao merged commit acf0140 into plateaukao:main Sep 23, 2024
@plateaukao
Copy link
Copy Markdown
Owner

@wanderor
Let me merge it first on EinkBro, since I don't know how long it make take for firefox to merge the PR. :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants