diff options
Diffstat (limited to 'searx/templates')
26 files changed, 570 insertions, 518 deletions
diff --git a/searx/templates/courgette/result_templates/key-value.html b/searx/templates/courgette/result_templates/key-value.html new file mode 100644 index 000000000..789e8de92 --- /dev/null +++ b/searx/templates/courgette/result_templates/key-value.html @@ -0,0 +1,13 @@ +<div class="result"> +<table> + {% for key, value in result.items() %} + {% if key in ['engine', 'engines', 'template', 'score', 'category', 'positions'] %} + {% continue %} + {% endif %} + <tr> + <td><b>{{ key|upper }}</b>: {{ value|safe }}</td> + </tr> + {% endfor %} +</table> +<p class="engines">{{ result.engines|join(', ') }}</p> +</div> diff --git a/searx/templates/courgette/result_templates/torrent.html b/searx/templates/courgette/result_templates/torrent.html index d659064d9..7f94a221e 100644 --- a/searx/templates/courgette/result_templates/torrent.html +++ b/searx/templates/courgette/result_templates/torrent.html @@ -4,7 +4,7 @@ {% endif %} <h3 class="result_title"><a href="{{ result.url }}" {% if results_on_new_tab %}target="_blank" rel="noopener noreferrer"{% else %}rel="noreferrer"{% endif %}>{{ result.title|safe }}</a></h3> {% if result.content %}<span class="content">{{ result.content|safe }}</span><br />{% endif %} - {% if result.seed %}<span class="stats">{{ _('Seeder') }} : {{ result.seed }}, {{ _('Leecher') }} : {{ result.leech }}</span><br />{% endif %} + {% if result.seed is defined %}<span class="stats">{{ _('Seeder') }} : {{ result.seed }}, {{ _('Leecher') }} : {{ result.leech }}</span><br />{% endif %} <span> {% if result.magnetlink %}<a href="{{ result.magnetlink }}" class="magnetlink">{{ _('magnet link') }}</a>{% endif %} {% if result.torrentfile %}<a href="{{ result.torrentfile }}" class="torrentfile" {% if results_on_new_tab %}target="_blank" rel="noopener noreferrer"{% else %}rel="noreferrer"{% endif %}>{{ _('torrent file') }}</a>{% endif %} diff --git a/searx/templates/legacy/result_templates/key-value.html b/searx/templates/legacy/result_templates/key-value.html new file mode 100644 index 000000000..a5bb509d9 --- /dev/null +++ b/searx/templates/legacy/result_templates/key-value.html @@ -0,0 +1,13 @@ +<table class="result-table"> + {% for key, value in result.items() %} + {% if key in ['engine', 'engines', 'template', 'score', 'category', 'positions'] %} + {% continue %} + {% endif %} + <tr> + <td><b>{{ key|upper }}</b>: {{ value|safe }}</td> + </tr> + {% endfor %} + <tr> + <td><b>ENGINES</b>: {{ result.engines|join(', ') }}</td> + </tr> +</table> diff --git a/searx/templates/legacy/result_templates/torrent.html b/searx/templates/legacy/result_templates/torrent.html index 7a8ac33de..068e05373 100644 --- a/searx/templates/legacy/result_templates/torrent.html +++ b/searx/templates/legacy/result_templates/torrent.html @@ -8,6 +8,6 @@ <p> {% if result.magnetlink %}<a href="{{ result.magnetlink }}" class="magnetlink">{{ _('magnet link') }}</a>{% endif %} {% if result.torrentfile %}<a href="{{ result.torrentfile }}" {% if results_on_new_tab %}target="_blank" rel="noopener noreferrer"{% else %}rel="noreferrer"{% endif %} class="torrentfile">{{ _('torrent file') }}</a>{% endif %} - - {% if result.seed %}<span class="stats">{{ _('Seeder') }} : {{ result.seed }}, {{ _('Leecher') }} : {{ result.leech }}</span>{% endif %} + {% if result.seed is defined %}<span class="stats">{{ _('Seeder') }} : {{ result.seed }}, {{ _('Leecher') }} : {{ result.leech }}</span>{% endif %} </p> </div> diff --git a/searx/templates/oscar/advanced.html b/searx/templates/oscar/advanced.html index 95d99ba6a..bf5f86324 100644 --- a/searx/templates/oscar/advanced.html +++ b/searx/templates/oscar/advanced.html @@ -1,16 +1,17 @@ <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> - {{ _('Advanced settings') }} + {{- _('Advanced settings') -}} </label> <div id="advanced-search-container"> {% include 'oscar/categories.html' %} + <div class="row"> <div class="col-xs-6"> - {% include 'oscar/time-range.html' %} + {%- include 'oscar/time-range.html' -%} </div> <div class="col-xs-6"> - {% include 'oscar/languages.html' %} + {%- include 'oscar/languages.html' -%} </div> </div> </div> diff --git a/searx/templates/oscar/base.html b/searx/templates/oscar/base.html index 321784ebb..66a9e6029 100644 --- a/searx/templates/oscar/base.html +++ b/searx/templates/oscar/base.html @@ -10,16 +10,17 @@ <meta name="referrer" content="no-referrer"> <meta name="viewport" content="width=device-width, initial-scale=1 , maximum-scale=1.0, user-scalable=1" /> {% 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" /> - {% 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" /> - {% else %} - <link rel="stylesheet" href="{{ url_for('static', filename='css/logicodev.min.css') }}" type="text/css" /> - {% endif %} + {% 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" /> + {%- else -%} + {{' '}}<link rel="stylesheet" href="{{ url_for('static', filename='css/logicodev.min.css') }}" type="text/css" /> + {%- endif %} + <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" /> {% endfor %} @@ -48,6 +49,7 @@ </head> <body> {% include 'oscar/navbar.html' %} + <div class="container"> {% if errors %} <div class="alert alert-danger fade in" role="alert"> @@ -93,13 +95,14 @@ </div> <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> - {% 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/searx.min.js') }}" data-method="{{ method or 'POST' }}" data-autocompleter="{% if autocomplete %}true{% else %}false{% endif %}"></script> {% for script in scripts %} - <script src="{{ url_for('static', filename=script) }}"></script> + {{""}}<script src="{{ url_for('static', filename=script) }}"></script> {% endfor %} <noscript> <style> diff --git a/searx/templates/oscar/categories.html b/searx/templates/oscar/categories.html index 1ace10f16..a5c5f61c7 100644 --- a/searx/templates/oscar/categories.html +++ b/searx/templates/oscar/categories.html @@ -1,13 +1,13 @@ <div id="categories"> -{% if rtl %} - {% 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 %} /> +{%- if rtl -%} + {% 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 %} />{{- '' -}} <label for="checkbox_{{ category|replace(' ', '_') }}">{{ _(category) }}</label> - {% endfor %} -{% else %} - {% for category in categories %} - <input class="hidden" type="checkbox" id="checkbox_{{ category|replace(' ', '_') }}" name="category_{{ category }}" {% if category in selected_categories %}checked="checked"{% endif %} /> + {%- endfor %} +{%- else -%} + {% for category in categories -%} + <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> - {% endfor %} -{% endif %} + {%- endfor %} +{%- endif -%} </div> diff --git a/searx/templates/oscar/infobox.html b/searx/templates/oscar/infobox.html index c98fb0e63..9802f11e2 100644 --- a/searx/templates/oscar/infobox.html +++ b/searx/templates/oscar/infobox.html @@ -1,34 +1,35 @@ {% from 'oscar/macros.html' import result_link with context %} <div class="panel panel-default infobox"> - <div class="panel-heading"> - <h4 class="panel-title infobox_part"><bdi>{{ infobox.infobox }}</bdi></h4> + <div class="panel-heading">{{- "" -}} + <h4 class="panel-title infobox_part"><bdi>{{ infobox.infobox }}</bdi></h4>{{- "" -}} </div> <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.content %}<bdi><p class="infobox_part">{{ infobox.content }}</bdi></p>{% endif %} - {% if infobox.attributes %} + {% if infobox.content %}<bdi><p class="infobox_part">{{ infobox.content | safe }}</p></bdi>{% endif %} + + {% if infobox.attributes -%} <table class="table table-striped infobox_part"> - {% for attribute in infobox.attributes %} - <tr> + {% for attribute in infobox.attributes -%} + <tr>{{- "" -}} <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> - {% else %} + {%- else -%} <td><bdi>{{ attribute.value }}</bdi></td> - {% endif %} + {%- endif -%} </tr> - {% endfor %} + {% endfor -%} </table> {% endif %} - {% if infobox.urls %} - <div class="infobox_part"> + {% if infobox.urls -%} + <div class="infobox_part">{{- "\n" -}} <bdi> - {% for url in infobox.urls %} - <p class="btn btn-default btn-xs">{{ result_link(url.url, url.title) }}</a></p> - {% endfor %} - </bdi> + {%- for url in infobox.urls -%} + <p class="btn btn-default btn-xs">{{ result_link(url.url, url.title) }}</p> + {% endfor -%} + </bdi>{{- "" -}} </div> {% endif %} </div> diff --git a/searx/templates/oscar/languages.html b/searx/templates/oscar/languages.html index 53ade43b2..5aff9f918 100644 --- a/searx/templates/oscar/languages.html +++ b/searx/templates/oscar/languages.html @@ -1,12 +1,8 @@ -{% if preferences %} -<select class="custom-select form-control" name='language'> -{% else %} -<select class="time_range custom-select form-control" id='language' name='language'> -{% endif %} - <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) %} - <option value="{{ lang_id }}" {% if lang_id == current_language %}selected="selected"{% endif %}> - {{ lang_name }} {% if country_name %}({{ country_name }}) {% endif %}- {{ lang_id }} - </option> - {% endfor %} +<select class="language custom-select form-control" id="language" name="language" accesskey="l"> + <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) -%} + <option value="{{ lang_id }}" {% if lang_id == current_language %}selected="selected"{% endif %}> + {{- lang_name }} {% if country_name %}({{ country_name }}) {% endif %}- {{ lang_id -}} + </option> +{%- endfor -%} </select> diff --git a/searx/templates/oscar/macros.html b/searx/templates/oscar/macros.html index 0ff957521..d2d1dc643 100644 --- a/searx/templates/oscar/macros.html +++ b/searx/templates/oscar/macros.html @@ -14,7 +14,7 @@ <!-- Draw result header --> {% macro result_header(result, favicons) -%} -<h4 class="result_header">{% if result.engine~".png" in favicons %}{{ draw_favicon(result.engine) }} {% endif %}{{ result_link(result.url, result.title|safe) }}</h4> +<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> {%- endmacro %} <!-- Draw result sub header --> @@ -26,30 +26,38 @@ <!-- Draw result footer --> {% macro result_footer(result) -%} - <div class="clearfix"></div> + <div class="clearfix"></div>{{- "" -}} <div class="pull-right"> - {% for engine in result.engines %} - <span class="label label-default">{{ engine }}</span> - {% endfor %} - <small>{{ result_link("https://web.archive.org/web/" + result.url, icon('link') + _('cached'), "text-info") }}</small> - {% if proxify %} - <small>{{ result_link(proxify(result.url), icon('sort') + _('proxied'), "text-info") }}</small> - {% endif %} -</div> -<div class="external-link">{{ result.pretty_url }}</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> + {%- endif -%} + {%- if proxify -%} + <small>{{ result_link(proxify(result.url), icon('sort') + _('proxied'), "text-info") }}</small> + {%- endif -%} + </div> + {%- if result.pretty_url -%} + <div class="external-link">{{ result.pretty_url }}</div> + {%- endif -%} {%- endmacro %} <!-- Draw result footer --> {% macro result_footer_rtl(result) -%} - <div class="clearfix"></div> - {% for engine in result.engines %} + <div class="clearfix"></div>{{- "" -}} + {% for engine in result.engines -%} <span class="label label-default">{{ engine }}</span> - {% endfor %} + {%- endfor %} + {%- if result.url -%} <small>{{ result_link("https://web.archive.org/web/" + result.url, icon('link') + _('cached'), "text-info") }}</small> - {% if proxify %} + {%- endif -%} + {% if proxify -%} <small>{{ result_link(proxify(result.url), icon('sort') + _('proxied'), "text-info") }}</small> - {% endif %} + {%- endif %} + {%- if result.pretty_url -%} <div class="external-link">{{ result.pretty_url }}</div> + {%- endif %} {%- endmacro %} {% macro preferences_item_header(info, label, rtl) -%} diff --git a/searx/templates/oscar/navbar.html b/searx/templates/oscar/navbar.html index 12bf14ffa..077fb9f15 100644 --- a/searx/templates/oscar/navbar.html +++ b/searx/templates/oscar/navbar.html @@ -1,9 +1,9 @@ -<div class="searx-navbar"> - <span class="instance {% if rtl %}pull-right{% else %}pull-left{% endif%}"> - <a href="{{ url_for('index') }}">{{ instance_name }}</a> - </span> - <span class="{% if rtl %}pull-left{% else %}pull-right{% endif %}"> - <a href="{{ url_for('about') }}">{{ _('about') }}</a> - <a href="{{ url_for('preferences') }}">{{ _('preferences') }}</a> - </span> +<div class="searx-navbar">{{- "" -}} + <span class="instance {% if rtl %}pull-right{% else %}pull-left{% endif%}">{{- "" -}} + <a href="{{ url_for('index') }}">{{ instance_name }}</a>{{- "" -}} + </span>{{- "" -}} + <span class="{% if rtl %}pull-left{% else %}pull-right{% endif %}">{{- "" -}} + <a href="{{ url_for('about') }}">{{ _('about') }}</a>{{- "" -}} + <a href="{{ url_for('preferences') }}">{{ _('preferences') }}</a>{{- "" -}} + </span>{{- "" -}} </div> diff --git a/searx/templates/oscar/preferences.html b/searx/templates/oscar/preferences.html index b64d72ddf..1a484dd4b 100644 --- a/searx/templates/oscar/preferences.html +++ b/searx/templates/oscar/preferences.html @@ -41,7 +41,7 @@ {% set language_label = _('Search language') %} {% set language_info = _('What language do you prefer for search?') %} {{ preferences_item_header(language_info, language_label, rtl) }} - {% include 'oscar/languages.html' %} + {% include 'oscar/languages.html' %} {{ preferences_item_footer(language_info, language_label, rtl) }} {% set locale_label = _('Interface language') %} @@ -156,26 +156,26 @@ <div class="container-fluid"> <fieldset> <div class="table-responsive"> - <table class="table table-hover table-condensed table-striped"> - <tr> + <table class="table table-hover table-condensed table-striped"> + <tr> {% if not rtl %} - <th>{{ _("Allow") }}</th> - <th>{{ _("Engine name") }}</th> - <th>{{ _("Shortcut") }}</th> - <th>{{ _("Selected language") }}</th> - <th>{{ _("SafeSearch") }}</th> - <th>{{ _("Time range") }}</th> - <th>{{ _("Avg. time") }}</th> - <th>{{ _("Max time") }}</th> + <th>{{ _("Allow") }}</th> + <th>{{ _("Engine name") }}</th> + <th>{{ _("Shortcut") }}</th> + <th>{{ _("Selected language") }}</th> + <th>{{ _("SafeSearch") }}</th> + <th>{{ _("Time range") }}</th> + <th>{{ _("Avg. time") }}</th> + <th>{{ _("Max time") }}</th> {% else %} - <th>{{ _("Max time") }}</th> - <th>{{ _("Avg. time") }}</th> - <th>{{ _("Time range") }}</th> - <th>{{ _("SafeSearch") }}</th> - <th>{{ _("Selected language") }}</th> - <th>{{ _("Shortcut") }}</th> - <th>{{ _("Engine name") }}</th> - <th>{{ _("Allow") }}</th> + <th>{{ _("Max time") }}</th> + <th>{{ _("Avg. time") }}</th> + <th>{{ _("Time range") }}</th> + <th>{{ _("SafeSearch") }}</th> + <th>{{ _("Selected language") }}</th> + <th>{{ _("Shortcut") }}</th> + <th>{{ _("Engine name") }}</th> + <th>{{ _("Allow") }}</th> {% endif %} </tr> {% for search_engine in engines_by_category[categ] %} @@ -186,19 +186,19 @@ {{ checkbox_toggle('engine_' + search_engine.name|replace(' ', '_') + '__' + categ|replace(' ', '_'), (search_engine.name, categ) in disabled_engines) }} </td> <th>{{ search_engine.name }}</th> - <td class="name">{{ shortcuts[search_engine.name] }}</td> - <td>{{ support_toggle(stats[search_engine.name].supports_selected_language) }}</td> - <td>{{ support_toggle(search_engine.safesearch==True) }}</td> - <td>{{ support_toggle(search_engine.time_range_support==True) }}</td> - <td class="{{ 'danger' if stats[search_engine.name]['warn_time'] else '' }}">{{ 'N/A' if stats[search_engine.name].time==None else stats[search_engine.name].time }}</td> - <td class="{{ 'danger' if stats[search_engine.name]['warn_timeout'] else '' }}">{{ search_engine.timeout }}</td> - {% else %} - <td class="{{ 'danger' if stats[search_engine.name]['warn_timeout'] else '' }}">{{ search_engine.timeout }}</td> - <td class="{{ 'danger' if stats[search_engine.name]['warn_time'] else '' }}">{{ 'N/A' if stats[search_engine.name].time==None else stats[search_engine.name].time }}</td> - <td>{{ support_toggle(search_engine.time_range_support==True) }}</td> - <td>{{ support_toggle(search_engine.safesearch==True) }}</td> - <td>{{ support_toggle(stats[search_engine.name].supports_selected_language) }}</td> - <td>{{ shortcuts[search_engine.name] }}</td> + <td class="name">{{ shortcuts[search_engine.name] }}</td> + <td>{{ support_toggle(stats[search_engine.name].supports_selected_language) }}</td> + <td>{{ support_toggle(search_engine.safesearch==True) }}</td> + <td>{{ support_toggle(search_engine.time_range_support==True) }}</td> + <td class="{{ 'danger' if stats[search_engine.name]['warn_time'] else '' }}">{{ 'N/A' if stats[search_engine.name].time==None else stats[search_engine.name].time }}</td> + <td class="{{ 'danger' if stats[search_engine.name]['warn_timeout'] else '' }}">{{ search_engine.timeout }}</td> + {% else %} + <td class="{{ 'danger' if stats[search_engine.name]['warn_timeout'] else '' }}">{{ search_engine.timeout }}</td> + <td class="{{ 'danger' if stats[search_engine.name]['warn_time'] else '' }}">{{ 'N/A' if stats[search_engine.name].time==None else stats[search_engine.name].time }}</td> + <td>{{ support_toggle(search_engine.time_range_support==True) }}</td> + <td>{{ support_toggle(search_engine.safesearch==True) }}</td> + <td>{{ support_toggle(stats[search_engine.name].supports_selected_language) }}</td> + <td>{{ shortcuts[search_engine.name] }}</td> <th>{{ search_engine.name }}</th> <td class="onoff-checkbox"> {{ checkbox_toggle('engine_' + search_engine.name|replace(' ', '_') + '__' + categ|replace(' ', '_'), (search_engine.name, categ) in disabled_engines) }} @@ -207,7 +207,7 @@ </tr> {% endif %} {% endfor %} - </table> + </table> </div> </fieldset> </div> diff --git a/searx/templates/oscar/result_templates/code.html b/searx/templates/oscar/result_templates/code.html index ba74d0333..a1c18a6b7 100644 --- a/searx/templates/oscar/result_templates/code.html +++ b/searx/templates/oscar/result_templates/code.html @@ -1,18 +1,18 @@ -{% from 'oscar/macros.html' import result_header, result_sub_header, result_footer, result_footer_rtl, icon %}
-
-{{ 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 %}
-
-<div dir="ltr">
-{{ result.codelines|code_highlighter(result.code_language)|safe }}
-</div>
-
-{% if rtl %}
-{{ result_footer_rtl(result) }}
-{% else %}
-{{ result_footer(result) }}
-{% endif %}
+{% from 'oscar/macros.html' import result_header, result_sub_header, result_footer, result_footer_rtl, icon %} + +{{ 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 %} + +<div dir="ltr"> +{{ result.codelines|code_highlighter(result.code_language)|safe }} +</div> + +{% if rtl %} +{{ result_footer_rtl(result) }} +{% else %} +{{ result_footer(result) }} +{% endif %} diff --git a/searx/templates/oscar/result_templates/default.html b/searx/templates/oscar/result_templates/default.html index 3ed0f3122..885cbbfa8 100644 --- a/searx/templates/oscar/result_templates/default.html +++ b/searx/templates/oscar/result_templates/default.html @@ -1,31 +1,31 @@ -{% 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.embedded %}
- <small> • <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 %}
-
-{% if result.embedded %}
-<div id="result-media-{{ index }}" class="collapse">
- {{ result.embedded|safe }}
-</div>
-{% endif %}
-
-{% if result.img_src %}
-<div class="container-fluid">
- <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">
-{% if result.content %}<p class="result-content col-xs-8 col-sm-8 col-md-8">{{ result.content|safe }}</p>{% endif %}
- </div>
-</div>
-{% else %}
-{% if result.content %}<p class="result-content">{{ result.content|safe }}</p>{% endif %}
-{% endif %}
-
-{% if rtl %}
-{{ result_footer_rtl(result) }}
-{% else %}
-{{ result_footer(result) }}
-{% endif %}
+{% 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.embedded -%} + <small> • <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 -%} + +{%- if result.embedded -%} +<div id="result-media-{{ index }}" class="collapse"> + {{ result.embedded|safe }} +</div> +{%- endif -%} + +{%- if result.img_src -%} +<div class="container-fluid"> + <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"> +{% if result.content %}<p class="result-content col-xs-8 col-sm-8 col-md-8">{{ result.content|safe }}</p>{% endif -%} + </div> +</div> +{%- else -%} +{%- if result.content %}<p class="result-content">{{ result.content|safe }}</p>{% endif -%} +{%- endif -%} + +{%- if rtl -%} +{{ result_footer_rtl(result) }} +{%- else -%} +{{ result_footer(result) }} +{%- endif -%} diff --git a/searx/templates/oscar/result_templates/images.html b/searx/templates/oscar/result_templates/images.html index b3292f448..d0a3b7b83 100644 --- a/searx/templates/oscar/result_templates/images.html +++ b/searx/templates/oscar/result_templates/images.html @@ -1,49 +1,36 @@ -{% 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}}">
- <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">
- <div class="modal-dialog">
- <div class="modal-wrapper">
- <div class="modal-header">
- <button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">×</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>
- </div>
- <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 }}">
- {% if result.author %}<span class="photo-author">{{ result.author }}</span><br />{% endif %}
- {% if result.content %}
- <p class="result-content">
- {{ result.content|striptags }}
- </p>
- {% endif %}
- {% if result.img_format %}
- <p class="result-format">
- {{ result.img_format }}
- </p>
- {% endif %}
- {% if result.source %}
- <p class="result-source">
- {{ result.source }}
- </p>
- {% endif %}
- </div>
- <div class="modal-footer">
- <div class="clearfix"></div>
- <span class="label label-default pull-right">{{ result.engine }}</span>
- <p class="text-muted pull-left">{{ result.pretty_url }}</p>
- <div class="clearfix"></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>
+{%- 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}}">{{- "" -}} + <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">{{- "" -}} + <div class="modal-dialog">{{- "" -}} + <div class="modal-wrapper">{{- "" -}} + <div class="modal-header">{{- "" -}} + <button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">×</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>{{- "" -}} + </div>{{- "" -}} + <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 }}"> + {%- if result.author %}<span class="photo-author">{{ result.author }}</span><br />{% endif -%} + {%- if result.content %}<p class="result-content">{{ result.content|striptags }}</p>{% endif -%} + {%- if result.img_format %}<p class="result-format">{{ result.img_format }}</p>{% endif -%} + {%- if result.source %}<p class="result-source">{{ result.source }}</p>{% endif -%} + </div>{{- "" -}} + <div class="modal-footer">{{- "" -}} + <div class="clearfix"></div>{{- "" -}} + <span class="label label-default pull-right">{{ result.engine }}</span>{{- "" -}} + <p class="text-muted pull-left">{{ result.pretty_url }}</p>{{- "" -}} + <div class="clearfix"></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>{{- "" -}} diff --git a/searx/templates/oscar/result_templates/key-value.html b/searx/templates/oscar/result_templates/key-value.html new file mode 100644 index 000000000..67c748e7f --- /dev/null +++ b/searx/templates/oscar/result_templates/key-value.html @@ -0,0 +1,19 @@ +{% from 'oscar/macros.html' import result_footer, result_footer_rtl with context %} +<div class="panel panel-default"> +<table class="table table-responsive table-bordered table-condensed"> + {% for key, value in result.items() %} + {% if key in ['engine', 'engines', 'template', 'score', 'category', 'positions'] %} + {% continue %} + {% endif %} + <tr> + <td><b>{{ key|upper }}</b>: {{ value }}</td> + </tr> + {% endfor %} +</table> + +{% if rtl %} +{{ result_footer_rtl(result) }} +{% else %} +{{ result_footer(result) }} +{% endif %} +</div> diff --git a/searx/templates/oscar/result_templates/map.html b/searx/templates/oscar/result_templates/map.html index 822c7cdea..712375d7f 100644 --- a/searx/templates/oscar/result_templates/map.html +++ b/searx/templates/oscar/result_templates/map.html @@ -1,72 +1,72 @@ -{% from 'oscar/macros.html' import result_header, result_sub_header, result_footer, result_footer_rtl, icon %}
-
-{{ result_header(result, favicons) }}
-{{ result_sub_header(result) }}
-
-{% if (result.latitude and result.longitude) or result.boundingbox %}
- <small> • <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>
-{% endif %}
-
-{% if result.osm and (result.osm.type and result.osm.id) %}
- <small> • <a class="text-info btn-collapse collapsed cursor-pointer searx_overpass_request disabled_if_nojs" data-toggle="collapse" data-target="#result-overpass-{{ index }}" data-osm-type="{{ result.osm.type }}" data-osm-id="{{ result.osm.id }}" data-result-table="result-overpass-table-{{ index }}" data-result-table-loadicon="result-overpass-table-loading-{{ index }}" data-btn-text-collapsed="{{ _('show details') }}" data-btn-text-not-collapsed="{{ _('hide details') }}">{{ icon('map-marker') }} {{ _('show details') }}</a></small>
-{% endif %}
-
-{# {% if (result.latitude and result.longitude) %}
- <small> • <a class="text-info btn-collapse collapsed cursor-pointer disabled_if_nojs" data-toggle="collapse" data-target="#result-geodata-{{ index }}" data-btn-text-collapsed="{{ _('show geodata') }}" data-btn-text-not-collapsed="{{ _('hide geodata') }}">{{ icon('map-marker') }} {{ _('show geodata') }}</a></small>
-{% endif %} #}
-
-<div class="container-fluid">
-
-{% if result.address %}
-<p class="row result-content result-adress col-xs-12 col-sm-5 col-md-4" itemscope itemtype="http://schema.org/PostalAddress">
- {% if result.address.name %}
- <strong itemprop="name">{{ result.address.name }}</strong><br/>
- {% endif %}
- {% if result.address.road %}
- <span itemprop="streetAddress">
- {% if result.address.house_number %}{{ result.address.house_number }}, {% endif %}
- {{ result.address.road }}
- </span><br/>
- {% endif %}
- {% if result.address.locality %}
- <span itemprop="addressLocality">{{ result.address.locality }}</span>
- {% if result.address.postcode %}, <span itemprop="postalCode">{{ result.address.postcode }}</span>{% endif %}
- <br/>
- {% endif %}
- {% if result.address.country %}
- <span itemprop="addressCountry">{{ result.address.country }}</span>
- {% endif %}
-</p>
-{% endif %}
-
-{% if result.osm and (result.osm.type and result.osm.id) %}
- <div class="row result-content collapse col-xs-12 col-sm-7 col-md-8" id="result-overpass-{{ index }}"{% if rtl %} dir="ltr"{% endif %}>
- <div class="text-center" id="result-overpass-table-loading-{{ index }}"><img src="{{ url_for('static', filename='img/loader.gif') }}" alt="Loading ..."/></div>
- <table class="table table-striped table-condensed hidden" id="result-overpass-table-{{ index }}">
- <tr><th>key</th><th>value</th></tr>
- </table>
- </div>
-{% endif %}
-
-{# {% if (result.latitude and result.longitude) %}
- <div class="row collapse col-xs-12 col-sm-5 col-md-4" id="result-geodata-{{ index }}">
- <strong>Longitude:</strong> {{ result.longitude }} <br/>
- <strong>Latitude:</strong> {{ result.latitude }}
- </div>
-{% endif %} #}
-
-{% if result.content %}<p class="row result-content col-xs-12 col-sm-12 col-md-12">{{ result.content|safe }}</p>{% endif %}
-
-</div>
-
-{% if (result.latitude and result.longitude) or result.boundingbox %}
- <div class="collapse" id="result-map-{{ index }}">
- <div style="height:300px; width:100%; margin: 10px 0;" id="osm-map-{{ index }}"></div>
- </div>
-{% endif %}
-
-{% if rtl %}
-{{ result_footer_rtl(result) }}
-{% else %}
-{{ result_footer(result) }}
-{% endif %}
+{% from 'oscar/macros.html' import result_header, result_sub_header, result_footer, result_footer_rtl, icon %} + +{{ result_header(result, favicons) }} +{{ result_sub_header(result) }} + +{% if (result.latitude and result.longitude) or result.boundingbox %} + <small> • <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> +{% endif %} + +{% if result.osm and (result.osm.type and result.osm.id) %} + <small> • <a class="text-info btn-collapse collapsed cursor-pointer searx_overpass_request disabled_if_nojs" data-toggle="collapse" data-target="#result-overpass-{{ index }}" data-osm-type="{{ result.osm.type }}" data-osm-id="{{ result.osm.id }}" data-result-table="result-overpass-table-{{ index }}" data-result-table-loadicon="result-overpass-table-loading-{{ index }}" data-btn-text-collapsed="{{ _('show details') }}" data-btn-text-not-collapsed="{{ _('hide details') }}">{{ icon('map-marker') }} {{ _('show details') }}</a></small> +{% endif %} + +{# {% if (result.latitude and result.longitude) %} + <small> • <a class="text-info btn-collapse collapsed cursor-pointer disabled_if_nojs" data-toggle="collapse" data-target="#result-geodata-{{ index }}" data-btn-text-collapsed="{{ _('show geodata') }}" data-btn-text-not-collapsed="{{ _('hide geodata') }}">{{ icon('map-marker') }} {{ _('show geodata') }}</a></small> +{% endif %} #} + +<div class="container-fluid"> + +{% if result.address %} +<p class="row result-content result-adress col-xs-12 col-sm-5 col-md-4" itemscope itemtype="http://schema.org/PostalAddress"> + {% if result.address.name %} + <strong itemprop="name">{{ result.address.name }}</strong><br/> + {% endif %} + {% if result.address.road %} + <span itemprop="streetAddress"> + {% if result.address.house_number %}{{ result.address.house_number }}, {% endif %} + {{ result.address.road }} + </span><br/> + {% endif %} + {% if result.address.locality %} + <span itemprop="addressLocality">{{ result.address.locality }}</span> + {% if result.address.postcode %}, <span itemprop="postalCode">{{ result.address.postcode }}</span>{% endif %} + <br/> + {% endif %} + {% if result.address.country %} + <span itemprop="addressCountry">{{ result.address.country }}</span> + {% endif %} +</p> +{% endif %} + +{% if result.osm and (result.osm.type and result.osm.id) %} + <div class="row result-content collapse col-xs-12 col-sm-7 col-md-8" id="result-overpass-{{ index }}"{% if rtl %} dir="ltr"{% endif %}> + <div class="text-center" id="result-overpass-table-loading-{{ index }}"><img src="{{ url_for('static', filename='img/loader.gif') }}" alt="Loading ..."/></div> + <table class="table table-striped table-condensed hidden" id="result-overpass-table-{{ index }}"> + <tr><th>key</th><th>value</th></tr> + </table> + </div> +{% endif %} + +{# {% if (result.latitude and result.longitude) %} + <div class="row collapse col-xs-12 col-sm-5 col-md-4" id="result-geodata-{{ index }}"> + <strong>Longitude:</strong> {{ result.longitude }} <br/> + <strong>Latitude:</strong> {{ result.latitude }} + </div> +{% endif %} #} + +{% if result.content %}<p class="row result-content col-xs-12 col-sm-12 col-md-12">{{ result.content|safe }}</p>{% endif %} + +</div> + +{% if (result.latitude and result.longitude) or result.boundingbox %} + <div class="collapse" id="result-map-{{ index }}"> + <div style="height:300px; width:100%; margin: 10px 0;" id="osm-map-{{ index }}"></div> + </div> +{% endif %} + +{% if rtl %} +{{ result_footer_rtl(result) }} +{% else %} +{{ result_footer(result) }} +{% endif %} diff --git a/searx/templates/oscar/result_templates/torrent.html b/searx/templates/oscar/result_templates/torrent.html index f5ea415e2..089367e36 100644 --- a/searx/templates/oscar/result_templates/torrent.html +++ b/searx/templates/oscar/result_templates/torrent.html @@ -3,7 +3,7 @@ {{ result_header(result, favicons) }} {{ result_sub_header(result) }} -{% if result.seed %}<p class="result-content">{{ icon('transfer') }} {{ _('Seeder') }} <span class="badge">{{ result.seed }}</span> • {{ _('Leecher') }} <span class="badge">{{ result.leech }}</span>{% endif %} +{% if result.seed is defined %}<p class="result-content">{{ icon('transfer') }} {{ _('Seeder') }} <span class="badge">{{ result.seed }}</span> • {{ _('Leecher') }} <span class="badge">{{ result.leech }}</span>{% endif %} {% if result.filesize %}<br />{{ icon('floppy-disk') }} {{ _('Filesize') }} <span class="badge"> {% if result.filesize < 1024 %}{{ result.filesize }} {{ _('Bytes') }} diff --git a/searx/templates/oscar/result_templates/videos.html b/searx/templates/oscar/result_templates/videos.html index 36fb26240..3c1913d9d 100644 --- a/searx/templates/oscar/result_templates/videos.html +++ b/searx/templates/oscar/result_templates/videos.html @@ -1,27 +1,27 @@ -{% from 'oscar/macros.html' import result_header, result_sub_header, result_footer, result_footer_rtl, icon %}
-
-{{ result_header(result, favicons) }}
-{{ result_sub_header(result) }}
-
-{% if result.embedded %}
- <small> • <a class="text-info btn-collapse collapsed cursor-pointer media-loader disabled_if_nojs" data-toggle="collapse" data-target="#result-video-{{ index }}" data-btn-text-collapsed="{{ _('show video') }}" data-btn-text-not-collapsed="{{ _('hide video') }}">{{ icon('film') }} {{ _('show video') }}</a></small>
-{% endif %}
-
-{% if result.embedded %}
-<div id="result-video-{{ index }}" class="collapse">
- {{ result.embedded|safe }}
-</div>
-{% endif %}
-
-<div class="container-fluid">
- <div class="row">
- <a href="{{ result.url }}" {% if results_on_new_tab %}target="_blank" rel="noopener noreferrer"{% else %}rel="noreferrer"{% endif %}><img class="thumbnail col-xs-6 col-sm-4 col-md-4 result-content" src="{{ image_proxify(result.thumbnail) }}" alt="{{ result.title|striptags }} {{ result.engine }}" /></a>
- {% if result.content %}<p class="col-xs-12 col-sm-8 col-md-8 result-content">{{ result.content|safe }}</p>{% endif %}
- </div>
-</div>
-
-{% if rtl %}
-{{ result_footer_rtl(result) }}
-{% else %}
-{{ result_footer(result) }}
-{% endif %}
+{% from 'oscar/macros.html' import result_header, result_sub_header, result_footer, result_footer_rtl, icon %} + +{{ result_header(result, favicons) }} +{{ result_sub_header(result) }} + +{% if result.embedded %} + <small> • <a class="text-info btn-collapse collapsed cursor-pointer media-loader disabled_if_nojs" data-toggle="collapse" data-target="#result-video-{{ index }}" data-btn-text-collapsed="{{ _('show video') }}" data-btn-text-not-collapsed="{{ _('hide video') }}">{{ icon('film') }} {{ _('show video') }}</a></small> +{% endif %} + +{% if result.embedded %} +<div id="result-video-{{ index }}" class="collapse"> + {{ result.embedded|safe }} +</div> +{% endif %} + +<div class="container-fluid"> + <div class="row"> + <a href="{{ result.url }}" {% if results_on_new_tab %}target="_blank" rel="noopener noreferrer"{% else %}rel="noreferrer"{% endif %}><img class="thumbnail col-xs-6 col-sm-4 col-md-4 result-content" src="{{ image_proxify(result.thumbnail) }}" alt="{{ result.title|striptags }} {{ result.engine }}" /></a> + {% if result.content %}<p class="col-xs-12 col-sm-8 col-md-8 result-content">{{ result.content|safe }}</p>{% endif %} + </div> +</div> + +{% if rtl %} +{{ result_footer_rtl(result) }} +{% else %} +{{ result_footer(result) }} +{% endif %} diff --git a/searx/templates/oscar/results.html b/searx/templates/oscar/results.html index 9a95265b9..9cf942695 100644 --- a/searx/templates/oscar/results.html +++ b/searx/templates/oscar/results.html @@ -1,156 +1,156 @@ -{% extends "oscar/base.html" %}
-{% macro search_form_attrs(pageno) -%}
- {% 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="pageno" value="{{ pageno }}" />
- <input type="hidden" name="time_range" value="{{ time_range }}" />
- <input type="hidden" name="language" value="{{ current_language }}" />
- {% if timeout_limit %}<input type="hidden" name="timeout_limit" value="{{ timeout_limit|e }}" />{% endif %}
-{%- endmacro %}
-{%- macro search_url() %}{{ base_url }}?q={{ q|urlencode }}{% if selected_categories %}&categories={{ selected_categories|join(",") | replace(' ','+') }}{% endif %}{% if pageno > 1 %}&pageno={{ pageno }}{% endif %}{% if time_range %}&time_range={{ time_range }}{% endif %}{% if current_language != 'all' %}&language={{ current_language }}{% endif %}{% endmacro -%}
-
-{% block title %}{{ q|e }} - {% endblock %}
-{% block meta %}<link rel="alternate" type="application/rss+xml" title="Searx search: {{ q|e }}" href="{{ search_url() }}&format=rss">{% endblock %}
-{% block content %}
- {% include 'oscar/search.html' %}
- <div class="row">
- <div class="col-sm-8" id="main_results">
- <h1 class="sr-only">{{ _('Search results') }}</h1>
-
- {% if corrections %}
- <div class="result">
- <span class="result_header text-muted form-inline pull-left suggestion_item">{{ _('Try searching for:') }}</span>
- {% for correction in corrections %}
- <form method="{{ method or 'POST' }}" action="{{ url_for('index') }}" role="navigation" class="form-inline pull-left suggestion_item">
- <input type="hidden" name="q" value="{{ query_prefix + correction }}">
- <button type="submit" class="btn btn-default btn-xs">{{ correction }}</button>
- </form>
- {% endfor %}
- </div>
- {% endif %}
-
- {% if answers %}
- {% for answer in answers %}
- <div class="result well">
- <span>{{ answer }}</span>
- </div>
- {% endfor %}
- {% endif %}
-
- {% for result in results %}
- <div class="result {% if result['template'] %}result-{{ result.template|replace('.html', '') }}{% else %}result-default{% endif %}">
- {% set index = loop.index %}
- {% if result.template %}
- {% include get_result_template('oscar', result['template']) %}
- {% else %}
- {% include 'oscar/result_templates/default.html' %}
- {% endif %}
- </div>
- {% endfor %}
-
- {% if not results and not answers %}
- {% include 'oscar/messages/no_results.html' %}
- {% endif %}
-
- <div class="clearfix"></div>
-
- {% if paging %}
- {% if rtl %}
- <div id="pagination">
- <div class="pull-left">
- <form method="{{ method or 'POST' }}" action="{{ url_for('index') }}" class="pull-left">
- {{ search_form_attrs(pageno+1) }}
- <button type="submit" class="btn btn-default"><span class="glyphicon glyphicon-backward"></span> {{ _('next page') }}</button>
- </form>
- </div>
- <div class="pull-right">
- <form method="{{ method or 'POST' }}" action="{{ url_for('index') }}" class="pull-left">
- {{ 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>
- </form>
- </div>
- </div><!-- /#pagination -->
- <div class="clearfix"></div>
- {% else %}
- <div id="pagination">
- <div class="pull-left">
- <form method="{{ method or 'POST' }}" action="{{ url_for('index') }}" class="pull-left">
- {{ 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>
- </form>
- </div>
- <div class="pull-right">
- <form method="{{ method or 'POST' }}" action="{{ url_for('index') }}" class="pull-left">
- {{ search_form_attrs(pageno+1) }}
- <button type="submit" class="btn btn-default"><span class="glyphicon glyphicon-forward"></span> {{ _('next page') }}</button>
- </form>
- </div>
- </div><!-- /#pagination -->
- <div class="clearfix"></div>
- {% endif %}
- {% endif %}
- </div><!-- /#main_results -->
-
- <div class="col-sm-4" id="sidebar_results">
- {% if number_of_results != '0' %}
- <p><small>{{ _('Number of results') }}: {{ number_of_results }}</small></p>
- {% endif %}
-
- {% if unresponsive_engines and results|length >= 1 %}
- <div class="alert alert-danger fade in" role="alert">
- <p>{{ _('Engines cannot retrieve results') }}:</p>
- {% for engine_name, error_type in unresponsive_engines %}
- {{ engine_name }} ({{ error_type }}){% if not loop.last %}, {% endif %}
- {% endfor %}
- </div>
- {% endif %}
-
- {% if infoboxes %}
- {% for infobox in infoboxes %}
- {% include 'oscar/infobox.html' %}
- {% endfor %}
- {% endif %}
-
- {% if suggestions %}
- <div class="panel panel-default">
- <div class="panel-heading">
- <h4 class="panel-title">{{ _('Suggestions') }}</h4>
- </div>
- <div class="panel-body">
- {% for suggestion in suggestions %}
- <form method="{{ method or 'POST' }}" action="{{ url_for('index') }}" role="navigation" class="form-inline pull-{% if rtl %}right{% else %}left{% endif %} suggestion_item">
- <input type="hidden" name="q" value="{{ suggestion.url }}">
- <button type="submit" class="btn btn-default btn-xs">{{ suggestion.title }}</button>
- </form>
- {% endfor %}
- </div>
- </div>
- {% endif %}
-
- <div class="panel panel-default">
- <div class="panel-heading">
- <h4 class="panel-title">{{ _('Links') }}</h4>
- </div>
- <div class="panel-body">
- <form role="form">
- <div class="form-group">
- <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>
- </div>
- </form>
-
- <label>{{ _('Download results') }}</label>
- <div class="clearfix"></div>
- {% 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">
- {{ search_form_attrs(pageno) }}
- <input type="hidden" name="format" value="{{ output_type }}">
- <button type="submit" class="btn btn-default">{{ output_type }}</button>
- </form>
- {% endfor %}
- <div class="clearfix"></div>
- </div>
- </div>
- </div><!-- /#sidebar_results -->
- </div>
-{% endblock %}
+{% extends "oscar/base.html" %} +{% macro search_form_attrs(pageno) -%} + {%- 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="pageno" value="{{ pageno }}" />{{- "" -}} + <input type="hidden" name="time_range" value="{{ time_range }}" />{{- "" -}} + <input type="hidden" name="language" value="{{ current_language }}" />{{- "" -}} + {% if timeout_limit %}<input type="hidden" name="timeout_limit" value="{{ timeout_limit|e }}" />{% endif -%} +{%- endmacro %} +{%- macro search_url() %}{{ base_url }}?q={{ q|urlencode }}{% if selected_categories %}&categories={{ selected_categories|join(",") | replace(' ','+') }}{% endif %}{% if pageno > 1 %}&pageno={{ pageno }}{% endif %}{% if time_range %}&time_range={{ time_range }}{% endif %}{% if current_language != 'all' %}&language={{ current_language }}{% endif %}{% endmacro -%} + +{% block title %}{{ q|e }} - {% endblock %} +{% block meta %}{{" "}}<link rel="alternate" type="application/rss+xml" title="Searx search: {{ q|e }}" href="{{ search_url() }}&format=rss">{% endblock %} +{% block content %} + {% include 'oscar/search.html' %} + + <div class="row"> + <div class="col-sm-8" id="main_results"> + <h1 class="sr-only">{{ _('Search results') }}</h1> + + {% if corrections -%} + <div class="result"> + <span class="result_header text-muted form-inline pull-left suggestion_item">{{ _('Try searching for:') }}</span> + {% for correction in corrections -%} + <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 }}">{{- "" -}} + <button type="submit" class="btn btn-default btn-xs">{{ correction.title }}</button>{{- "" -}} + </form> + {% endfor %} + </div> + {%- endif %} + + {% if answers -%} + {%- for answer in answers %} + <div class="result well"> + <span>{{ answer }}</span> + </div> + {%- endfor %} + {%- endif %} + + {% for result in results -%} + <div class="result {% if result['template'] %}result-{{ result.template|replace('.html', '') }}{% else %}result-default{% endif %}"> + {%- set index = loop.index -%} + {%- if result.template -%} + {% include get_result_template('oscar', result['template']) %} + {%- else -%} + {% include 'oscar/result_templates/default.html' %} + {%- endif -%} + </div> + {% endfor %} + + {% if not results and not answers -%} + {% include 'oscar/messages/no_results.html' %} + {% endif %} + + <div class="clearfix"></div> + + {% if paging -%} + {% if rtl %} + <div id="pagination"> + <div class="pull-left">{{- "" -}} + <form method="{{ method or 'POST' }}" action="{{ url_for('index') }}" class="pull-left"> + {{- search_form_attrs(pageno+1) -}} + <button type="submit" class="btn btn-default"><span class="glyphicon glyphicon-backward"></span> {{ _('next page') }}</button>{{- "" -}} + </form>{{- "" -}} + </div> + <div class="pull-right">{{- "" -}} + <form method="{{ method or 'POST' }}" action="{{ url_for('index') }}" class="pull-left"> + {{- 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>{{- "" -}} + </form>{{- "" -}} + </div> + </div><!-- /#pagination --> + <div class="clearfix"></div> + {% else %} + <div id="pagination"> + <div class="pull-left">{{- "" -}} + <form method="{{ method or 'POST' }}" action="{{ url_for('index') }}" class="pull-left"> + {{- 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>{{- "" -}} + </form>{{- "" -}} + </div> + <div class="pull-right">{{- "" -}} + <form method="{{ method or 'POST' }}" action="{{ url_for('index') }}" class="pull-left"> + {{- search_form_attrs(pageno+1) -}} + <button type="submit" class="btn btn-default"><span class="glyphicon glyphicon-forward"></span> {{ _('next page') }}</button>{{- "" -}} + </form>{{- "" -}} + </div> + </div><!-- /#pagination --> + <div class="clearfix"></div> + {% endif %} + {% endif %} + </div><!-- /#main_results --> + + <div class="col-sm-4" id="sidebar_results"> + {% if number_of_results != '0' -%} + <p><small>{{ _('Number of results') }}: {{ number_of_results }}</small></p> + {%- endif %} + + {% if unresponsive_engines and results|length >= 1 -%} + <div class="alert alert-danger fade in" role="alert"> + <p>{{ _('Engines cannot retrieve results') }}:</p> + {%- for engine_name, error_type in unresponsive_engines -%} + {{- engine_name }} ({{ error_type }}){% if not loop.last %}, {% endif %}{{- "" -}} + {%- endfor -%} + </div> + {%- endif %} + + {% if infoboxes -%} + {% for infobox in infoboxes %} + {% include 'oscar/infobox.html' %}{{- "\n\n" -}} + {% endfor %} + {%- endif %} + + {% if suggestions %} + <div class="panel panel-default"> + <div class="panel-heading"> + <h4 class="panel-title">{{ _('Suggestions') }}</h4> + </div> + <div class="panel-body"> + {% for suggestion in suggestions %} + <form method="{{ method or 'POST' }}" action="{{ url_for('index') }}" role="navigation" class="form-inline pull-{% if rtl %}right{% else %}left{% endif %} suggestion_item"> + <input type="hidden" name="q" value="{{ suggestion.url }}"> + <button type="submit" class="btn btn-default btn-xs">{{ suggestion.title }}</button> + </form> + {% endfor %} + </div> + </div> + {%- endif %} + + <div class="panel panel-default"> + <div class="panel-heading">{{- "" -}} + <h4 class="panel-title">{{ _('Links') }}</h4>{{- "" -}} + </div> + <div class="panel-body"> + <form role="form">{{- "" -}} + <div class="form-group">{{- "" -}} + <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>{{- "" -}} + </div>{{- "" -}} + </form> + <label>{{ _('Download results') }}</label> + <div class="clearfix"></div> + {% 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"> + {{- search_form_attrs(pageno) -}} + <input type="hidden" name="format" value="{{ output_type }}">{{- "" -}} + <button type="submit" class="btn btn-default">{{ output_type }}</button>{{- "" -}} + </form> + {% endfor %} + <div class="clearfix"></div> + </div> + </div> + </div><!-- /#sidebar_results --> + </div> +{% endblock %} diff --git a/searx/templates/oscar/search.html b/searx/templates/oscar/search.html index 59ee4688d..cad9eca89 100644 --- a/searx/templates/oscar/search.html +++ b/searx/templates/oscar/search.html @@ -1,24 +1,24 @@ -{% from 'oscar/macros.html' import icon %}
-<form method="{{ method or 'POST' }}" action="{{ url_for('index') }}" id="search_form" role="search">
- <div class="row">
- <div class="col-xs-12 col-md-8">
- <div class="input-group search-margin">
- <input type="search" name="q" class="form-control" id="q" placeholder="{{ _('Search for...') }}" autocomplete="off" value="{{ q }}">
- <span class="input-group-btn">
- <button type="submit" class="btn btn-default"><span class="hide_if_nojs">{{ icon('search') }}</span><span class="hidden active_if_nojs">{{ _('Start search') }}</span></button>
- </span>
- </div>
- </div>
- <div class="col-xs-6 col-md-2 search-margin">
- {% include 'oscar/time-range.html' %}
- </div>
- <div class="col-xs-6 col-md-2 search-margin">
- {% include 'oscar/languages.html' %}
- </div>
- </div>
- <div class="row">
- <div class="col-sm-12">
- {% include 'oscar/categories.html' %}
- </div>
- </div>
-</form><!-- / #search_form_full -->
+{% from 'oscar/macros.html' import icon %} +<form method="{{ method or 'POST' }}" action="{{ url_for('index') }}" id="search_form" role="search"> + <div class="row"> + <div class="col-xs-12 col-md-8"> + <div class="input-group search-margin"> + <input type="search" name="q" class="form-control" id="q" placeholder="{{ _('Search for...') }}" aria-label="{{ _('Search for...') }}" autocomplete="off" value="{{ q }}" accesskey="s"> + <span class="input-group-btn"> + <button type="submit" class="btn btn-default" aria-label="{{ _('Start search') }}"><span class="hide_if_nojs">{{ icon('search') }}</span><span class="hidden active_if_nojs">{{ _('Start search') }}</span></button> + </span> + </div> + </div> + <div class="col-xs-6 col-md-2 search-margin"> + {%- include 'oscar/time-range.html' -%} + </div> + <div class="col-xs-6 col-md-2 search-margin"> + {%- include 'oscar/languages.html' -%} + </div> + </div> + <div class="row"> + <div class="col-sm-12"> + {%- include 'oscar/categories.html' -%} + </div> + </div> +</form><!-- / #search_form_full --> diff --git a/searx/templates/oscar/search_full.html b/searx/templates/oscar/search_full.html index 6fdae4028..656463178 100644 --- a/searx/templates/oscar/search_full.html +++ b/searx/templates/oscar/search_full.html @@ -1,18 +1,18 @@ -{% from 'oscar/macros.html' import icon %}
-
-<form method="{{ method or 'POST' }}" action="{{ url_for('index') }}" id="search_form" role="search">
- {% if rtl %}
- <div class="input-group">
- {% else %}
- <div class="input-group col-md-8 col-md-offset-2">
- {% endif %}
- <input type="search" name="q" class="form-control input-lg autofocus" id="q" placeholder="{{ _('Search for...') }}" autocomplete="off" value="{{ q }}">
- <span class="input-group-btn">
- <button type="submit" class="btn btn-default input-lg"><span class="hide_if_nojs">{{ icon('search') }}</span><span class="hidden active_if_nojs">{{ _('Start search') }}</span></button>
- </span>
- </div>
- <div class="col-md-8 col-md-offset-2 advanced">
- {% include 'oscar/advanced.html' %}
- </div>
-
-</form><!-- / #search_form_full -->
+{% from 'oscar/macros.html' import icon %} + +<form method="{{ method or 'POST' }}" action="{{ url_for('index') }}" id="search_form" role="search"> + {% if rtl %} + <div class="input-group"> + {% else %} + <div class="input-group col-md-8 col-md-offset-2"> + {% endif %} + <input type="search" name="q" class="form-control input-lg autofocus" id="q" placeholder="{{ _('Search for...') }}" aria-label="{{ _('Search for...') }}" autocomplete="off" value="{{ q }}" accesskey="s"> + <span class="input-group-btn"> + <button type="submit" class="btn btn-default input-lg" aria-label="{{ _('Start search') }}"><span class="hide_if_nojs">{{ icon('search') }}</span><span class="hidden active_if_nojs">{{ _('Start search') }}</span></button> + </span> + </div> + <div class="col-md-8 col-md-offset-2 advanced"> + {% include 'oscar/advanced.html' %} + </div> + +</form><!-- / #search_form_full --> diff --git a/searx/templates/oscar/time-range.html b/searx/templates/oscar/time-range.html index d5efe9182..fb1c0754b 100644 --- a/searx/templates/oscar/time-range.html +++ b/searx/templates/oscar/time-range.html @@ -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" accesskey="t">{{- "" -}} <option id="time-range-anytime" value="" {{ "selected" if time_range=="" or not time_range else ""}}> - {{ _('Anytime') }} - </option> + {{- _('Anytime') -}} + </option>{{- "" -}} <option id="time-range-day" value="day" {{ "selected" if time_range=="day" else ""}}> - {{ _('Last day') }} - </option> + {{- _('Last day') -}} + </option>{{- "" -}} <option id="time-range-week" value="week" {{ "selected" if time_range=="week" else ""}}> - {{ _('Last week') }} - </option> + {{- _('Last week') -}} + </option>{{- "" -}} <option id="time-range-month" value="month" {{ "selected" if time_range=="month" else ""}}> - {{ _('Last month') }} - </option> + {{- _('Last month') -}} + </option>{{- "" -}} <option id="time-range-year" value="year" {{ "selected" if time_range=="year" else ""}}> - {{ _('Last year') }} - </option> + {{- _('Last year') -}} + </option>{{- "" -}} </select> diff --git a/searx/templates/simple/result_templates/key-value.html b/searx/templates/simple/result_templates/key-value.html new file mode 100644 index 000000000..eebaa2c85 --- /dev/null +++ b/searx/templates/simple/result_templates/key-value.html @@ -0,0 +1,11 @@ +<table> + {% for key, value in result.items() %} + {% if key in ['engine', 'engines', 'template', 'score', 'category', 'positions'] %} + {% continue %} + {% endif %} + <tr> + <td><b>{{ key|upper }}</b>: {{ value }}</td> + </tr> + {% endfor %} +</table> +<div class="engines">{% for engine in result.engines %}<span>{{ engine }}</span>{% endfor %}</div>{{- '' -}} diff --git a/searx/templates/simple/result_templates/torrent.html b/searx/templates/simple/result_templates/torrent.html index 3c7fd15e8..71c775bc9 100644 --- a/searx/templates/simple/result_templates/torrent.html +++ b/searx/templates/simple/result_templates/torrent.html @@ -6,7 +6,7 @@ {% if result.magnetlink %}<p class="altlink"> • {{ result_link(result.magnetlink, icon('magnet') + _('magnet link'), "magnetlink") }}</p>{% endif %} {% if result.torrentfile %}<p class="altlink"> • {{ result_link(result.torrentfile, icon('download-alt') + _('torrent file'), "torrentfile") }}</p>{% endif %} -{% if result.seed %}<p class="stat"> • {{ icon('arrow-swap') }} {{ _('Seeder') }} <span class="badge">{{ result.seed }}</span> • {{ _('Leecher') }} <span class="badge">{{ result.leech }}</span></p>{% endif %} +{% if result.seed is defined %}<p class="stat"> • {{ icon('arrow-swap') }} {{ _('Seeder') }} <span class="badge">{{ result.seed }}</span> • {{ _('Leecher') }} <span class="badge">{{ result.leech }}</span></p>{% endif %} {%- if result.filesize %}<p class="stat">{{ icon('floppy-disk') }} {{ _('Filesize') }}<span class="badge"> {%- if result.filesize < 1024 %}{{ result.filesize }} {{ _('Bytes') }} diff --git a/searx/templates/simple/results.html b/searx/templates/simple/results.html index 770eebe81..8885abc30 100644 --- a/searx/templates/simple/results.html +++ b/searx/templates/simple/results.html @@ -95,13 +95,13 @@ {% for correction in corrections %} <div class="left"> <form method="{{ method or 'POST' }}" action="{{ url_for('index') }}" role="navigation"> - <input type="hidden" name="q" value="{{ correction }}"> + <input type="hidden" name="q" value="{{ correction.url }}"> <input type="hidden" name="time_range" value="{{ time_range }}"> <input type="hidden" name="language" value="{{ current_language }}"> <input type="hidden" name="safesearch" value="{{ safesearch }}"> <input type="hidden" name="theme" value="{{ theme }}"> {% if timeout_limit %}<input type="hidden" name="timeout_limit" value="{{ timeout_limit }}" >{% endif %} - <input type="submit" value="{{ correction }}"> + <input type="submit" value="{{ correction.title }}"> </form> </div> {% endfor %} |