Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit b51d4ec0 authored by Adam Tauber's avatar Adam Tauber
Browse files

[fix] add aria labels to result links - #350

parent f9f59749
Loading
Loading
Loading
Loading
+13 −13
Original line number Diff line number Diff line
@@ -8,34 +8,34 @@
    <img width="32" height="32" class="favicon" src="{{ url_for('static', filename='themes/oscar/img/icons/' + favicon + '.png') }}" alt="{{ favicon }}" />
{%- endmacro %}

{%- macro result_link(url, title, classes='') -%}
<a href="{{ url }}" {% if classes %}class="{{ classes }}" {% endif %}{% if results_on_new_tab %}target="_blank" rel="noopener noreferrer"{% else %}rel="noreferrer"{% endif %}>{{ title }}</a>
{%- macro result_link(url, title, classes='', id='') -%}
<a href="{{ url }}" {% if classes %}class="{{ classes }}" {% endif %}{% if results_on_new_tab %}target="_blank" rel="noopener noreferrer"{% else %}rel="noreferrer"{% endif %}{% if id %} aria-labelledby="result-{{id}}"{%endif%}>{{ title }}</a>
{%- endmacro -%}

<!-- Draw result header -->
{% macro result_header(result, favicons) -%}
<h4 class="result_header">{% if result.engine~".png" in favicons %}{{ draw_favicon(result.engine) }} {% endif %}{% if result.url %}{{ result_link(result.url, result.title|safe) }}{% else %}{{ result.title|safe}}{% endif %}</h4>
{% macro result_header(result, favicons, id) -%}
<h4 class="result_header" id="result-{{id}}">{% if result.engine~".png" in favicons %}{{ draw_favicon(result.engine) }} {% endif %}{% if result.url %}{{ result_link(result.url, result.title|safe, id=id) }}{% else %}{{ result.title|safe}}{% endif %}</h4>
{%- endmacro %}

<!-- Draw result sub header -->
{% macro result_sub_header(result) -%}
{% macro result_sub_header(result, id) -%}
    {% if result.publishedDate %}<time class="text-muted" datetime="{{ result.pubdate }}" >{{ result.publishedDate }}</time>{% endif %}
    {% if result.magnetlink %}<small> &bull; {{ result_link(result.magnetlink, icon('magnet') + _('magnet link'), "magnetlink") }}</small>{% endif %}
    {% if result.torrentfile %}<small> &bull; {{ result_link(result.torrentfile, icon('download-alt') + _('torrent file'), "torrentfile") }}</small>{% endif %}
    {% if result.magnetlink %}<small> &bull; {{ result_link(result.magnetlink, icon('magnet') + _('magnet link'), "magnetlink", id) }}</small>{% endif %}
    {% if result.torrentfile %}<small> &bull; {{ result_link(result.torrentfile, icon('download-alt') + _('torrent file'), "torrentfile", id) }}</small>{% endif %}
{%- endmacro %}

<!-- Draw result footer -->
{% macro result_footer(result) -%}
{% macro result_footer(result, id) -%}
    <div class="clearfix"></div>{{- "" -}}
    <div class="pull-right">
        {%- for engine in result.engines -%}
            <span class="label label-default">{{ engine }}</span>
        {%- endfor -%}
        {%- if result.url -%}
        <small>{{ result_link("https://web.archive.org/web/" + result.url, icon('link') + _('cached'), "text-info") }}</small>
        <small>{{ result_link("https://web.archive.org/web/" + result.url, icon('link') + _('cached'), "text-info", id) }}</small>
        {%- endif -%}
        {%- if proxify -%}
        <small>{{ result_link(proxify(result.url), icon('sort') + _('proxied'), "text-info") }}</small>
        <small>{{ result_link(proxify(result.url), icon('sort') + _('proxied'), "text-info", id) }}</small>
        {%- endif -%}
    </div>
    {%- if result.pretty_url -%}
@@ -44,16 +44,16 @@
{%- endmacro %}

<!-- Draw result footer -->
{% macro result_footer_rtl(result) -%}
{% macro result_footer_rtl(result, id) -%}
    <div class="clearfix"></div>{{- "" -}}
    {% for engine in result.engines -%}
        <span class="label label-default">{{ engine }}</span>
    {%- endfor %}
    {%- if result.url -%}
    <small>{{ result_link("https://web.archive.org/web/" + result.url, icon('link') + _('cached'), "text-info") }}</small>
    <small>{{ result_link("https://web.archive.org/web/" + result.url, icon('link') + _('cached'), "text-info", id) }}</small>
    {%- endif -%}
    {% if proxify -%}
    <small>{{ result_link(proxify(result.url), icon('sort') + _('proxied'), "text-info") }}</small>
    <small>{{ result_link(proxify(result.url), icon('sort') + _('proxied'), "text-info", id) }}</small>
    {%- endif %}
    {%- if result.pretty_url -%}
    <div class="external-link">{{ result.pretty_url }}</div>
+2 −2
Original line number Diff line number Diff line
{% from 'oscar/macros.html' import result_header, result_sub_header, result_footer, result_footer_rtl, icon %}
{% from 'oscar/macros.html' import result_header, result_sub_header, result_footer, result_footer_rtl, icon with context%}

{{ result_header(result, favicons) }}
{{ result_sub_header(result) }}

{% if result.content %}<p class="result-content">{{ result.content|safe }}</p>{% endif %}

{% if result.repository %}<p class="result-content">{{ icon('file') }} <a href="{{ result.repository }}" {% if results_on_new_tab %}target="_blank" rel="noopener noreferrer"{% else %}rel="noreferrer"{% endif %}>{{ result.repository }}</a></p>{% endif %}
{% if result.repository %}<p class="result-content">{{ icon('file') }} <a href="{{ result.repository }}" {% if results_on_new_tab %}target="_blank" rel="noopener noreferrer"{% else %}rel="noreferrer"{% endif %} aria-labelledby="result-{{loop.index}}">{{ result.repository }}</a></p>{% endif %}

<div dir="ltr">
{{ result.codelines|code_highlighter(result.code_language)|safe }}
+5 −5
Original line number Diff line number Diff line
{% from 'oscar/macros.html' import result_header, result_sub_header, result_footer, result_footer_rtl, icon with context %}

{{- result_header(result, favicons) -}}
{{- result_sub_header(result) -}}
{{- result_header(result, favicons, loop.index) -}}
{{- result_sub_header(result, loop.index) -}}

{%- if result.embedded -%}
    <small> &bull; <a class="text-info btn-collapse collapsed cursor-pointer media-loader disabled_if_nojs" data-toggle="collapse" data-target="#result-media-{{ index }}" data-btn-text-collapsed="{{ _('show media') }}" data-btn-text-not-collapsed="{{ _('hide media') }}">{{ icon('music') }} {{ _('show media') }}</a></small>
    <small> &bull; <a class="text-info btn-collapse collapsed cursor-pointer media-loader disabled_if_nojs" data-toggle="collapse" data-target="#result-media-{{ index }}" data-btn-text-collapsed="{{ _('show media') }}" data-btn-text-not-collapsed="{{ _('hide media') }}" aria-labelledby="result-{{loop.index}}">{{ icon('music') }} {{ _('show media') }}</a></small>
{%- endif -%}

{%- if result.embedded -%}
@@ -25,7 +25,7 @@
{%- endif -%}

{%- if rtl -%}
{{ result_footer_rtl(result) }}
{{ result_footer_rtl(result, loop.index) }}
{%- else -%}
{{ result_footer(result) }}
{{ result_footer(result, loop.index) }}
{%- endif -%}
+2 −2
Original line number Diff line number Diff line
{%- from 'oscar/macros.html' import draw_favicon -%}
{%- from 'oscar/macros.html' import draw_favicon with context -%}

<a href="{{ result.img_src }}" {% if results_on_new_tab %}target="_blank" rel="noopener noreferrer"{% else %}rel="noreferrer"{% endif %} data-toggle="modal" data-target="#modal-{{ index }}-{{pageno}}">{{- "" -}}
<a href="{{ result.img_src }}" {% if results_on_new_tab %}target="_blank" rel="noopener noreferrer"{% else %}rel="noreferrer"{% endif %} data-toggle="modal" data-target="#modal-{{ index }}-{{pageno}}" id="result-{{loop.index}}">{{- "" -}}
    <img src="{% if result.thumbnail_src %}{{ image_proxify(result.thumbnail_src) }}{% else %}{{ image_proxify(result.img_src) }}{% endif %}" alt="{{ result.title|striptags }}" title="{{ result.title|striptags }}" class="img-thumbnail">{{- "" -}}
</a>
<div class="modal fade" id="modal-{{ index }}-{{ pageno }}" tabindex="-1" role="dialog" aria-hidden="true">{{- "" -}}
+4 −4
Original line number Diff line number Diff line
{% from 'oscar/macros.html' import result_header, result_sub_header, result_footer, result_footer_rtl, icon %}

{{ result_header(result, favicons) }}
{{ result_sub_header(result) }}
{{ result_header(result, favicons, loop.index) }}
{{ result_sub_header(result, loop.index) }}

{% if (result.latitude and result.longitude) or result.boundingbox %}
    <small> &bull; <a class="text-info btn-collapse collapsed searx_init_map cursor-pointer disabled_if_nojs" data-toggle="collapse" data-target="#result-map-{{ index }}" data-leaflet-target="osm-map-{{ index }}" data-map-lon="{{ result.longitude }}" data-map-lat="{{ result.latitude }}" {% if result.boundingbox %}data-map-boundingbox='{{ result.boundingbox|tojson|safe }}'{% endif %} {% if result.geojson %}data-map-geojson='{{ result.geojson|tojson|safe }}'{% endif %} data-btn-text-collapsed="{{ _('show map') }}" data-btn-text-not-collapsed="{{ _('hide map') }}">{{ icon('globe') }} {{ _('show map') }}</a></small>
@@ -66,7 +66,7 @@
{% endif %}

{% if rtl %}
{{ result_footer_rtl(result) }}
{{ result_footer_rtl(result, loop.index) }}
{% else %}
{{ result_footer(result) }}
{{ result_footer(result, loop.index) }}
{% endif %}
Loading