Skip to content

Commit

Permalink
[ADD] Native lazy loading support for images
Browse files Browse the repository at this point in the history
  • Loading branch information
ppfeufer committed Feb 1, 2024
1 parent 692aeab commit a36c072
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ Section Order:

- Compatibility with AAv4
- Tests for Python 3.12 (Still allowed to fail)
- Native lazy loading support for images

### Changed

Expand Down
6 changes: 2 additions & 4 deletions aasrp/helper/eve_images.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ def get_character_portrait_from_evecharacter(
if as_html is True:
return_value = (
'<img class="aasrp-character-portrait rounded" '
f'src="{portrait_url}" alt="{character_name}">'
f'src="{portrait_url}" alt="{character_name}" loading="lazy">'
)

return return_value
Expand Down Expand Up @@ -69,8 +69,6 @@ def get_type_render_url_from_type_id(
if evetype_name is not None:
alt_tag = f' alt="{evetype_name}"'

return_value = (
f'<img class="aasrp-evetype-icon rounded" src="{render_url}"{alt_tag}>'
)
return_value = f'<img class="aasrp-evetype-icon rounded" src="{render_url}"{alt_tag} loading="lazy">'

Check warning on line 72 in aasrp/helper/eve_images.py

View check run for this annotation

Codecov / codecov/patch

aasrp/helper/eve_images.py#L72

Added line #L72 was not covered by tests

return return_value

0 comments on commit a36c072

Please sign in to comment.