mirror of
https://github.com/searxng/searxng.git
synced 2026-05-08 02:13:51 +02:00
330d56bba9
This PR moves the `iframe` logic into a macro, so that `videos.html` and `general.html` both can benefit from the workaround to fix YouTube results by @return42 in https://github.com/searxng/searxng/pull/5858 It also fixes that only YouTube videos contained the closing `>` after `<iframe border="0" ...`, the regression has been caused by https://github.com/searxng/searxng/pull/5858 ## Why is this change important? Currently, the page breaks if there's any non-YouTube Iframe Here, the page ends in the middle of the results and the footer and page number selector are not visible.
80 lines
3.7 KiB
HTML
80 lines
3.7 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 %}">
|
|
{{- result_open_link(result.url, "url_header") -}}
|
|
{%- if favicon_resolver != "" %}
|
|
<div class="favicon"><img loading="lazy" src="{{ favicon_url(result.parsed_url.netloc) }}"></div>
|
|
{%- endif -%}
|
|
<div class="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 %}
|
|
</div>
|
|
{{- result_close_link() -}}
|
|
{%- if result.thumbnail %}{{ result_open_link(result.url, classes='thumbnail_link') }}<img class="thumbnail" src="{{ image_proxify(result.thumbnail) }}" title="{{ result.title|striptags }}" loading="lazy">{%- if result.length -%}<span class="thumbnail_length">{{ result.length }}</span>{%- endif -%}{{ 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 -%}
|
|
<!-- Length is displayed inside the thumbnail if there's any, so don't display it here a second time -->
|
|
{%- if result.length and not result.thumbnail %}<div class="result_length">{{ _('Length') }}: {{ result.length }}</div>{% endif -%}
|
|
{%- if result.views %}<div class="result_views">{{ _('Views') }}: {{ result.views }}</div>{% endif -%}
|
|
{%- if result.author %}<div class="result_author">{{ _('Author') }}: {{ result.author }}</div>{% endif -%}
|
|
{%- if result.metadata %}<div class="highlight">{{ result.metadata }}</div>{% endif -%}
|
|
{%- endmacro -%}
|
|
|
|
<!-- Draw result sub footer -->
|
|
{%- macro result_sub_footer(result) -%}
|
|
<div class="engines">
|
|
{% for engine in result.engines %}<span>{{ engine }}</span>{% endfor %}
|
|
{{ icon_small('ellipsis-vertical') + result_link(cache_url + result.url, _('cached'), "cache_link") }}
|
|
</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 -%}
|
|
|
|
<!-- iframe that additionally sets some extra feature attrs for videos -->
|
|
{%- macro iframe(iframe_src) -%}
|
|
<iframe data-src="{{iframe_src}}" frameborder="0" allowfullscreen
|
|
{% if result.parsed_url.hostname in ("www.youtube.com", ) -%}
|
|
allow="picture-in-picture" referrerpolicy="origin"
|
|
{%- endif -%}
|
|
>
|
|
</iframe>
|
|
{%- endmacro -%}
|