mirror of
https://github.com/searxng/searxng.git
synced 2026-05-07 18:03:51 +02:00
[mod] result templates: move iframe to macro and fix page rendering for non-YouTube links (#5960)
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.
This commit is contained in:
@@ -67,3 +67,13 @@
|
|||||||
class="checkbox-onoff"{{- ' ' -}}
|
class="checkbox-onoff"{{- ' ' -}}
|
||||||
{%- if checked -%} checked{%- endif -%}/>
|
{%- if checked -%} checked{%- endif -%}/>
|
||||||
{%- endmacro -%}
|
{%- 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 -%}
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
{% from 'simple/macros.html' import result_header, result_sub_header, result_sub_footer, result_footer with context %}
|
{% from 'simple/macros.html' import iframe, result_header, result_sub_header, result_sub_footer, result_footer with context %}
|
||||||
|
|
||||||
{{ result_header(result, favicons, image_proxify) -}}
|
{{ result_header(result, favicons, image_proxify) -}}
|
||||||
{{- result_sub_header(result) -}}
|
{{- result_sub_header(result) -}}
|
||||||
@@ -17,7 +17,7 @@
|
|||||||
{{- result_sub_footer(result) -}}
|
{{- result_sub_footer(result) -}}
|
||||||
{% if result.iframe_src -%}
|
{% if result.iframe_src -%}
|
||||||
<div id="result-media-{{ index }}" class="embedded-content invisible">
|
<div id="result-media-{{ index }}" class="embedded-content invisible">
|
||||||
<iframe data-src="{{result.iframe_src}}" frameborder="0" allowfullscreen></iframe>
|
{{ iframe(result.iframe_src) }}
|
||||||
</div>
|
</div>
|
||||||
{%- endif %}
|
{%- endif %}
|
||||||
{% if result.audio_src -%}
|
{% if result.audio_src -%}
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
{% from 'simple/macros.html' import result_header, result_sub_header, result_sub_footer, result_footer with context %}
|
{% from 'simple/macros.html' import iframe, result_header, result_sub_header, result_sub_footer, result_footer with context %}
|
||||||
|
|
||||||
{{ result_header(result, favicons, image_proxify) }}
|
{{ result_header(result, favicons, image_proxify) }}
|
||||||
{{ result_sub_header(result) }}
|
{{ result_sub_header(result) }}
|
||||||
@@ -18,11 +18,7 @@
|
|||||||
{{- result_sub_footer(result) -}}
|
{{- result_sub_footer(result) -}}
|
||||||
{% if result.iframe_src -%}
|
{% if result.iframe_src -%}
|
||||||
<div id="result-video-{{ index }}" class="embedded-video invisible">
|
<div id="result-video-{{ index }}" class="embedded-video invisible">
|
||||||
<iframe data-src="{{result.iframe_src}}" frameborder="0" allowfullscreen
|
{{ iframe(result.iframe_src) }}
|
||||||
{% if result.parsed_url.hostname in ("www.youtube.com", ) -%}
|
|
||||||
allow="picture-in-picture" referrerpolicy="origin">
|
|
||||||
{%- endif -%}
|
|
||||||
</iframe>
|
|
||||||
</div>
|
</div>
|
||||||
{%- endif %}
|
{%- endif %}
|
||||||
{{ result_footer(result) }}
|
{{ result_footer(result) }}
|
||||||
|
|||||||
Reference in New Issue
Block a user