diff options
| author | Markus Heiser <markus.heiser@darmarIT.de> | 2021-12-15 13:28:40 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-12-15 13:28:40 +0100 |
| commit | ff48a41af07190307522a406e828b99aa3fa3808 (patch) | |
| tree | e92cf94b97572b792c30ad127c2b2c774513005f /searx/templates | |
| parent | da1f970eb50e9a48a25e9cb240585f8d81a5459a (diff) | |
| parent | 715f578cdae8e4129104bfb46bfc972c6a0c546e (diff) | |
Merge pull request #573 from return42/img-lazy
[fix] lazy loading of <img> tags
Diffstat (limited to 'searx/templates')
| -rw-r--r-- | searx/templates/simple/macros.html | 4 | ||||
| -rw-r--r-- | searx/templates/simple/result_templates/images.html | 4 |
2 files changed, 4 insertions, 4 deletions
diff --git a/searx/templates/simple/macros.html b/searx/templates/simple/macros.html index 3920da2b3..c1c421ab1 100644 --- a/searx/templates/simple/macros.html +++ b/searx/templates/simple/macros.html @@ -23,8 +23,8 @@ <span class="url_o{{loop.index}}"><span class="url_i{{loop.index}}">{{- part -}}</span></span> {%- endfor %} {{- result_close_link() -}} - {%- if result.img_src %}{{ result_open_link(result.url) }}<img class="image" src="{{ image_proxify(result.img_src) }}" title="{{ result.title|striptags }}">{{ result_close_link() }}{% endif -%} - {%- if result.thumbnail %}{{ result_open_link(result.url) }}<img class="thumbnail" src="{{ image_proxify(result.thumbnail) }}" title="{{ result.title|striptags }}">{{ result_close_link() }}{% endif -%} + {%- if result.img_src %}{{ result_open_link(result.url) }}<img class="image" src="{{ image_proxify(result.img_src) }}" title="{{ result.title|striptags }}" loading="lazy" width="200" height="200">{{ result_close_link() }}{% endif -%} + {%- if result.thumbnail %}{{ result_open_link(result.url) }}<img class="thumbnail" src="{{ image_proxify(result.thumbnail) }}" title="{{ result.title|striptags }}" loading="lazy" width="200" height="200">{{ result_close_link() }}{% endif -%} <h3>{{ result_link(result.url, result.title|safe) }}</h3> {%- endmacro -%} diff --git a/searx/templates/simple/result_templates/images.html b/searx/templates/simple/result_templates/images.html index 7e45f028e..e521ee211 100644 --- a/searx/templates/simple/result_templates/images.html +++ b/searx/templates/simple/result_templates/images.html @@ -1,6 +1,6 @@ <article class="result result-images {% if result['category'] %}category-{{ result['category'] }}{% endif %}">{{- "" -}} <a {% if results_on_new_tab %}target="_blank" rel="noopener noreferrer"{% else %}rel="noreferrer"{% endif %} href="{{ result.img_src }}">{{- "" -}} - <img class="image_thumbnail" {% if results_on_new_tab %}target="_blank" rel="noopener noreferrer"{% else %}rel="noreferrer"{% endif %} src="{% if result.thumbnail_src %}{{ image_proxify(result.thumbnail_src) }}{% else %}{{ image_proxify(result.img_src) }}{% endif %}" loading="lazy" alt="{{ result.title|striptags }}">{{- "" -}} + <img class="image_thumbnail" {% if results_on_new_tab %}target="_blank" rel="noopener noreferrer"{% else %}rel="noreferrer"{% endif %} src="{% if result.thumbnail_src %}{{ image_proxify(result.thumbnail_src) }}{% else %}{{ image_proxify(result.img_src) }}{% endif %}" alt="{{ result.title|striptags }}" loading="lazy" width="200" height="200">{{- "" -}} <span class="title">{{ result.title|striptags }}</span>{{- "" -}} </a>{{- "" -}} <div class="detail">{{- "" -}} @@ -11,7 +11,7 @@ {%- if result.thumbnail_src -%} <img src="" data-src="{{ image_proxify(result.img_src) }}" alt="{{ result.title|striptags }}"> {%- else -%} - <img src="{{ image_proxify(result.img_src) }}" alt="{{ result.title|striptags }}" loading="lazy"> + <img src="{{ image_proxify(result.img_src) }}" alt="{{ result.title|striptags }}" loading="lazy" width="200" height="200"> {%- endif -%} </a>{{- "" -}} <div class="result-images-labels">{{- "" -}} |