1
0
mirror of https://github.com/searxng/searxng.git synced 2024-11-22 20:17:45 +01:00

Merge pull request #1671 from dalf/tidy-oscar

[mod] tidy oscar HTML output
This commit is contained in:
Markus Heiser 2019-12-10 16:02:54 +00:00 committed by GitHub
commit 50e1fcaa5e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
12 changed files with 339 additions and 347 deletions

View File

@ -1,16 +1,17 @@
<input type="checkbox" name="advanced_search" id="check-advanced" {% if advanced_search %} checked="checked"{% endif %}> <input type="checkbox" name="advanced_search" id="check-advanced" {% if advanced_search %} checked="checked"{% endif %}>
<label for="check-advanced"> <label for="check-advanced">{{- "" -}}
<span class="glyphicon glyphicon-cog"></span> <span class="glyphicon glyphicon-cog"></span>
{{ _('Advanced settings') }} {{- _('Advanced settings') -}}
</label> </label>
<div id="advanced-search-container"> <div id="advanced-search-container">
{% include 'oscar/categories.html' %} {% include 'oscar/categories.html' %}
<div class="row"> <div class="row">
<div class="col-xs-6"> <div class="col-xs-6">
{% include 'oscar/time-range.html' %} {%- include 'oscar/time-range.html' -%}
</div> </div>
<div class="col-xs-6"> <div class="col-xs-6">
{% include 'oscar/languages.html' %} {%- include 'oscar/languages.html' -%}
</div> </div>
</div> </div>
</div> </div>

View File

@ -10,16 +10,17 @@
<meta name="referrer" content="no-referrer"> <meta name="referrer" content="no-referrer">
<meta name="viewport" content="width=device-width, initial-scale=1 , maximum-scale=1.0, user-scalable=1" /> <meta name="viewport" content="width=device-width, initial-scale=1 , maximum-scale=1.0, user-scalable=1" />
{% block meta %}{% endblock %} {% block meta %}{% endblock %}
<title>{% block title %}{% endblock %}{{ instance_name }}</title>
<title>{% block title %}{% endblock %}{{ instance_name }}</title>
<link rel="stylesheet" href="{{ url_for('static', filename='css/bootstrap.min.css') }}" type="text/css" /> <link rel="stylesheet" href="{{ url_for('static', filename='css/bootstrap.min.css') }}" type="text/css" />
{% if preferences.get_value('oscar-style') %} {% if preferences.get_value('oscar-style') -%}
<link rel="stylesheet" href="{{ url_for('static', filename='css/'+preferences.get_value('oscar-style')+'.min.css') }}" type="text/css" /> {{' '}}<link rel="stylesheet" href="{{ url_for('static', filename='css/'+preferences.get_value('oscar-style')+'.min.css') }}" type="text/css" />
{% else %} {%- else -%}
<link rel="stylesheet" href="{{ url_for('static', filename='css/logicodev.min.css') }}" type="text/css" /> {{' '}}<link rel="stylesheet" href="{{ url_for('static', filename='css/logicodev.min.css') }}" type="text/css" />
{% endif %} {%- endif %}
<link rel="stylesheet" href="{{ url_for('static', filename='css/leaflet.min.css') }}" type="text/css" /> <link rel="stylesheet" href="{{ url_for('static', filename='css/leaflet.min.css') }}" type="text/css" />
{% for css in styles %} {%- for css in styles %}
<link rel="stylesheet" href="{{ url_for('static', filename=css) }}" type="text/css" /> <link rel="stylesheet" href="{{ url_for('static', filename=css) }}" type="text/css" />
{% endfor %} {% endfor %}
@ -48,6 +49,7 @@
</head> </head>
<body> <body>
{% include 'oscar/navbar.html' %} {% include 'oscar/navbar.html' %}
<div class="container"> <div class="container">
{% if errors %} {% if errors %}
<div class="alert alert-danger fade in" role="alert"> <div class="alert alert-danger fade in" role="alert">
@ -93,13 +95,14 @@
</div> </div>
<script src="{{ url_for('static', filename='js/jquery-1.11.1.min.js') }}"></script> <script src="{{ url_for('static', filename='js/jquery-1.11.1.min.js') }}"></script>
<script src="{{ url_for('static', filename='js/bootstrap.min.js') }}"></script> <script src="{{ url_for('static', filename='js/bootstrap.min.js') }}"></script>
{% if autocomplete %}<script src="{{ url_for('static', filename='js/typeahead.bundle.min.js') }}"></script>{% endif %} {% if autocomplete %} <script src="{{ url_for('static', filename='js/typeahead.bundle.min.js') }}"></script>{% endif %}
<script src="{{ url_for('static', filename='js/require-2.1.15.min.js') }}"></script> <script src="{{ url_for('static', filename='js/require-2.1.15.min.js') }}"></script>
<script src="{{ url_for('static', filename='js/searx.min.js') }}" <script src="{{ url_for('static', filename='js/searx.min.js') }}"
data-method="{{ method or 'POST' }}" data-method="{{ method or 'POST' }}"
data-autocompleter="{% if autocomplete %}true{% else %}false{% endif %}"></script> data-autocompleter="{% if autocomplete %}true{% else %}false{% endif %}"></script>
{% for script in scripts %} {% for script in scripts %}
<script src="{{ url_for('static', filename=script) }}"></script> {{""}}<script src="{{ url_for('static', filename=script) }}"></script>
{% endfor %} {% endfor %}
<noscript> <noscript>
<style> <style>

View File

@ -1,13 +1,13 @@
<div id="categories"> <div id="categories">
{% if rtl %} {%- if rtl -%}
{% for category in categories | reverse %} {% for category in categories | reverse -%}
<input class="hidden" type="checkbox" id="checkbox_{{ category|replace(' ', '_') }}" name="category_{{ category }}" {% if category in selected_categories %}checked="checked"{% endif %} /> <input class="hidden" type="checkbox" id="checkbox_{{ category|replace(' ', '_') }}" name="category_{{ category }}" {% if category in selected_categories %}checked="checked"{% endif %} />{{- '' -}}
<label for="checkbox_{{ category|replace(' ', '_') }}">{{ _(category) }}</label> <label for="checkbox_{{ category|replace(' ', '_') }}">{{ _(category) }}</label>
{% endfor %} {%- endfor %}
{% else %} {%- else -%}
{% for category in categories %} {% for category in categories -%}
<input class="hidden" type="checkbox" id="checkbox_{{ category|replace(' ', '_') }}" name="category_{{ category }}" {% if category in selected_categories %}checked="checked"{% endif %} /> <input class="hidden" type="checkbox" id="checkbox_{{ category|replace(' ', '_') }}" name="category_{{ category }}" {% if category in selected_categories %}checked="checked"{% endif %} />{{- '' -}}
<label for="checkbox_{{ category|replace(' ', '_') }}">{{ _(category) }}</label> <label for="checkbox_{{ category|replace(' ', '_') }}">{{ _(category) }}</label>
{% endfor %} {%- endfor %}
{% endif %} {%- endif -%}
</div> </div>

View File

@ -1,34 +1,35 @@
{% from 'oscar/macros.html' import result_link with context %} {% from 'oscar/macros.html' import result_link with context %}
<div class="panel panel-default infobox"> <div class="panel panel-default infobox">
<div class="panel-heading"> <div class="panel-heading">{{- "" -}}
<h4 class="panel-title infobox_part"><bdi>{{ infobox.infobox }}</bdi></h4> <h4 class="panel-title infobox_part"><bdi>{{ infobox.infobox }}</bdi></h4>{{- "" -}}
</div> </div>
<div class="panel-body"> <div class="panel-body">
{% if infobox.img_src %}<img class="img-responsive center-block infobox_part" src="{{ image_proxify(infobox.img_src) }}" alt="{{ infobox.infobox }}" />{% endif %} {% if infobox.img_src %}<img class="img-responsive center-block infobox_part" src="{{ image_proxify(infobox.img_src) }}" alt="{{ infobox.infobox }}" />{% endif %}
{% if infobox.content %}<bdi><p class="infobox_part">{{ infobox.content }}</bdi></p>{% endif %}
{% if infobox.attributes %} {% if infobox.content %}<bdi><p class="infobox_part">{{ infobox.content }}</p></bdi>{% endif %}
{% if infobox.attributes -%}
<table class="table table-striped infobox_part"> <table class="table table-striped infobox_part">
{% for attribute in infobox.attributes %} {% for attribute in infobox.attributes -%}
<tr> <tr>{{- "" -}}
<td><bdi>{{ attribute.label }}</bdi></td> <td><bdi>{{ attribute.label }}</bdi></td>
{% if attribute.image %} {%- if attribute.image -%}
<td><img class="img-responsive" src="{{ image_proxify(attribute.image.src) }}" alt="{{ attribute.image.alt }}" /></td> <td><img class="img-responsive" src="{{ image_proxify(attribute.image.src) }}" alt="{{ attribute.image.alt }}" /></td>
{% else %} {%- else -%}
<td><bdi>{{ attribute.value }}</bdi></td> <td><bdi>{{ attribute.value }}</bdi></td>
{% endif %} {%- endif -%}
</tr> </tr>
{% endfor %} {% endfor -%}
</table> </table>
{% endif %} {% endif %}
{% if infobox.urls %} {% if infobox.urls -%}
<div class="infobox_part"> <div class="infobox_part">{{- "\n" -}}
<bdi> <bdi>
{% for url in infobox.urls %} {%- for url in infobox.urls -%}
<p class="btn btn-default btn-xs">{{ result_link(url.url, url.title) }}</a></p> <p class="btn btn-default btn-xs">{{ result_link(url.url, url.title) }}</p>
{% endfor %} {% endfor -%}
</bdi> </bdi>{{- "" -}}
</div> </div>
{% endif %} {% endif %}
</div> </div>

View File

@ -1,12 +1,12 @@
{% if preferences %} {% if preferences -%}
<select class="custom-select form-control" name='language'> <select class="custom-select form-control" name='language'>
{% else %} {%- else -%}
<select class="time_range custom-select form-control" id='language' name='language'> <select class="time_range custom-select form-control" id='language' name='language'>
{% endif %} {%- endif -%}
<option value="all" {% if current_language == 'all' %}selected="selected"{% endif %}>{{ _('Default language') }}</option> <option value="all" {% if current_language == 'all' %}selected="selected"{% endif %}>{{ _('Default language') }}</option>
{% for lang_id,lang_name,country_name,english_name in language_codes | sort(attribute=1) %} {%- for lang_id,lang_name,country_name,english_name in language_codes | sort(attribute=1) -%}
<option value="{{ lang_id }}" {% if lang_id == current_language %}selected="selected"{% endif %}> <option value="{{ lang_id }}" {% if lang_id == current_language %}selected="selected"{% endif %}>
{{ lang_name }} {% if country_name %}({{ country_name }}) {% endif %}- {{ lang_id }} {{- lang_name }} {% if country_name %}({{ country_name }}) {% endif %}- {{ lang_id -}}
</option> </option>
{% endfor %} {%- endfor -%}
</select> </select>

View File

@ -26,38 +26,38 @@
<!-- Draw result footer --> <!-- Draw result footer -->
{% macro result_footer(result) -%} {% macro result_footer(result) -%}
<div class="clearfix"></div> <div class="clearfix"></div>{{- "" -}}
<div class="pull-right"> <div class="pull-right">
{% for engine in result.engines %} {%- for engine in result.engines -%}
<span class="label label-default">{{ engine }}</span> <span class="label label-default">{{ engine }}</span>
{% endfor %} {%- endfor -%}
{% if result.url %} {%- 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") }}</small>
{% endif %} {%- endif -%}
{% if proxify %} {%- 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") }}</small>
{% endif %} {%- endif -%}
</div> </div>
{% if result.pretty_url %} {%- if result.pretty_url -%}
<div class="external-link">{{ result.pretty_url }}</div> <div class="external-link">{{ result.pretty_url }}</div>
{% endif %} {%- endif -%}
{%- endmacro %} {%- endmacro %}
<!-- Draw result footer --> <!-- Draw result footer -->
{% macro result_footer_rtl(result) -%} {% macro result_footer_rtl(result) -%}
<div class="clearfix"></div> <div class="clearfix"></div>{{- "" -}}
{% for engine in result.engines %} {% for engine in result.engines -%}
<span class="label label-default">{{ engine }}</span> <span class="label label-default">{{ engine }}</span>
{% endfor %} {%- endfor %}
{% if result.url %} {%- 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") }}</small>
{% endif %} {%- endif -%}
{% if proxify %} {% 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") }}</small>
{% endif %} {%- endif %}
{% if result.pretty_url %} {%- if result.pretty_url -%}
<div class="external-link">{{ result.pretty_url }}</div> <div class="external-link">{{ result.pretty_url }}</div>
{% endif %} {%- endif %}
{%- endmacro %} {%- endmacro %}
{% macro preferences_item_header(info, label, rtl) -%} {% macro preferences_item_header(info, label, rtl) -%}

View File

@ -1,9 +1,9 @@
<div class="searx-navbar"> <div class="searx-navbar">{{- "" -}}
<span class="instance {% if rtl %}pull-right{% else %}pull-left{% endif%}"> <span class="instance {% if rtl %}pull-right{% else %}pull-left{% endif%}">{{- "" -}}
<a href="{{ url_for('index') }}">{{ instance_name }}</a> <a href="{{ url_for('index') }}">{{ instance_name }}</a>{{- "" -}}
</span> </span>{{- "" -}}
<span class="{% if rtl %}pull-left{% else %}pull-right{% endif %}"> <span class="{% if rtl %}pull-left{% else %}pull-right{% endif %}">{{- "" -}}
<a href="{{ url_for('about') }}">{{ _('about') }}</a> <a href="{{ url_for('about') }}">{{ _('about') }}</a>{{- "" -}}
<a href="{{ url_for('preferences') }}">{{ _('preferences') }}</a> <a href="{{ url_for('preferences') }}">{{ _('preferences') }}</a>{{- "" -}}
</span> </span>{{- "" -}}
</div> </div>

View File

@ -1,31 +1,31 @@
{% from 'oscar/macros.html' import result_header, result_sub_header, result_footer, result_footer_rtl, icon with context %} {% from 'oscar/macros.html' import result_header, result_sub_header, result_footer, result_footer_rtl, icon with context %}
{{ result_header(result, favicons) }} {{- result_header(result, favicons) -}}
{{ result_sub_header(result) }} {{- result_sub_header(result) -}}
{% if result.embedded %} {%- 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') }}">{{ icon('music') }} {{ _('show media') }}</a></small>
{% endif %} {%- endif -%}
{% if result.embedded %} {%- if result.embedded -%}
<div id="result-media-{{ index }}" class="collapse"> <div id="result-media-{{ index }}" class="collapse">
{{ result.embedded|safe }} {{ result.embedded|safe }}
</div> </div>
{% endif %} {%- endif -%}
{% if result.img_src %} {%- if result.img_src -%}
<div class="container-fluid"> <div class="container-fluid">
<div class="row"> <div class="row">
<img src="{{ image_proxify(result.img_src) }}" alt="{{ result.title|striptags }}" title="{{ result.title|striptags }}" style="width: auto; max-height: 60px; min-height: 60px;" class="col-xs-2 col-sm-4 col-md-4 result-content"> <img src="{{ image_proxify(result.img_src) }}" alt="{{ result.title|striptags }}" title="{{ result.title|striptags }}" style="width: auto; max-height: 60px; min-height: 60px;" class="col-xs-2 col-sm-4 col-md-4 result-content">
{% if result.content %}<p class="result-content col-xs-8 col-sm-8 col-md-8">{{ result.content|safe }}</p>{% endif %} {% if result.content %}<p class="result-content col-xs-8 col-sm-8 col-md-8">{{ result.content|safe }}</p>{% endif -%}
</div> </div>
</div> </div>
{% else %} {%- else -%}
{% if result.content %}<p class="result-content">{{ result.content|safe }}</p>{% endif %} {%- if result.content %}<p class="result-content">{{ result.content|safe }}</p>{% endif -%}
{% endif %} {%- endif -%}
{% if rtl %} {%- if rtl -%}
{{ result_footer_rtl(result) }} {{ result_footer_rtl(result) }}
{% else %} {%- else -%}
{{ result_footer(result) }} {{ result_footer(result) }}
{% endif %} {%- endif -%}

View File

@ -1,49 +1,36 @@
{% from 'oscar/macros.html' import draw_favicon %} {%- from 'oscar/macros.html' import draw_favicon -%}
<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}}">{{- "" -}}
<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"> <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> </a>
<div class="modal fade" id="modal-{{ index }}-{{ pageno }}" tabindex="-1" role="dialog" aria-hidden="true">{{- "" -}}
<div class="modal fade" id="modal-{{ index }}-{{ pageno }}" tabindex="-1" role="dialog" aria-hidden="true"> <div class="modal-dialog">{{- "" -}}
<div class="modal-dialog"> <div class="modal-wrapper">{{- "" -}}
<div class="modal-wrapper"> <div class="modal-header">{{- "" -}}
<div class="modal-header"> <button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">&times;</span><span class="sr-only">Close</span></button>{{- "" -}}
<button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">&times;</span><span class="sr-only">Close</span></button> <h4 class="modal-title">{% if result.engine~".png" in favicons %}{{ draw_favicon(result.engine) }} {% endif %}{{ result.title|striptags }}</h4>{{- "" -}}
<h4 class="modal-title">{% if result.engine~".png" in favicons %}{{ draw_favicon(result.engine) }} {% endif %}{{ result.title|striptags }}</h4> </div>{{- "" -}}
</div> <div class="modal-body">{{- "" -}}
<div class="modal-body">
<img class="img-responsive center-block" src="{% if result.thumbnail_src %}{{ image_proxify(result.thumbnail_src) }}{% else %}{{ image_proxify(result.img_src) }}{% endif %}" alt="{{ result.title|striptags }}"> <img class="img-responsive center-block" src="{% if result.thumbnail_src %}{{ image_proxify(result.thumbnail_src) }}{% else %}{{ image_proxify(result.img_src) }}{% endif %}" alt="{{ result.title|striptags }}">
{% if result.author %}<span class="photo-author">{{ result.author }}</span><br />{% endif %} {%- if result.author %}<span class="photo-author">{{ result.author }}</span><br />{% endif -%}
{% if result.content %} {%- if result.content %}<p class="result-content">{{ result.content|striptags }}</p>{% endif -%}
<p class="result-content"> {%- if result.img_format %}<p class="result-format">{{ result.img_format }}</p>{% endif -%}
{{ result.content|striptags }} {%- if result.source %}<p class="result-source">{{ result.source }}</p>{% endif -%}
</p> </div>{{- "" -}}
{% endif %} <div class="modal-footer">{{- "" -}}
{% if result.img_format %} <div class="clearfix"></div>{{- "" -}}
<p class="result-format"> <span class="label label-default pull-right">{{ result.engine }}</span>{{- "" -}}
{{ result.img_format }} <p class="text-muted pull-left">{{ result.pretty_url }}</p>{{- "" -}}
</p> <div class="clearfix"></div>{{- "" -}}
{% endif %} <div class="row">{{- "" -}}
{% if result.source %} <div class="col-md-6">{{- "" -}}
<p class="result-source"> <a href="{{ result.img_src }}" {% if results_on_new_tab %}target="_blank" rel="noopener noreferrer"{% else %}rel="noreferrer"{% endif %} class="btn btn-default">{{ _('Get image') }}</a>{{- "" -}}
{{ result.source }} </div>{{- "" -}}
</p> <div class="col-md-6">{{- "" -}}
{% endif %} <a href="{{ result.url }}" {% if results_on_new_tab %}target="_blank" rel="noopener noreferrer"{% else %}rel="noreferrer"{% endif %} class="btn btn-default">{{ _('View source') }}</a>{{- "" -}}
</div> </div>{{- "" -}}
<div class="modal-footer"> </div>{{- "" -}}
<div class="clearfix"></div> </div>{{- "" -}}
<span class="label label-default pull-right">{{ result.engine }}</span> </div>{{- "" -}}
<p class="text-muted pull-left">{{ result.pretty_url }}</p> </div>{{- "" -}}
<div class="clearfix"></div> </div>{{- "" -}}
<div class="row">
<div class="col-md-6">
<a href="{{ result.img_src }}" {% if results_on_new_tab %}target="_blank" rel="noopener noreferrer"{% else %}rel="noreferrer"{% endif %} class="btn btn-default">{{ _('Get image') }}</a>
</div>
<div class="col-md-6">
<a href="{{ result.url }}" {% if results_on_new_tab %}target="_blank" rel="noopener noreferrer"{% else %}rel="noreferrer"{% endif %} class="btn btn-default">{{ _('View source') }}</a>
</div>
</div>
</div>
</div>
</div>
</div>

View File

@ -1,89 +1,90 @@
{% extends "oscar/base.html" %} {% extends "oscar/base.html" %}
{% macro search_form_attrs(pageno) -%} {% macro search_form_attrs(pageno) -%}
{% for category in selected_categories %}<input type="hidden" name="category_{{ category }}" value="1"/>{% endfor %} {%- for category in selected_categories -%}<input type="hidden" name="category_{{ category }}" value="1"/>{%- endfor -%}
<input type="hidden" name="q" value="{{ q|e }}" /> <input type="hidden" name="q" value="{{ q|e }}" />{{- "" -}}
<input type="hidden" name="pageno" value="{{ pageno }}" /> <input type="hidden" name="pageno" value="{{ pageno }}" />{{- "" -}}
<input type="hidden" name="time_range" value="{{ time_range }}" /> <input type="hidden" name="time_range" value="{{ time_range }}" />{{- "" -}}
<input type="hidden" name="language" value="{{ current_language }}" /> <input type="hidden" name="language" value="{{ current_language }}" />{{- "" -}}
{% if timeout_limit %}<input type="hidden" name="timeout_limit" value="{{ timeout_limit|e }}" />{% endif %} {% if timeout_limit %}<input type="hidden" name="timeout_limit" value="{{ timeout_limit|e }}" />{% endif -%}
{%- endmacro %} {%- endmacro %}
{%- macro search_url() %}{{ base_url }}?q={{ q|urlencode }}{% if selected_categories %}&amp;categories={{ selected_categories|join(",") | replace(' ','+') }}{% endif %}{% if pageno > 1 %}&amp;pageno={{ pageno }}{% endif %}{% if time_range %}&amp;time_range={{ time_range }}{% endif %}{% if current_language != 'all' %}&amp;language={{ current_language }}{% endif %}{% endmacro -%} {%- macro search_url() %}{{ base_url }}?q={{ q|urlencode }}{% if selected_categories %}&amp;categories={{ selected_categories|join(",") | replace(' ','+') }}{% endif %}{% if pageno > 1 %}&amp;pageno={{ pageno }}{% endif %}{% if time_range %}&amp;time_range={{ time_range }}{% endif %}{% if current_language != 'all' %}&amp;language={{ current_language }}{% endif %}{% endmacro -%}
{% block title %}{{ q|e }} - {% endblock %} {% block title %}{{ q|e }} - {% endblock %}
{% block meta %}<link rel="alternate" type="application/rss+xml" title="Searx search: {{ q|e }}" href="{{ search_url() }}&amp;format=rss">{% endblock %} {% block meta %}{{" "}}<link rel="alternate" type="application/rss+xml" title="Searx search: {{ q|e }}" href="{{ search_url() }}&amp;format=rss">{% endblock %}
{% block content %} {% block content %}
{% include 'oscar/search.html' %} {% include 'oscar/search.html' %}
<div class="row"> <div class="row">
<div class="col-sm-8" id="main_results"> <div class="col-sm-8" id="main_results">
<h1 class="sr-only">{{ _('Search results') }}</h1> <h1 class="sr-only">{{ _('Search results') }}</h1>
{% if corrections %} {% if corrections -%}
<div class="result"> <div class="result">
<span class="result_header text-muted form-inline pull-left suggestion_item">{{ _('Try searching for:') }}</span> <span class="result_header text-muted form-inline pull-left suggestion_item">{{ _('Try searching for:') }}</span>
{% for correction in corrections %} {% for correction in corrections -%}
<form method="{{ method or 'POST' }}" action="{{ url_for('index') }}" role="navigation" class="form-inline pull-left suggestion_item"> <form method="{{ method or 'POST' }}" action="{{ url_for('index') }}" role="navigation" class="form-inline pull-left suggestion_item">{{- "" -}}
<input type="hidden" name="q" value="{{ correction.url }}"> <input type="hidden" name="q" value="{{ correction.url }}">{{- "" -}}
<button type="submit" class="btn btn-default btn-xs">{{ correction.title }}</button> <button type="submit" class="btn btn-default btn-xs">{{ correction.title }}</button>{{- "" -}}
</form> </form>
{% endfor %} {% endfor %}
</div> </div>
{% endif %} {%- endif %}
{% if answers %} {% if answers -%}
{% for answer in answers %} {%- for answer in answers %}
<div class="result well"> <div class="result well">
<span>{{ answer }}</span> <span>{{ answer }}</span>
</div> </div>
{% endfor %} {%- endfor %}
{% endif %} {%- endif %}
{% for result in results %} {% for result in results -%}
<div class="result {% if result['template'] %}result-{{ result.template|replace('.html', '') }}{% else %}result-default{% endif %}"> <div class="result {% if result['template'] %}result-{{ result.template|replace('.html', '') }}{% else %}result-default{% endif %}">
{% set index = loop.index %} {%- set index = loop.index -%}
{% if result.template %} {%- if result.template -%}
{% include get_result_template('oscar', result['template']) %} {% include get_result_template('oscar', result['template']) %}
{% else %} {%- else -%}
{% include 'oscar/result_templates/default.html' %} {% include 'oscar/result_templates/default.html' %}
{% endif %} {%- endif -%}
</div> </div>
{% endfor %} {% endfor %}
{% if not results and not answers %} {% if not results and not answers -%}
{% include 'oscar/messages/no_results.html' %} {% include 'oscar/messages/no_results.html' %}
{% endif %} {% endif %}
<div class="clearfix"></div> <div class="clearfix"></div>
{% if paging %} {% if paging -%}
{% if rtl %} {% if rtl %}
<div id="pagination"> <div id="pagination">
<div class="pull-left"> <div class="pull-left">{{- "" -}}
<form method="{{ method or 'POST' }}" action="{{ url_for('index') }}" class="pull-left"> <form method="{{ method or 'POST' }}" action="{{ url_for('index') }}" class="pull-left">
{{ search_form_attrs(pageno+1) }} {{- search_form_attrs(pageno+1) -}}
<button type="submit" class="btn btn-default"><span class="glyphicon glyphicon-backward"></span> {{ _('next page') }}</button> <button type="submit" class="btn btn-default"><span class="glyphicon glyphicon-backward"></span> {{ _('next page') }}</button>{{- "" -}}
</form> </form>{{- "" -}}
</div> </div>
<div class="pull-right"> <div class="pull-right">{{- "" -}}
<form method="{{ method or 'POST' }}" action="{{ url_for('index') }}" class="pull-left"> <form method="{{ method or 'POST' }}" action="{{ url_for('index') }}" class="pull-left">
{{ search_form_attrs(pageno-1) }} {{- search_form_attrs(pageno-1) -}}
<button type="submit" class="btn btn-default" {% if pageno == 1 %}disabled{% endif %}><span class="glyphicon glyphicon-forward"></span> {{ _('previous page') }}</button> <button type="submit" class="btn btn-default" {% if pageno == 1 %}disabled{% endif %}><span class="glyphicon glyphicon-forward"></span> {{ _('previous page') }}</button>{{- "" -}}
</form> </form>{{- "" -}}
</div> </div>
</div><!-- /#pagination --> </div><!-- /#pagination -->
<div class="clearfix"></div> <div class="clearfix"></div>
{% else %} {% else %}
<div id="pagination"> <div id="pagination">
<div class="pull-left"> <div class="pull-left">{{- "" -}}
<form method="{{ method or 'POST' }}" action="{{ url_for('index') }}" class="pull-left"> <form method="{{ method or 'POST' }}" action="{{ url_for('index') }}" class="pull-left">
{{ search_form_attrs(pageno-1) }} {{- search_form_attrs(pageno-1) -}}
<button type="submit" class="btn btn-default" {% if pageno == 1 %}disabled{% endif %}><span class="glyphicon glyphicon-backward"></span> {{ _('previous page') }}</button> <button type="submit" class="btn btn-default" {% if pageno == 1 %}disabled{% endif %}><span class="glyphicon glyphicon-backward"></span> {{ _('previous page') }}</button>{{- "" -}}
</form> </form>{{- "" -}}
</div> </div>
<div class="pull-right"> <div class="pull-right">{{- "" -}}
<form method="{{ method or 'POST' }}" action="{{ url_for('index') }}" class="pull-left"> <form method="{{ method or 'POST' }}" action="{{ url_for('index') }}" class="pull-left">
{{ search_form_attrs(pageno+1) }} {{- search_form_attrs(pageno+1) -}}
<button type="submit" class="btn btn-default"><span class="glyphicon glyphicon-forward"></span> {{ _('next page') }}</button> <button type="submit" class="btn btn-default"><span class="glyphicon glyphicon-forward"></span> {{ _('next page') }}</button>{{- "" -}}
</form> </form>{{- "" -}}
</div> </div>
</div><!-- /#pagination --> </div><!-- /#pagination -->
<div class="clearfix"></div> <div class="clearfix"></div>
@ -92,24 +93,24 @@
</div><!-- /#main_results --> </div><!-- /#main_results -->
<div class="col-sm-4" id="sidebar_results"> <div class="col-sm-4" id="sidebar_results">
{% if number_of_results != '0' %} {% if number_of_results != '0' -%}
<p><small>{{ _('Number of results') }}: {{ number_of_results }}</small></p> <p><small>{{ _('Number of results') }}: {{ number_of_results }}</small></p>
{% endif %} {%- endif %}
{% if unresponsive_engines and results|length >= 1 %} {% if unresponsive_engines and results|length >= 1 -%}
<div class="alert alert-danger fade in" role="alert"> <div class="alert alert-danger fade in" role="alert">
<p>{{ _('Engines cannot retrieve results') }}:</p> <p>{{ _('Engines cannot retrieve results') }}:</p>
{% for engine_name, error_type in unresponsive_engines %} {%- for engine_name, error_type in unresponsive_engines -%}AAAA
{{ engine_name }} ({{ error_type }}){% if not loop.last %}, {% endif %} {{- engine_name }} ({{ error_type }}){% if not loop.last %}, {% endif %}{{- "" -}}
{% endfor %} {%- endfor -%}
</div> </div>
{% endif %} {%- endif %}
{% if infoboxes %} {% if infoboxes -%}
{% for infobox in infoboxes %} {% for infobox in infoboxes %}
{% include 'oscar/infobox.html' %} {% include 'oscar/infobox.html' %}{{- "\n\n" -}}
{% endfor %} {% endfor %}
{% endif %} {%- endif %}
{% if suggestions %} {% if suggestions %}
<div class="panel panel-default"> <div class="panel panel-default">
@ -125,27 +126,26 @@
{% endfor %} {% endfor %}
</div> </div>
</div> </div>
{% endif %} {%- endif %}
<div class="panel panel-default"> <div class="panel panel-default">
<div class="panel-heading"> <div class="panel-heading">{{- "" -}}
<h4 class="panel-title">{{ _('Links') }}</h4> <h4 class="panel-title">{{ _('Links') }}</h4>{{- "" -}}
</div> </div>
<div class="panel-body"> <div class="panel-body">
<form role="form"> <form role="form">{{- "" -}}
<div class="form-group"> <div class="form-group">{{- "" -}}
<label for="search_url">{{ _('Search URL') }}</label> <label for="search_url">{{ _('Search URL') }}</label>{{- "" -}}
<input id="search_url" type="url" class="form-control select-all-on-click cursor-text" name="search_url" value="{{ search_url() }}" readonly> <input id="search_url" type="url" class="form-control select-all-on-click cursor-text" name="search_url" value="{{ search_url() }}" readonly>{{- "" -}}
</div> </div>{{- "" -}}
</form> </form>
<label>{{ _('Download results') }}</label> <label>{{ _('Download results') }}</label>
<div class="clearfix"></div> <div class="clearfix"></div>
{% for output_type in ('csv', 'json', 'rss') %} {% for output_type in ('csv', 'json', 'rss') %}
<form method="{{ method or 'POST' }}" action="{{ url_for('index') }}" class="form-inline pull-{% if rtl %}right{% else %}left{% endif %} result_download"> <form method="{{ method or 'POST' }}" action="{{ url_for('index') }}" class="form-inline pull-{% if rtl %}right{% else %}left{% endif %} result_download">
{{ search_form_attrs(pageno) }} {{- search_form_attrs(pageno) -}}
<input type="hidden" name="format" value="{{ output_type }}"> <input type="hidden" name="format" value="{{ output_type }}">{{- "" -}}
<button type="submit" class="btn btn-default">{{ output_type }}</button> <button type="submit" class="btn btn-default">{{ output_type }}</button>{{- "" -}}
</form> </form>
{% endfor %} {% endfor %}
<div class="clearfix"></div> <div class="clearfix"></div>

View File

@ -10,15 +10,15 @@
</div> </div>
</div> </div>
<div class="col-xs-6 col-md-2 search-margin"> <div class="col-xs-6 col-md-2 search-margin">
{% include 'oscar/time-range.html' %} {%- include 'oscar/time-range.html' -%}
</div> </div>
<div class="col-xs-6 col-md-2 search-margin"> <div class="col-xs-6 col-md-2 search-margin">
{% include 'oscar/languages.html' %} {%- include 'oscar/languages.html' -%}
</div> </div>
</div> </div>
<div class="row"> <div class="row">
<div class="col-sm-12"> <div class="col-sm-12">
{% include 'oscar/categories.html' %} {%- include 'oscar/categories.html' -%}
</div> </div>
</div> </div>
</form><!-- / #search_form_full --> </form><!-- / #search_form_full -->

View File

@ -1,17 +1,17 @@
<select name="time_range" id="time-range" class="custom-select form-control"> <select name="time_range" id="time-range" class="custom-select form-control">{{- "" -}}
<option id="time-range-anytime" value="" {{ "selected" if time_range=="" or not time_range else ""}}> <option id="time-range-anytime" value="" {{ "selected" if time_range=="" or not time_range else ""}}>
{{ _('Anytime') }} {{- _('Anytime') -}}
</option> </option>{{- "" -}}
<option id="time-range-day" value="day" {{ "selected" if time_range=="day" else ""}}> <option id="time-range-day" value="day" {{ "selected" if time_range=="day" else ""}}>
{{ _('Last day') }} {{- _('Last day') -}}
</option> </option>{{- "" -}}
<option id="time-range-week" value="week" {{ "selected" if time_range=="week" else ""}}> <option id="time-range-week" value="week" {{ "selected" if time_range=="week" else ""}}>
{{ _('Last week') }} {{- _('Last week') -}}
</option> </option>{{- "" -}}
<option id="time-range-month" value="month" {{ "selected" if time_range=="month" else ""}}> <option id="time-range-month" value="month" {{ "selected" if time_range=="month" else ""}}>
{{ _('Last month') }} {{- _('Last month') -}}
</option> </option>{{- "" -}}
<option id="time-range-year" value="year" {{ "selected" if time_range=="year" else ""}}> <option id="time-range-year" value="year" {{ "selected" if time_range=="year" else ""}}>
{{ _('Last year') }} {{- _('Last year') -}}
</option> </option>{{- "" -}}
</select> </select>