mirror of
https://github.com/searxng/searxng.git
synced 2024-12-24 18:20:29 +00:00
2149e88bdd
HINT: this patch has no functional change / it is the preparation for following changes and bugfixes Over the years, the preferences template became an unmanageable beast. To make the source code more readable the monolith is splitted into elements. The splitting into elements also has the advantage that a new template can make use of them. The reversed checkbox is a quirk that is only used in the prefereces and must be eliminated in the long term. For this the macro 'checkbox_onoff_reversed' was added to the preferences.html template. The 'checkbox' macro is also a quirk of the preferences.html we don't want to use in other templates (it is an input-checkbox in a HTML form that was misused for status display). Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
63 lines
3.3 KiB
HTML
63 lines
3.3 KiB
HTML
{% from 'simple/icons.html' import icon_small %}
|
|
|
|
<!-- Draw favicon -->
|
|
{% macro draw_favicon(favicon) -%}
|
|
<img width="14" height="14" class="favicon" src="{{ url_for('static', filename='themes/simple/img/icons/' + favicon + '.png') }}" alt="{{ favicon }}">
|
|
{%- endmacro %}
|
|
|
|
{% macro result_open_link(url, classes='') -%}
|
|
<a href="{{ url }}" {% if classes %}class="{{ classes }}" {% endif %}{% if results_on_new_tab %}target="_blank" rel="noopener noreferrer"{% else %}rel="noreferrer"{% endif %}>
|
|
{%- endmacro %}
|
|
|
|
{%- macro result_close_link() -%}
|
|
</a>
|
|
{%- endmacro %}
|
|
|
|
{%- macro result_link(url, title, classes='') -%}
|
|
{{ result_open_link(url, classes) }}{{ title }}{{ result_close_link() }}
|
|
{%- endmacro -%}
|
|
|
|
<!-- Draw result header -->
|
|
{% macro result_header(result, favicons, image_proxify) -%}
|
|
<article class="result {% if result['template'] %}result-{{ result.template|replace('.html', '') }}{% else %}result-default{% endif %} {% if result['category'] %}category-{{ result['category'] }}{% endif %}{% for e in result.engines %} {{ e }}{% endfor %}">
|
|
{{- result_open_link(result.url, "url_wrapper") -}}
|
|
{%- for part in get_pretty_url(result.parsed_url) -%}
|
|
<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 }}" 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 -%}
|
|
|
|
<!-- Draw result sub header -->
|
|
{%- macro result_sub_header(result) -%}
|
|
{%- if result.publishedDate %}<time class="published_date" datetime="{{ result.pubdate }}" >{{ result.publishedDate }}</time>{% endif -%}
|
|
{%- if result.length %}<div class="result_length">{{ _('Length') }}: {{ result.length }}</div>{% endif -%}
|
|
{%- if result.author %}<div class="result_author">{{ _('Author') }}: {{ result.author }}</div>{% endif -%}
|
|
{%- if result.metadata %}<div class="highlight">{{ result.metadata|safe }}</div>{% endif -%}
|
|
{%- endmacro -%}
|
|
|
|
<!-- Draw result sub footer -->
|
|
{%- macro result_sub_footer(result, proxify) -%}
|
|
<div class="engines">
|
|
{% for engine in result.engines %}<span>{{ engine }}</span>{% endfor %}
|
|
{{ result_link(cache_url + result.url, icon_small('ellipsis-vertical-outline') + _('cached'), "cache_link") }}‎ {% if proxify and proxify_results %} {{ result_link(proxify(result.url), icon('link') + _('proxied'), "proxyfied_link") }} {% endif %}
|
|
</div>{{- '' -}}
|
|
<div class="break"></div>{{- '' -}}
|
|
{%- endmacro -%}
|
|
|
|
<!-- Draw result footer -->
|
|
{%- macro result_footer(result) -%}
|
|
</article>
|
|
{%- endmacro -%}
|
|
|
|
<!-- input checkbox, on/off slider user can tap-->
|
|
{%- macro checkbox_onoff(name, checked) -%}
|
|
<input type="checkbox" {{- ' ' -}}
|
|
name="{{ name }}" {{- ' ' -}}
|
|
id="{{ name }}" {{- ' ' -}}
|
|
aria-labelledby="pref_{{ name }}"{{- ' ' -}}
|
|
class="checkbox-onoff"{{- ' ' -}}
|
|
{%- if checked -%} checked{%- endif -%}/>
|
|
{%- endmacro -%}
|