diff options
| author | Peter Stone <thepeterstone@gmail.com> | 2026-07-22 20:46:48 +0000 |
|---|---|---|
| committer | Peter Stone <thepeterstone@gmail.com> | 2026-07-22 20:46:48 +0000 |
| commit | 8e06fc84c0b540f8ba87afa19d4c08eab7af80d9 (patch) | |
| tree | 46a76a625c4265b14514dfc9d3575e8c5546f1fd /app/src/main/java/org/terst/feedreader/ui/MainActivity.kt | |
| parent | 34b663c6e75a2c360de154418dafb8f616b546a1 (diff) | |
Resolve lazy-loaded images/media before running Readability
Many sites lazy-load media via JS: the real URL sits in a data-src/
data-srcset attribute and only gets copied into src/srcset once the
site's own script runs -- which never happens in the reader WebView (JS
is off by design, so articles can't run arbitrary third-party scripts).
Left alone this showed either a placeholder/category icon stretched to
fill the article width (reported live with a screenshot: a giant flask
icon in place of the real photo on an Ars Technica article), or nothing
but alt text (reported for NYT articles' images and videos).
Before either Readability pass, walk <img>/<source> elements and copy
common lazy-load attributes (data-src, data-original, data-lazy-src,
data-srcset) into src/srcset, falling back to the first srcset candidate
if src is still empty. Also strip width/height attributes on images --
they're sized for the site's real photo, not whatever was in the
unresolved src, so our own max-width:100%/height:auto sizing now takes
over based on the (correctly resolved) image's actual dimensions.
Verified live: the Ars Technica article that previously showed the
stretched flask icon now renders clean, with no image where the broken
one used to appear and the full real article text intact.
Diffstat (limited to 'app/src/main/java/org/terst/feedreader/ui/MainActivity.kt')
0 files changed, 0 insertions, 0 deletions
