mirror of
https://github.com/searxng/searxng.git
synced 2026-06-15 06:16:51 +02:00
e3bd7f5df1
* [mod] template images.html: reformatted for readability (no func change) In preparation for upcoming changes, the template is being reformatted for better readability; no functional changes are being made. Signed-off-by: Markus Heiser <markus.heiser@darmarit.de> * [mod] image results: add list of alternative formats To test alternatives formats apply patch from below, query ``!flaticon bmw`` and open the detail view for the image. diff --git a/searx/engines/flaticon.py b/searx/engines/flaticon.py index 06b6a8e25..d88388705 100644 --- a/searx/engines/flaticon.py +++ b/searx/engines/flaticon.py @@ -8,7 +8,7 @@ from urllib.parse import urlencode import typing as t -from searx.result_types import EngineResults +from searx.result_types import EngineResults, ImageRef if t.TYPE_CHECKING: from searx.extended_types import SXNG_Response @@ -61,6 +61,14 @@ def response(resp: "SXNG_Response"): thumbnail_src=_fix_url(result["png"]), img_src=_fix_url(result["png512"]), author=result["team_name"], + formats=[ + ImageRef(label="PNG 100x100", url="https://example.org/test.png", subtype="png"), + ImageRef(label="SVG", url="https://example.org/test.svg", subtype="svg+xml"), + ImageRef(url="https://example.org/test.jpg", subtype="jpeg"), + ImageRef(url="https://example.org/test.bmp", subtype="bmp"), + ImageRef(url="https://example.org/test.ico", subtype="x-icon"), + ImageRef(url="https://example.org/test.tif", subtype="tiff"), + ], ) ) Signed-off-by: Markus Heiser <markus.heiser@darmarit.de> --------- Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
70 lines
2.8 KiB
HTML
70 lines
2.8 KiB
HTML
{% macro _target(url, new_tab=False) -%}
|
|
{%- if new_tab %} target="_blank" rel="noopener noreferrer"
|
|
{%- else %} rel="noreferrer"
|
|
{%- endif %}
|
|
{%- endmacro %}
|
|
|
|
{% macro _label(label, value) -%}
|
|
{%- if value -%}<span>{{ label }}:</span>{{ value }}
|
|
{%- else %}
|
|
{%- endif -%}
|
|
{%- endmacro %}
|
|
|
|
<article class="result result-images
|
|
{%- if result["category"] %} category-{{ result["category"] }}
|
|
{%- endif -%}"
|
|
>
|
|
<a {{ _target(results_on_new_tab) }} href="{{ result.img_src }}">
|
|
<img class="image_thumbnail" {{ _target(results_on_new_tab) }}
|
|
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"
|
|
{{- "" -}}
|
|
>
|
|
{%- if result.resolution %}
|
|
<span class="image_resolution">{{ result.resolution }}</span>
|
|
{%- endif -%}
|
|
<span class="title">{{ result.title | striptags }}</span>
|
|
<span class="source">{{- result.parsed_url.netloc -}}</span>
|
|
</a>
|
|
<div class="detail swipe-horizontal">
|
|
<a class="result-detail-close" href="#">{{ icon("close") }}</a>
|
|
<a class="result-detail-previous" href="#">{{ icon("navigate-left") }}</a>
|
|
<a class="result-detail-next" href="#">{{ icon("navigate-right") }}</a>
|
|
<a class="result-images-source" {{ _target(results_on_new_tab) }} href="{{ result.img_src }}">
|
|
<img src=""
|
|
data-src="{{ image_proxify(result.img_src) }}"
|
|
alt="{{ result.title | striptags }}">
|
|
</a>
|
|
<div class="result-images-labels">
|
|
<h4>{{ result.title | striptags }}</h4>
|
|
<p class="result-content">
|
|
{%- if result.content %} {{ result.content | striptags }}
|
|
{%- else %}
|
|
{%- endif -%}
|
|
</p>
|
|
<hr>
|
|
<p class="result-author">{{ _label(_("Author"), result.author) }}</p>
|
|
<p class="result-resolution">{{ _label(_("Resolution"), result.resolution) }}</p>
|
|
<p class="result-format">
|
|
<span>{{ _("Image formats") }}:</span>
|
|
{{- "" -}}<a {{ _target(results_on_new_tab) }} href="{{ result.img_src }}">{{- result.img_format or _("original format") -}}</a>
|
|
{%- for ref in result.formats -%}
|
|
| <a {{ _target(results_on_new_tab) }} href="{{ ref.url }}">{{ ref.label }}</a>
|
|
{%- endfor %}
|
|
</p>
|
|
<p class="result-filesize">{{ _label(_("Filesize"), result.filesize) }}</p>
|
|
<p class="result-source">{{ _label(_("Source"), result.source) }}</p>
|
|
<p class="result-engine">{{ _label(_("Engine"), result.engine) }}</p>
|
|
<p class="result-url"><span>{{ _("View source") }}:</span>{{- "" -}}
|
|
<a {{ _target(results_on_new_tab) }} href="{{ result.url }}">{{ result.url }}</a>
|
|
</p>
|
|
</div>
|
|
</div>
|
|
</article>
|