diff options
Diffstat (limited to 'searx/templates')
82 files changed, 814 insertions, 1572 deletions
diff --git a/searx/templates/__common__/about.html b/searx/templates/__common__/about.html index bf17333..649e661 100644 --- a/searx/templates/__common__/about.html +++ b/searx/templates/__common__/about.html @@ -1,63 +1,102 @@ <div{% if rtl %} dir="ltr"{% endif %}> - <h1>About <a href="{{ url_for('index') }}">searx</a></h1> + <h1>About <a href="{{ url_for('index') }}">searx</a></h1> - <p>Searx is a <a href="https://en.wikipedia.org/wiki/Metasearch_engine">metasearch engine</a>, aggregating the results of other <a href="{{ url_for('preferences') }}">search engines</a> while not storing information about its users. - </p> - <h2>Why use searx?</h2> - <ul> - <li>searx may not offer you as personalised results as Google, but it doesn't generate a profile about you</li> - <li>searx doesn't care about what you search for, never shares anything with a third party, and it can't be used to compromise you</li> - <li>searx is free software, the code is 100% open and you can help to make it better. See more on <a href="https://github.com/asciimoo/searx">github</a></li> - </ul> - <p>If you do care about privacy, want to be a conscious user, or otherwise believe - in digital freedom, make searx your default search engine or run it on your own server</p> + <p> + Searx is a <a href="https://en.wikipedia.org/wiki/Metasearch_engine">metasearch engine</a>, + aggregating the results of other <a href="{{ url_for('preferences') }}">search engines</a> + while not storing information about its users. + </p> -<h2>Technical details - How does it work?</h2> + <p>More about searx...</p> -<p>Searx is a <a href="https://en.wikipedia.org/wiki/Metasearch_engine">metasearch engine</a>, -inspired by the <a href="https://beniz.github.io/seeks/">seeks project</a>.<br /> -It provides basic privacy by mixing your queries with searches on other platforms without storing search data. Queries are made using a POST request on every browser (except chrome*). Therefore they show up in neither our logs, nor your url history. In case of Chrome* users there is an exception, searx uses the search bar to perform GET requests.<br /> -Searx can be added to your browser's search bar; moreover, it can be set as the default search engine. -</p> - -<h2>How can I make it my own?</h2> - -<p>Searx appreciates your concern regarding logs, so take the <a href="https://github.com/asciimoo/searx">code</a> and run it yourself! <br />Add your Searx to this <a href="https://github.com/asciimoo/searx/wiki/Searx-instances">list</a> to help other people reclaim their privacy and make the Internet freer! -<br />The more decentralized the Internet is, the more freedom we have!</p> - - -<h2>More about searx</h2> - -<ul> - <li><a href="https://github.com/asciimoo/searx">github</a></li> - <li><a href="https://www.ohloh.net/p/searx/">ohloh</a></li> + <ul> + <li><a href="https://github.com/searx/searx">github</a></li> <li><a href="https://twitter.com/Searx_engine">twitter</a></li> <li>IRC: #searx @ freenode (<a href="https://kiwiirc.com/client/irc.freenode.com/searx">webclient</a>)</li> <li><a href="https://www.transifex.com/projects/p/searx/">transifex</a></li> -</ul> - - -<hr /> - -<h2 id="faq">FAQ</h2> - -<h3>How to add to firefox?</h3> -<p><a href="#" onclick="window.external.AddSearchProvider(window.location.protocol + '//' + window.location.host + '{{ url_for('opensearch') }}');">Install</a> searx as a search engine on any version of Firefox! (javascript required)</p> - -<h2 id="dev_faq">Developer FAQ</h2> - -<h3>New engines?</h3> -<ul> - <li>Edit your <a href="https://raw.github.com/asciimoo/searx/master/searx/settings.yml">settings.yml</a></li> - <li>Create your custom engine module, check the <a href="https://github.com/asciimoo/searx/blob/master/examples/basic_engine.py">example engine</a></li> -</ul> -<p>Don't forget to restart searx after config edit!</p> - -<h3>Installation/WSGI support?</h3> -<p>See the <a href="https://github.com/asciimoo/searx/wiki/Installation">installation and setup</a> wiki page</p> - -<h3>How to debug engines?</h3> -<p><a href="{{ url_for('stats') }}">Stats page</a> contains some useful data about the engines used.</p> + </ul> + + <hr /> + + <h2>Why use searx?</h2> + + <ul> + <li> + Searx may not offer you as personalised results as Google, but it doesn't + generate a profile about you. + </li> + <li> + Searx doesn't care about what you search for, never shares anything with a + third party, and it can't be used to compromise you. + </li> + <li> + Searx is free software, the code is 100% open and you can help to make it + better. See more on <a href="https://github.com/searx/searx">github</a>. + </li> + </ul> + + <p> + If you do care about privacy, want to be a conscious user, or otherwise + believe in digital freedom, make searx your default search engine or run it + on your own server + </p> + + <h2>Technical details - How does it work?</h2> + + <p> + Searx is a <a href="https://en.wikipedia.org/wiki/Metasearch_engine">metasearch engine</a>, + inspired by the <a href="https://beniz.github.io/seeks/">seeks project</a>. + + It provides basic privacy by mixing your queries with searches on other + platforms without storing search data. Queries are made using a POST request + on every browser (except Chromium-based browsers*). Therefore they show up + in neither our logs, nor your url history. In the case of Chromium-based + browser users there is an exception: searx uses the search bar to perform GET + requests. + + Searx can be added to your browser's search bar; moreover, it can be set as + the default search engine. + </p> + + <h2 id='add to browser'>How to set as the default search engine?</h2> + + <p> + Searx supports <a href="https://github.com/dewitt/opensearch/blob/master/opensearch-1-1-draft-6.md">OpenSearch</a>. + For more information on changing your default search engine, see your browser's documentation: + </p> + + <ul> + <li><a href="https://support.mozilla.org/en-US/kb/add-or-remove-search-engine-firefox">Firefox</a></li> + <li><a href="https://support.microsoft.com/en-us/help/4028574/microsoft-edge-change-the-default-search-engine">Microsoft Edge</a></li> + <li>Chromium-based browsers <a href="https://www.chromium.org/tab-to-search">only add websites that the user navigates to without a path.</a> + </ul> + + <h2>Where to find anonymous usage statistics of this instance ?</h2> + + <p> + <a href="{{ url_for('stats') }}">Stats page</a> contains some useful data about the engines used. + </p> + + <h2>How can I make it my own?</h2> + + <p> + Searx appreciates your concern regarding logs, so take the + code from the <a href="https://github.com/searx/searx">original searx project</a> and + run it yourself! + </p> + <p> + Add your searx instance to this <a href="{{ brand.PUBLIC_INSTANCES }}"> list + of public searx instances</a> to help other people reclaim their privacy and + make the Internet freer! The more decentralized the Internet is, the more + freedom we have! + </p> + + <h2>Where are the docs & code of this instance?</h2> + + <p> + See the <a href="{{ brand.DOCS_URL }}">{{ brand.DOCS_URL }}</a> + and <a href="{{ brand.GIT_URL }}">{{ brand.GIT_URL }}</a> + </p> </div> {% include "__common__/aboutextend.html" ignore missing %} diff --git a/searx/templates/__common__/opensearch.xml b/searx/templates/__common__/opensearch.xml index 15d3eb7..230f327 100644 --- a/searx/templates/__common__/opensearch.xml +++ b/searx/templates/__common__/opensearch.xml @@ -3,26 +3,20 @@ <ShortName>{{ instance_name }}</ShortName> <Description>a privacy-respecting, hackable metasearch engine</Description> <InputEncoding>UTF-8</InputEncoding> - <Image>{{ urljoin(host, url_for('static', filename='img/favicon.png')) }}</Image> + <Image>{{ url_for('static', filename='img/favicon.png', _external=True) }}</Image> <LongName>searx metasearch</LongName> {% if opensearch_method == 'get' %} - <Url type="text/html" method="get" template="{{ host }}search?q={searchTerms}"/> - {% if autocomplete %} - <Url type="application/x-suggestions+json" method="get" template="{{ host }}autocompleter"> - <Param name="format" value="x-suggestions" /> - <Param name="q" value="{searchTerms}" /> - </Url> - {% endif %} + <Url rel="results" type="text/html" method="get" template="{{ url_for('search', _external=True) }}?q={searchTerms}"/> {% else %} - <Url type="text/html" method="post" template="{{ host }}"> + <Url rel="results" type="text/html" method="post" template="{{ url_for('search', _external=True) }}"> <Param name="q" value="{searchTerms}" /> </Url> - {% if autocomplete %} - <!-- TODO, POST REQUEST doesn't work --> - <Url type="application/x-suggestions+json" method="get" template="{{ host }}autocompleter"> - <Param name="format" value="x-suggestions" /> - <Param name="q" value="{searchTerms}" /> - </Url> - {% endif %} {% endif %} + {% if autocomplete %} + <Url rel="suggestions" type="application/x-suggestions+json" template="{{ url_for('autocompleter', _external=True) }}?q={searchTerms}"/> + {% endif %} + + <Url type="application/opensearchdescription+xml" + rel="self" + template="{{ opensearch_url }}" /> </OpenSearchDescription> diff --git a/searx/templates/__common__/opensearch_response_rss.xml b/searx/templates/__common__/opensearch_response_rss.xml index 32c42e7..82d3f7c 100644 --- a/searx/templates/__common__/opensearch_response_rss.xml +++ b/searx/templates/__common__/opensearch_response_rss.xml @@ -4,12 +4,12 @@ xmlns:atom="http://www.w3.org/2005/Atom"> <channel> <title>Searx search: {{ q|e }}</title> - <link>{{ base_url }}?q={{ q|e }}</link> + <link>{{ url_for('search', _external=True) }}?q={{ q|e }}</link> <description>Search results for "{{ q|e }}" - searx</description> <opensearch:totalResults>{{ number_of_results }}</opensearch:totalResults> <opensearch:startIndex>1</opensearch:startIndex> <opensearch:itemsPerPage>{{ number_of_results }}</opensearch:itemsPerPage> - <atom:link rel="search" type="application/opensearchdescription+xml" href="{{ base_url }}opensearch.xml"/> + <atom:link rel="search" type="application/opensearchdescription+xml" href="{{ opensearch_url }}"/> <opensearch:Query role="request" searchTerms="{{ q|e }}" startPage="1" /> {% if error_message %} <item> @@ -25,5 +25,29 @@ {% if r.pubdate %}<pubDate>{{ r.pubdate }}</pubDate>{% endif %} </item> {% endfor %} + {% if answers %} + {% for a in answers %} + <item> + <title>{{ a }}</title> + <type>answer</type> + </item> + {% endfor %} + {% endif %} + {% if corrections %} + {% for a in corrections %} + <item> + <title>{{ a }}</title> + <type>correction</type> + </item> + {% endfor %} + {% endif %} + {% if suggestions %} + {% for a in suggestions %} + <item> + <title>{{ a }}</title> + <type>suggestion</type> + </item> + {% endfor %} + {% endif %} </channel> </rss> diff --git a/searx/templates/courgette/404.html b/searx/templates/courgette/404.html deleted file mode 100644 index 9e3b8ac..0000000 --- a/searx/templates/courgette/404.html +++ /dev/null @@ -1,9 +0,0 @@ -{% extends "courgette/base.html" %} -{% block content %} -<div class="center"> - <h1>{{ _('Page not found') }}</h1> - {% autoescape false %} - <p>{{ _('Go to %(search_page)s.', search_page=unicode('<a href="{}">{}</a>').format(url_for('index'), _('search page'))) }}</p> - {% endautoescape %} -</div> -{% endblock %} diff --git a/searx/templates/courgette/about.html b/searx/templates/courgette/about.html deleted file mode 100644 index 08948ee..0000000 --- a/searx/templates/courgette/about.html +++ /dev/null @@ -1,5 +0,0 @@ -{% extends 'courgette/base.html' %} -{% block content %} -{% include 'courgette/github_ribbon.html' %} -{% include '__common__/about.html' %} -{% endblock %} diff --git a/searx/templates/courgette/base.html b/searx/templates/courgette/base.html deleted file mode 100644 index 8e27258..0000000 --- a/searx/templates/courgette/base.html +++ /dev/null @@ -1,43 +0,0 @@ -<!DOCTYPE html> -<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en"{% if rtl %} dir="rtl"{% endif %}> - <head> - <meta charset="UTF-8" /> - <meta name="description" content="searx - a privacy-respecting, hackable metasearch engine" /> - <meta name="keywords" content="searx, search, search engine, metasearch, meta search" /> - <meta name="generator" content="searx/{{ searx_version }}"> - <meta name="referrer" content="no-referrer"> - <meta name="viewport" content="width=device-width, maximum-scale=1.0, user-scalable=1" /> - <title>{% block title %}{% endblock %}searx</title> - <link rel="stylesheet" href="{{ url_for('static', filename='css/style.css') }}" type="text/css" media="screen" /> - {% if rtl %} - <link rel="stylesheet" href="{{ url_for('static', filename='css/style-rtl.css') }}" type="text/css" media="screen" /> - {% endif %} - {% if cookies['courgette-color'] %} - <style type="text/css"> - {% include 'courgette/color.css' %} - </style> - {% endif %} - <link rel="shortcut icon" href="{{ url_for('static', filename='img/favicon.png') }}?v=2" /> - {% block styles %} - {% endblock %} - {% block meta %}{% endblock %} - {% block head %} - <link title="{{ instance_name }}" type="application/opensearchdescription+xml" rel="search" href="{{ url_for('opensearch') }}"/> - {% endblock %} - <script type="text/javascript"> - searx = {}; - searx.autocompleter = {% if autocomplete %}true{% else %}false{% endif %}; - </script> - </head> - <body> - <div id="container"> - {% block content %} - {% endblock %} - {% if autocomplete %} - <script src="{{ url_for('static', filename='js/mootools-core-1.4.5-min.js') }}" ></script> - <script src="{{ url_for('static', filename='js/mootools-autocompleter-1.1.2-min.js') }}" ></script> - {% endif %} - <script src="{{ url_for('static', filename='js/searx.js') }}" ></script> - </div> - </body> -</html> diff --git a/searx/templates/courgette/categories.html b/searx/templates/courgette/categories.html deleted file mode 100644 index b8d6a75..0000000 --- a/searx/templates/courgette/categories.html +++ /dev/null @@ -1,9 +0,0 @@ -<div id="categories"> - <div id="categories_container"> - {% for category in categories %} - <div class="checkbox_container"> - <input type="checkbox" id="checkbox_{{ category|replace(' ', '_') }}" name="category_{{ category }}" {% if category in selected_categories %}checked="checked"{% endif %} /><label for="checkbox_{{ category|replace(' ', '_') }}">{{ _(category) }}</label> - </div> - {% endfor %} - </div> -</div>
\ No newline at end of file diff --git a/searx/templates/courgette/color.css b/searx/templates/courgette/color.css deleted file mode 100644 index 3e0d730..0000000 --- a/searx/templates/courgette/color.css +++ /dev/null @@ -1,34 +0,0 @@ - .autocompleter-choices li:hover, -.checkbox_container label:hover, -.checkbox_container input[type="checkbox"]:checked + label, -#sidebar, -#suggestions input[type="submit"]:hover, -#suggestions input[type="submit"]:focus, -input[type="submit"], -.engine_checkbox label, -.engine_checkbox .deny, -#search_submit{ - background-color: {{ cookies['courgette-color'].split()[0] }}; -} - -.result_title a, -.row a, -.title h1{ - color: {{ cookies['courgette-color'].split()[0] }}; -} - -#answers { - border-color: {{ cookies['courgette-color'].split()[0] }}; -} - -#search_submit:hover, -#search_submit:focus, -#sidebar input[type="submit"]:hover, -#sidebar input[type="submit"]:focus { - background-color: {{ cookies['courgette-color'].split()[1] }}; -} - -input[type="submit"]:hover, -input[type="submit"]:focus { - background: {{ cookies['courgette-color'].split()[1] }}; -}
\ No newline at end of file diff --git a/searx/templates/courgette/github_ribbon.html b/searx/templates/courgette/github_ribbon.html deleted file mode 100644 index 67c6e67..0000000 --- a/searx/templates/courgette/github_ribbon.html +++ /dev/null @@ -1,3 +0,0 @@ -<a href="https://github.com/asciimoo/searx" class="github"> - <img style="position: absolute; top: 0; right: 0; border: 0;" src="{{ url_for('static', filename='img/github_ribbon.png') }}" alt="Fork me on GitHub" class="github"/> -</a>
\ No newline at end of file diff --git a/searx/templates/courgette/index.html b/searx/templates/courgette/index.html deleted file mode 100644 index 0d34e1c..0000000 --- a/searx/templates/courgette/index.html +++ /dev/null @@ -1,17 +0,0 @@ -{% extends "courgette/base.html" %} -{% block content %} -{% include 'courgette/github_ribbon.html' %} -<div class="center"> - <div class="title"><h1>searx</h1></div> - {% include 'courgette/search.html' %} - <p class="top_margin"> - {% if rtl %} - <a href="{{ url_for('preferences') }}" class="hmarg">{{ _('preferences') }}</a> - {% endif %} - <a href="{{ url_for('about') }}" class="hmarg">{{ _('about') }}</a> - {% if not rtl %} - <a href="{{ url_for('preferences') }}" class="hmarg">{{ _('preferences') }}</a> - {% endif %} - </p> -</div> -{% endblock %}
\ No newline at end of file diff --git a/searx/templates/courgette/preferences.html b/searx/templates/courgette/preferences.html deleted file mode 100644 index 56a6e02..0000000 --- a/searx/templates/courgette/preferences.html +++ /dev/null @@ -1,132 +0,0 @@ -{% extends "courgette/base.html" %} -{% block head %} {% endblock %} -{% block content %} -<div class="row"> - <h2>{{ _('Preferences') }}</h2> - - <form method="post" action="{{ url_for('preferences') }}" id="search_form"> - <fieldset> - <legend>{{ _('Default categories') }}</legend> - {% include 'courgette/categories.html' %} - </fieldset> - <fieldset> - <legend>{{ _('Search language') }}</legend> - <p> - <select name='language'> - <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> - </p> - </fieldset> - <fieldset> - <legend>{{ _('Interface language') }}</legend> - <p> - <select name='locale'> - {% for locale_id,locale_name in locales.items() | sort %} - <option value="{{ locale_id }}" {% if locale_id == current_locale %}selected="selected"{% endif %}>{{ locale_name }}</option> - {% endfor %} - </select> - </p> - </fieldset> - <fieldset> - <legend>{{ _('Autocomplete') }}</legend> - <p> - <select name="autocomplete"> - <option value=""> - </option> - {% for backend in autocomplete_backends %} - <option value="{{ backend }}" {% if backend == autocomplete %}selected="selected"{% endif %}>{{ backend }}</option> - {% endfor %} - </select> - </p> - </fieldset> - <fieldset> - <legend>{{ _('Image proxy') }}</legend> - <p> - <select name='image_proxy'> - <option value="1" {% if image_proxy %}selected="selected"{% endif %}>{{ _('Enabled') }}</option> - <option value="" {% if not image_proxy %}selected="selected"{% endif %}>{{ _('Disabled') }}</option> - </select> - </p> - </fieldset> - <fieldset> - <legend>{{ _('Method') }}</legend> - <p> - <select name='method'> - <option value="POST" {% if method == 'POST' %}selected="selected"{% endif %}>POST</option> - <option value="GET" {% if method == 'GET' %}selected="selected"{% endif %}>GET</option> - </select> - </p> - </fieldset> - <fieldset> - <legend>{{ _('SafeSearch') }}</legend> - <p> - <select name='safesearch'> - <option value="2" {% if safesearch == '2' %}selected="selected"{% endif %}>{{ _('Strict') }}</option> - <option value="1" {% if safesearch == '1' %}selected="selected"{% endif %}>{{ _('Moderate') }}</option> - <option value="0" {% if safesearch == '0' %}selected="selected"{% endif %}>{{ _('None') }}</option> - </select> - </p> - </fieldset> - <fieldset> - <legend>{{ _('Themes') }}</legend> - <p> - <select name="theme"> - {% for name in themes %} - <option value="{{ name }}" {% if name == theme %}selected="selected"{% endif %}>{{ name }}</option> - {% endfor %} - </select> - </p> - </fieldset> - <fieldset> - <legend>{{ _('Color') }}</legend> - <p> - <select name="courgette-color"> - <option value="#3498DB #0665A2" {% if cookies['courgette-color'] and cookies['courgette-color'] == '#3498DB #0665A2' %}selected="selected"{% endif %}>{{ _('Blue (default)') }}</option> - <option value="#6F5499 #563D7C" {% if cookies['courgette-color'] and cookies['courgette-color'] == '#6F5499 #563D7C' %}selected="selected"{% endif %}>{{ _('Violet') }}</option> - <option value="#5CB85C #449D44" {% if cookies['courgette-color'] and cookies['courgette-color'] == '#5CB85C #449D44' %}selected="selected"{% endif %}>{{ _('Green') }}</option> - <option value="#5BC0DE #31B0D5" {% if cookies['courgette-color'] and cookies['courgette-color'] == '#5BC0DE #31B0D5' %}selected="selected"{% endif %}>{{ _('Cyan') }}</option> - <option value="#F0AD4E #EC971F" {% if cookies['courgette-color'] and cookies['courgette-color'] == '#F0AD4E #EC971F' %}selected="selected"{% endif %}>{{ _('Orange') }}</option> - <option value="#D9534F #C9302C" {% if cookies['courgette-color'] and cookies['courgette-color'] == '#D9534F #C9302C' %}selected="selected"{% endif %}>{{ _('Red') }}</option> - </select> - </p> - </fieldset> - <fieldset> - <legend>{{ _('Currently used search engines') }}</legend> - - <table class="engine-table"> - <tr> - <th>{{ _('Engine name') }}</th> - <th>{{ _('Category') }}</th> - <th>{{ _('Allow') }} / {{ _('Block') }}</th> - </tr> - {% for categ in all_categories %} - {% for search_engine in engines_by_category[categ] %} - - {% if not search_engine.private %} - <tr> - <td>{{ search_engine.name }} ({{ shortcuts[search_engine.name] }})‎</td> - <td>{{ _(categ) }}</td> - <td class="engine_checkbox"> - <input type="checkbox" id="engine_{{ categ|replace(' ', '_') }}_{{ search_engine.name|replace(' ', '_') }}" name="engine_{{ search_engine.name }}__{{ categ }}"{% if (search_engine.name, categ) in disabled_engines %} checked="checked"{% endif %} /> - <label class="allow" for="engine_{{ categ|replace(' ', '_') }}_{{ search_engine.name|replace(' ', '_') }}">{{ _('Allow') }}</label> - <label class="deny" for="engine_{{ categ|replace(' ', '_') }}_{{ search_engine.name|replace(' ', '_') }}">{{ _('Block') }}</label> - </td> - </tr> - {% endif %} - {% endfor %} - {% endfor %} - </table> - </fieldset> - <p class="small_font">{{ _('These settings are stored in your cookies, this allows us not to store this data about you.') }} - <br /> - {{ _("These cookies serve your sole convenience, we don't use these cookies to track you.") }} - </p> - - <input type="submit" value="{{ _('save') }}" /> - <div class="right preferences_back"><a href="{{ url_for('clear_cookies') }}">{{ _('Reset defaults') }}</a></div> - <div class="right preferences_back"><a href="{{ url_for('index') }}">{{ _('back') }}</a></div> - </form> -</div> -{% endblock %} diff --git a/searx/templates/courgette/result_templates/code.html b/searx/templates/courgette/result_templates/code.html deleted file mode 100644 index d6dbd5e..0000000 --- a/searx/templates/courgette/result_templates/code.html +++ /dev/null @@ -1,11 +0,0 @@ -<div class="result {{ result.class }}"> - <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.publishedDate %}<span class="published_date">{{ result.publishedDate }}</span>{% endif %} - <p class="content">{% if result.img_src %}<img src="{{ image_proxify(result.img_src) }}" class="image" />{% endif %}{% if result.content %}{{ result.content|safe }}<br class="last"/>{% endif %}</p> - {% if result.repository %}<p class="content"><a href="{{ result.repository|safe }}" {% 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> - - <p class="url">{{ result.pretty_url }}‎</p> -</div> diff --git a/searx/templates/courgette/result_templates/default.html b/searx/templates/courgette/result_templates/default.html deleted file mode 100644 index 5f2ead6..0000000 --- a/searx/templates/courgette/result_templates/default.html +++ /dev/null @@ -1,13 +0,0 @@ -<div class="result {{ result.class }}"> - - {% if "icon_"~result.engine~".ico" in favicons %} - <img width="14" height="14" class="favicon" src="{{ url_for('static', filename='img/icons/icon_'+result.engine+'.ico') }}" alt="{{result.engine}}" /> - {% endif %} - - <div> - <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.publishedDate %}<span class="published_date">{{ result.publishedDate }}</span>{% endif %} - <p class="content">{% if result.content %}{{ result.content|safe }}<br />{% endif %}</p> - <p class="url">{{ result.pretty_url }}‎</p> - </div> -</div> diff --git a/searx/templates/courgette/result_templates/images.html b/searx/templates/courgette/result_templates/images.html deleted file mode 100644 index 49acb3b..0000000 --- a/searx/templates/courgette/result_templates/images.html +++ /dev/null @@ -1,6 +0,0 @@ -<div class="image_result"> - <p> - <a href="{{ result.img_src }}" {% if results_on_new_tab %}target="_blank" rel="noopener noreferrer"{% else %}rel="noreferrer"{% endif %}><img src="{% if result.thumbnail_src %}{{ image_proxify(result.thumbnail_src) }}{% else %}{{ image_proxify(result.img_src) }}{% endif %}" title="{{ result.title|striptags }}" alt="{{ result.title|striptags }}"/></a> - <span class="url"><a href="{{ result.url }}" {% if results_on_new_tab %}target="_blank" rel="noopener noreferrer"{% else %}rel="noreferrer"{% endif %} class="small_font">{{ _('original context') }}</a></span> - </p> -</div> diff --git a/searx/templates/courgette/result_templates/key-value.html b/searx/templates/courgette/result_templates/key-value.html deleted file mode 100644 index 789e8de..0000000 --- a/searx/templates/courgette/result_templates/key-value.html +++ /dev/null @@ -1,13 +0,0 @@ -<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/map.html b/searx/templates/courgette/result_templates/map.html deleted file mode 100644 index 5f2ead6..0000000 --- a/searx/templates/courgette/result_templates/map.html +++ /dev/null @@ -1,13 +0,0 @@ -<div class="result {{ result.class }}"> - - {% if "icon_"~result.engine~".ico" in favicons %} - <img width="14" height="14" class="favicon" src="{{ url_for('static', filename='img/icons/icon_'+result.engine+'.ico') }}" alt="{{result.engine}}" /> - {% endif %} - - <div> - <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.publishedDate %}<span class="published_date">{{ result.publishedDate }}</span>{% endif %} - <p class="content">{% if result.content %}{{ result.content|safe }}<br />{% endif %}</p> - <p class="url">{{ result.pretty_url }}‎</p> - </div> -</div> diff --git a/searx/templates/courgette/result_templates/torrent.html b/searx/templates/courgette/result_templates/torrent.html deleted file mode 100644 index 7f94a22..0000000 --- a/searx/templates/courgette/result_templates/torrent.html +++ /dev/null @@ -1,13 +0,0 @@ -<div class="result torrent_result"> - {% if "icon_"~result.engine~".ico" in favicons %} - <img width="14" height="14" class="favicon" src="{{ url_for('static', filename='img/icons/icon_'+result.engine+'.ico') }}" alt="{{result.engine}}" /> - {% 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 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 %} - </span> - <p class="url">{{ result.pretty_url }}‎</p> -</div> diff --git a/searx/templates/courgette/result_templates/videos.html b/searx/templates/courgette/result_templates/videos.html deleted file mode 100644 index b3e19e0..0000000 --- a/searx/templates/courgette/result_templates/videos.html +++ /dev/null @@ -1,10 +0,0 @@ -<div class="result"> - {% if "icon_"~result.engine~".ico" in favicons %} - <img width="14" height="14" class="favicon" src="{{ url_for('static', filename='img/icons/icon_'+result.engine+'.ico') }}" alt="{{result.engine}}" /> - {% 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.publishedDate %}<span class="published_date">{{ result.publishedDate }}</span><br />{% endif %} - <a href="{{ result.url }}" {% if results_on_new_tab %}target="_blank" rel="noopener noreferrer"{% else %}rel="noreferrer"{% endif %}><img width="400" src="{{ image_proxify(result.thumbnail) }}" title="{{ result.title|striptags }}" alt="{{ result.title|striptags }}"/></a> - <p class="url">{{ result.pretty_url }}‎</p> -</div> diff --git a/searx/templates/courgette/results.html b/searx/templates/courgette/results.html deleted file mode 100644 index aa983e6..0000000 --- a/searx/templates/courgette/results.html +++ /dev/null @@ -1,87 +0,0 @@ -{% extends "courgette/base.html" %} -{% block title %}{{ q|e }} - {% endblock %} -{% block meta %}<link rel="alternate" type="application/rss+xml" title="Searx search: {{ q|e }}" href="{{ url_for('index') }}?q={{ q|urlencode }}&format=rss&{% for category in selected_categories %}category_{{ category }}=1&{% endfor %}pageno={{ pageno }}">{% endblock %} -{% block content %} -<div class="right"><a href="{{ url_for('preferences') }}" id="preferences"><span>{{ _('preferences') }}</span></a></div> -<div class="small search center"> - {% include 'courgette/search.html' %} -</div> -<div id="results"> - <div id="sidebar"> - <div id="search_url"> - {{ _('Search URL') }}: - <input type="text" value="{{ base_url }}?q={{ q|urlencode }}{% if selected_categories %}&categories={{ selected_categories|join(",") | replace(' ','+') }}{% endif %}{% if pageno > 1 %}&pageno={{ pageno }}{% endif %}" readonly /> - </div> - <div id="apis"> - {{ _('Download results') }}<br /> - {% for output_type in ('csv', 'json', 'rss') %} - <form method="{{ method or 'POST' }}" action="{{ url_for('index') }}"> - <div class="left"> - <input type="hidden" name="q" value="{{ q|e }}" /> - <input type="hidden" name="format" value="{{ output_type }}" /> - {% for category in selected_categories %} - <input type="hidden" name="category_{{ category }}" value="1"/> - {% endfor %} - <input type="hidden" name="pageno" value="{{ pageno }}" /> - <input type="submit" value="{{ output_type }}" /> - </div> - </form> - {% endfor %} - </div> - </div> - - {% if answers %} - <div id="answers" class=""><span>{{ _('Answers') }}</span> - {% for answer in answers %} - <span>{{ answer }}</span> - {% endfor %} - </div> - {% endif %} - - {% if suggestions %} - <div id="suggestions"><span>{{ _('Suggestions') }}</span> - {% for suggestion in suggestions %} - <form method="{{ method or 'POST' }}" action="{{ url_for('index') }}"> - <input type="hidden" name="q" value="{{ suggestion.url }}"> - <input type="submit" value="{{ suggestion.title }}" /> - </form> - {% endfor %} - </div> - {% endif %} - - {% for result in results %} - {% if result['template'] %} - {% include get_result_template('courgette', result['template']) %} - {% else %} - {% include 'courgette/result_templates/default.html' %} - {% endif %} - {% endfor %} - - {% if paging %} - <div id="pagination"> - {% if pageno > 1 %} - <form method="{{ method or 'POST' }}" action="{{ url_for('index') }}"> - <div class="left"> - <input type="hidden" name="q" value="{{ q|e }}" /> - {% for category in selected_categories %} - <input type="hidden" name="category_{{ category }}" value="1"/> - {% endfor %} - <input type="hidden" name="pageno" value="{{ pageno-1 }}" /> - <input type="submit" value="<< {{ _('previous page') }}" /> - </div> - </form> - {% endif %} - <form method="{{ method or 'POST' }}" action="{{ url_for('index') }}"> - <div class="left"> - {% 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+1 }}" /> - <input type="submit" value="{{ _('next page') }} >>" /> - </div> - </form> - </div> - {% endif %} -</div> -{% endblock %} diff --git a/searx/templates/courgette/search.html b/searx/templates/courgette/search.html deleted file mode 100644 index bd4efd4..0000000 --- a/searx/templates/courgette/search.html +++ /dev/null @@ -1,7 +0,0 @@ -<form method="{{ method or 'POST' }}" action="{{ url_for('index') }}" id="search_form"> - <div id="search_wrapper"> - <input type="text" placeholder="{{ _('Search for...') }}" id="q" class="q" name="q" tabindex="1" autocomplete="off" {% if q %}value="{{ q }}"{% endif %}/> - <input type="submit" value="search" id="search_submit" /> - </div> - {% include 'courgette/categories.html' %} -</form>
\ No newline at end of file diff --git a/searx/templates/courgette/stats.html b/searx/templates/courgette/stats.html deleted file mode 100644 index b9aafbb..0000000 --- a/searx/templates/courgette/stats.html +++ /dev/null @@ -1,22 +0,0 @@ -{% extends "courgette/base.html" %} -{% block head %} {% endblock %} -{% block content %} -<h2>{{ _('Engine stats') }}</h2> - -{% for stat_name,stat_category in stats %} -<div class="left"> - <table> - <tr> - <th colspan="3">{{ stat_name }}</th> - </tr> - {% for engine in stat_category %} - <tr> - <td>{{ engine.name }}</td> - <td>{{ '%.02f'|format(engine.avg) }}</td> - <td class="percentage"><div style="width: {{ engine.percentage }}%"> </div></td> - </tr> - {% endfor %} - </table> -</div> -{% endfor %} -{% endblock %}
\ No newline at end of file diff --git a/searx/templates/legacy/404.html b/searx/templates/legacy/404.html deleted file mode 100644 index 3e889dd..0000000 --- a/searx/templates/legacy/404.html +++ /dev/null @@ -1,9 +0,0 @@ -{% extends "legacy/base.html" %} -{% block content %} -<div class="center"> - <h1>{{ _('Page not found') }}</h1> - {% autoescape false %} - <p>{{ _('Go to %(search_page)s.', search_page=unicode('<a href="{}">{}</a>').format(url_for('index'), _('search page'))) }}</p> - {% endautoescape %} -</div> -{% endblock %} diff --git a/searx/templates/legacy/about.html b/searx/templates/legacy/about.html deleted file mode 100644 index f773e3a..0000000 --- a/searx/templates/legacy/about.html +++ /dev/null @@ -1,5 +0,0 @@ -{% extends 'legacy/base.html' %} -{% block content %} -{% include 'legacy/github_ribbon.html' %} -{% include '__common__/about.html' %} -{% endblock %} diff --git a/searx/templates/legacy/base.html b/searx/templates/legacy/base.html deleted file mode 100644 index da19741..0000000 --- a/searx/templates/legacy/base.html +++ /dev/null @@ -1,38 +0,0 @@ -<!DOCTYPE html> -<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en"{% if rtl %} dir="rtl"{% endif %}> - <head> - <meta charset="UTF-8" /> - <meta name="description" content="searx - a privacy-respecting, hackable metasearch engine" /> - <meta name="keywords" content="searx, search, search engine, metasearch, meta search" /> - <meta name="generator" content="searx/{{ searx_version }}"> - <meta name="referrer" content="no-referrer"> - <meta name="viewport" content="width=device-width, maximum-scale=1.0, user-scalable=1" /> - <title>{% block title %}{% endblock %}searx</title> - <link rel="stylesheet" href="{{ url_for('static', filename='css/style.css') }}" type="text/css" media="screen" /> - {% if rtl %} - <link rel="stylesheet" href="{{ url_for('static', filename='css/style-rtl.css') }}" type="text/css" media="screen" /> - {% endif %} - <link rel="shortcut icon" href="{{ url_for('static', filename='img/favicon.png') }}?v=2" /> - {% block styles %} - {% endblock %} - {% block meta %}{% endblock %} - {% block head %} - <link title="{{ instance_name }}" type="application/opensearchdescription+xml" rel="search" href="{{ url_for('opensearch') }}"/> - {% endblock %} - </head> - <body> - <div id="container"> - {% block content %} - {% endblock %} - {% if autocomplete %} - <script src="{{ url_for('static', filename='js/mootools-core-1.4.5-min.js') }}" ></script> - <script src="{{ url_for('static', filename='js/mootools-autocompleter-1.1.2-min.js') }}" ></script> - {% endif %} - <script type="text/javascript"> - searx = {}; - searx.autocompleter = {% if autocomplete %}true{% else %}false{% endif %}; - </script> - <script src="{{ url_for('static', filename='js/searx.js') }}" ></script> - </div> - </body> -</html> diff --git a/searx/templates/legacy/categories.html b/searx/templates/legacy/categories.html deleted file mode 100644 index 1c46678..0000000 --- a/searx/templates/legacy/categories.html +++ /dev/null @@ -1,10 +0,0 @@ -<div id="categories"> - <div id="categories_container"> - {% for category in categories %} - <div class="checkbox_container"> - <input type="checkbox" id="checkbox_{{ category|replace(' ', '_') }}" name="category_{{ category }}" {% if category in selected_categories %}checked="checked"{% endif %} /><label for="checkbox_{{ category|replace(' ', '_') }}" class="tooltips">{{ _(category) }}</label> - </div> - {% endfor %} - {% if display_tooltip %}<div class="hidden">{{ _('Click on the magnifier to perform search') }}</div>{% endif %} - </div> -</div> diff --git a/searx/templates/legacy/github_ribbon.html b/searx/templates/legacy/github_ribbon.html deleted file mode 100644 index bdd9cf1..0000000 --- a/searx/templates/legacy/github_ribbon.html +++ /dev/null @@ -1,3 +0,0 @@ -<a href="https://github.com/asciimoo/searx" class="github"> - <img style="position: absolute; top: 0; right: 0; border: 0;" src="{{ url_for('static', filename='img/github_ribbon.png') }}" alt="Fork me on GitHub" class="github"/> -</a> diff --git a/searx/templates/legacy/index.html b/searx/templates/legacy/index.html deleted file mode 100644 index de956d5..0000000 --- a/searx/templates/legacy/index.html +++ /dev/null @@ -1,18 +0,0 @@ -{% extends "legacy/base.html" %} -{% block content %} -<div class="center"> - <div class="title"><h1>searx</h1></div> - {% include 'legacy/search.html' %} - <p class="top_margin"> - {% if rtl %} - <a href="{{ url_for('preferences') }}" class="hmarg">{{ _('preferences') }}</a> - {% endif %} - <a href="{{ url_for('about') }}" class="hmarg">{{ _('about') }}</a> - {% if not rtl %} - <a href="{{ url_for('preferences') }}" class="hmarg">{{ _('preferences') }}</a> - {% endif %} - </p> -</div> -{% include 'legacy/github_ribbon.html' %} -{% endblock %} - diff --git a/searx/templates/legacy/infobox.html b/searx/templates/legacy/infobox.html deleted file mode 100644 index 4dd25fa..0000000 --- a/searx/templates/legacy/infobox.html +++ /dev/null @@ -1,51 +0,0 @@ -<div class="infobox"> -<h2><bdi>{{ infobox.infobox }}</bdi></h2> - {% if infobox.img_src %}<img src="{{ image_proxify(infobox.img_src) }}" title="{{ infobox.infobox|striptags }}" alt="{{ infobox.infobox|striptags }}" />{% endif %} - <p><bdi>{{ infobox.entity }}</bdi></p> - <p><bdi>{{ infobox.content | safe }}</bdi></p> - {% if infobox.attributes %} - <div class="attributes"> - <table> - {% for attribute in infobox.attributes %} - <tr> - <td><bdi>{{ attribute.label }}</bdi></td> - {% if attribute.image %} - <td><img src="{{ image_proxify(attribute.image.src) }}" alt="{{ attribute.image.alt }}" /></td> - {% else %} - <td><bdi>{{ attribute.value }}</bdi></td> - {% endif %} - </tr> - {% endfor %} - </table> - </div> - {% endif %} - - {% if infobox.urls %} - <div class="urls"> - <ul> - {% for url in infobox.urls %} - <li class="url"><bdi><a href="{{ url.url }}" {% if results_on_new_tab %}target="_blank" rel="noopener noreferrer"{% else %}rel="noreferrer"{% endif %}>{{ url.title }}</a></bdi></li> - {% endfor %} - </ul> - </div> - {% endif %} - - {% if infobox.relatedTopics %} - <div class="relatedTopics"> - {% for topic in infobox.relatedTopics %} - <div> - <h3><bdi>{{ topic.name }}</bdi></h3> - {% for suggestion in topic.suggestions %} - <form method="{{ method or 'POST' }}" action="{{ url_for('index') }}"> - <input type="hidden" name="q" value="{{ suggestion }}"> - <input type="submit" value="{{ suggestion }}" /> - </form> - {% endfor %} - </div> - {% endfor %} - </div> - {% endif %} - - <br /> - -</div> diff --git a/searx/templates/legacy/preferences.html b/searx/templates/legacy/preferences.html deleted file mode 100644 index f418dcd..0000000 --- a/searx/templates/legacy/preferences.html +++ /dev/null @@ -1,129 +0,0 @@ -{% extends "legacy/base.html" %} -{% block head %} {% endblock %} -{% block content %} -<div class="row"> - <h2>{{ _('Preferences') }}</h2> - - <form method="post" action="{{ url_for('preferences') }}" id="search_form"> - <fieldset> - <legend>{{ _('Default categories') }}</legend> - {% set display_tooltip = false %} - {% include 'legacy/categories.html' %} - </fieldset> - <fieldset> - <legend>{{ _('Search language') }}</legend> - <p> - <select name='language'> - <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> - </p> - </fieldset> - <fieldset> - <legend>{{ _('Interface language') }}</legend> - <p> - <select name='locale'> - {% for locale_id,locale_name in locales.items() | sort %} - <option value="{{ locale_id }}" {% if locale_id == current_locale %}selected="selected"{% endif %}>{{ locale_name }}</option> - {% endfor %} - </select> - </p> - </fieldset> - <fieldset> - <legend>{{ _('Autocomplete') }}</legend> - <p> - <select name="autocomplete"> - <option value=""> - </option> - {% for backend in autocomplete_backends %} - <option value="{{ backend }}" {% if backend == autocomplete %}selected="selected"{% endif %}>{{ backend }}</option> - {% endfor %} - </select> - </p> - </fieldset> - <fieldset> - <legend>{{ _('Image proxy') }}</legend> - <p> - <select name='image_proxy'> - <option value="1" {% if image_proxy %}selected="selected"{% endif %}>{{ _('Enabled') }}</option> - <option value="" {% if not image_proxy %}selected="selected"{% endif %}>{{ _('Disabled') }}</option> - </select> - </p> - </fieldset> - <fieldset> - <legend>{{ _('Method') }}</legend> - <p> - <select name='method'> - <option value="POST" {% if method == 'POST' %}selected="selected"{% endif %}>POST</option> - <option value="GET" {% if method == 'GET' %}selected="selected"{% endif %}>GET</option> - </select> - </p> - </fieldset> - <fieldset> - <legend>{{ _('SafeSearch') }}</legend> - <p> - <select name='safesearch'> - <option value="2" {% if safesearch == '2' %}selected="selected"{% endif %}>{{ _('Strict') }}</option> - <option value="1" {% if safesearch == '1' %}selected="selected"{% endif %}>{{ _('Moderate') }}</option> - <option value="0" {% if safesearch == '0' %}selected="selected"{% endif %}>{{ _('None') }}</option> - </select> - </p> - </fieldset> - <fieldset> - <legend>{{ _('Themes') }}</legend> - <p> - <select name="theme"> - {% for name in themes %} - <option value="{{ name }}" {% if name == theme %}selected="selected"{% endif %}>{{ name }}</option> - {% endfor %} - </select> - </p> - </fieldset> - <fieldset> - <legend>{{ _('Results on new tabs') }}</legend> - <p> - <select name='results_on_new_tab'> - <option value="1" {% if results_on_new_tab %}selected="selected"{% endif %}>{{ _('On') }}</option> - <option value="0" {% if not results_on_new_tab %}selected="selected"{% endif %}>{{ _('Off')}}</option> - </select> - </p> - </fieldset> - <fieldset> - <legend>{{ _('Currently used search engines') }}</legend> - - <table> - <tr> - <th>{{ _('Engine name') }}</th> - <th>{{ _('Category') }}</th> - <th>{{ _('Allow') }} / {{ _('Block') }}</th> - </tr> - {% for categ in all_categories %} - {% for search_engine in engines_by_category[categ] %} - - {% if not search_engine.private %} - <tr> - <td>{{ search_engine.name }} ({{ shortcuts[search_engine.name] }})‎</td> - <td>{{ _(categ) }}</td> - <td class="engine_checkbox"> - <input type="checkbox" id="engine_{{ categ|replace(' ', '_') }}_{{ search_engine.name|replace(' ', '_') }}" name="engine_{{ search_engine.name }}__{{ categ }}"{% if (search_engine.name, categ) in disabled_engines %} checked="checked"{% endif %} /> - <label class="allow" for="engine_{{ categ|replace(' ', '_') }}_{{ search_engine.name|replace(' ', '_') }}">{{ _('Allow') }}</label> - <label class="deny" for="engine_{{ categ|replace(' ', '_') }}_{{ search_engine.name|replace(' ', '_') }}">{{ _('Block') }}</label> - </td> - </tr> - {% endif %} - {% endfor %} - {% endfor %} - </table> - </fieldset> - <p class="small_font">{{ _('These settings are stored in your cookies, this allows us not to store this data about you.') }} - <br /> - {{ _("These cookies serve your sole convenience, we don't use these cookies to track you.") }} - </p> - - <input type="submit" value="{{ _('save') }}" /> - <div class="{% if rtl %}left{% else %}right{% endif %} preferences_back"><a href="{{ url_for('clear_cookies') }}">{{ _('Reset defaults') }}</a></div> - <div class="{% if rtl %}left{% else %}right{% endif %} preferences_back"><a href="{{ url_for('index') }}">{{ _('back') }}</a></div> - </form> -</div> -{% endblock %} diff --git a/searx/templates/legacy/result_templates/code.html b/searx/templates/legacy/result_templates/code.html deleted file mode 100644 index fee6c82..0000000 --- a/searx/templates/legacy/result_templates/code.html +++ /dev/null @@ -1,11 +0,0 @@ -<div class="result {{ result.class }}"> - <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> - <p class="url">{{ result.pretty_url }}‎ <a class="cache_link" href="https://web.archive.org/web/{{ result.url }}" {% if results_on_new_tab %}target="_blank" rel="noopener noreferrer"{% else %}rel="noreferrer"{% endif %}>{{ _('cached') }}</a></p> - {% if result.publishedDate %}<p class="published_date">{{ result.publishedDate }}</p>{% endif %} - <p class="content">{% if result.img_src %}<img src="{{ image_proxify(result.img_src) }}" class="image" />{% endif %}{% if result.content %}{{ result.content|safe }}<br class="last"/>{% endif %}</p> - {% if result.repository %}<p class="result-content"><a href="{{ result.repository|safe }}" {% 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> -</div> diff --git a/searx/templates/legacy/result_templates/default.html b/searx/templates/legacy/result_templates/default.html deleted file mode 100644 index da09117..0000000 --- a/searx/templates/legacy/result_templates/default.html +++ /dev/null @@ -1,6 +0,0 @@ -<div class="result {{ result.class }}"> - <h3 class="result_title">{% if "icon_"~result.engine~".ico" in favicons %}<img width="14" height="14" class="favicon" src="{{ url_for('static', filename='img/icons/icon_'+result.engine+'.ico') }}" alt="{{result.engine}}" />{% endif %}<a href="{{ result.url }}" {% if results_on_new_tab %}target="_blank" rel="noopener noreferrer"{% else %}rel="noreferrer"{% endif %}>{{ result.title|safe }}</a></h3> - <p class="url">{{ result.pretty_url }}‎ <a class="cache_link" href="https://web.archive.org/web/{{ result.url }}" {% if results_on_new_tab %}target="_blank" rel="noopener noreferrer"{% else %}rel="noreferrer"{% endif %}>{{ _('cached') }}</a> - {% if result.publishedDate %}<span class="published_date">{{ result.publishedDate }}</span>{% endif %}</p> - <p class="content">{% if result.img_src %}<img src="{{ image_proxify(result.img_src) }}" class="image" />{% endif %}{% if result.content %}{{ result.content|safe }}<br class="last"/>{% endif %}</p> -</div> diff --git a/searx/templates/legacy/result_templates/images.html b/searx/templates/legacy/result_templates/images.html deleted file mode 100644 index 00f62ab..0000000 --- a/searx/templates/legacy/result_templates/images.html +++ /dev/null @@ -1,6 +0,0 @@ -<div class="image_result"> - <p> - <a href="{{ result.img_src }}" {% if results_on_new_tab %}target="_blank" rel="noopener noreferrer"{% else %}rel="noreferrer"{% endif %}><img src="{% if result.thumbnail_src %}{{ image_proxify(result.thumbnail_src) }}{% else %}{{ image_proxify(result.img_src) }}{% endif %}" title="{{ result.title|striptags }}" alt="{{ result.title|striptags }}" /></a> - <span class="url"><a href="{{ result.url }}" {% if results_on_new_tab %}target="_blank" rel="noopener noreferrer"{% else %}rel="noreferrer"{% endif %} class="small_font">{{ _('original context') }}</a></span> - </p> -</div> diff --git a/searx/templates/legacy/result_templates/key-value.html b/searx/templates/legacy/result_templates/key-value.html deleted file mode 100644 index a5bb509..0000000 --- a/searx/templates/legacy/result_templates/key-value.html +++ /dev/null @@ -1,13 +0,0 @@ -<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/map.html b/searx/templates/legacy/result_templates/map.html deleted file mode 100644 index 0200e0f..0000000 --- a/searx/templates/legacy/result_templates/map.html +++ /dev/null @@ -1,13 +0,0 @@ -<div class="result {{ result.class }}"> - - {% if "icon_"~result.engine~".ico" in favicons %} - <img width="14" height="14" class="favicon" src="{{ url_for('static', filename='img/icons/icon_'+result.engine+'.ico') }}" alt="{{result.engine}}" /> - {% endif %} - - <div> - <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> - <p class="url">{{ result.pretty_url }}‎ <a class="cache_link" href="https://web.archive.org/web/{{ result.url }}" {% if results_on_new_tab %}target="_blank" rel="noopener noreferrer"{% else %}rel="noreferrer"{% endif %}>{{ _('cached') }}</a> - {% if result.publishedDate %}<span class="published_date">{{ result.publishedDate }}</span>{% endif %}</p> - <p class="content">{% if result.img_src %}<img src="{{ image_proxify(result.img_src) }}" class="image" />{% endif %}{% if result.content %}{{ result.content|safe }}<br class="last"/>{% endif %}</p> - </div> -</div> diff --git a/searx/templates/legacy/result_templates/torrent.html b/searx/templates/legacy/result_templates/torrent.html deleted file mode 100644 index 068e053..0000000 --- a/searx/templates/legacy/result_templates/torrent.html +++ /dev/null @@ -1,13 +0,0 @@ -<div class="result torrent_result"> - {% if "icon_"~result.engine~".ico" in favicons %} - <img width="14" height="14" class="favicon" src="{{ url_for('static', filename='img/icons/icon_'+result.engine+'.ico') }}" alt="{{result.engine}}" /> - {% 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> - <p class="url">{{ result.pretty_url }}‎</p> - {% if result.content %}<p class="content">{{ result.content|safe }}</p>{% endif %} - <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 is defined %}<span class="stats">{{ _('Seeder') }} : {{ result.seed }}, {{ _('Leecher') }} : {{ result.leech }}</span>{% endif %} - </p> -</div> diff --git a/searx/templates/legacy/result_templates/videos.html b/searx/templates/legacy/result_templates/videos.html deleted file mode 100644 index 727f44c..0000000 --- a/searx/templates/legacy/result_templates/videos.html +++ /dev/null @@ -1,6 +0,0 @@ -<div class="result"> - <h3 class="result_title">{% if "icon_"~result.engine~".ico" in favicons %}<img width="14" height="14" class="favicon" src="{{ url_for('static', filename='img/icons/icon_'+result.engine+'.ico') }}" alt="{{result.engine}}" />{% endif %}<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.publishedDate %}<span class="published_date">{{ result.publishedDate }}</span><br />{% endif %} - <a href="{{ result.url }}" {% if results_on_new_tab %}target="_blank" rel="noopener noreferrer"{% else %}rel="noreferrer"{% endif %}><img class="thumbnail" src="{{ image_proxify(result.thumbnail) }}" title="{{ result.title|striptags }}" alt="{{ result.title|striptags }}"/></a> - <p class="url">{{ result.url }}‎</p> -</div> diff --git a/searx/templates/legacy/results.html b/searx/templates/legacy/results.html deleted file mode 100644 index 2e28bc9..0000000 --- a/searx/templates/legacy/results.html +++ /dev/null @@ -1,100 +0,0 @@ -{% extends "legacy/base.html" %} -{% block title %}{{ q|e }} - {% endblock %} -{% block meta %}<link rel="alternate" type="application/rss+xml" title="Searx search: {{ q|e }}" href="{{ url_for('index') }}?q={{ q|urlencode }}&format=rss&{% for category in selected_categories %}category_{{ category }}=1&{% endfor %}pageno={{ pageno }}">{% endblock %} -{% block content %} -<div class="preferences_container right"><a href="{{ url_for('preferences') }}" id="preferences"><span>preferences</span></a></div> -<div class="small search center"> - {% include 'legacy/search.html' %} -</div> -<div id="results"> - <div id="sidebar"> - - <div id="search_url"> - {{ _('Search URL') }}: - <input type="text" value="{{ base_url }}?q={{ q|urlencode }}{% if selected_categories %}&categories={{ selected_categories|join(",") | replace(' ','+') }}{% endif %}{% if pageno > 1 %}&pageno={{ pageno }}{% endif %}" readonly /> - </div> - <div id="apis"> - {{ _('Download results') }} - {% for output_type in ('csv', 'json', 'rss') %} - <form method="{{ method or 'POST' }}" action="{{ url_for('index') }}"> - <div class="left"> - <input type="hidden" name="q" value="{{ q|e }}" /> - <input type="hidden" name="format" value="{{ output_type }}" /> - {% for category in selected_categories %} - <input type="hidden" name="category_{{ category }}" value="1"/> - {% endfor %} - <input type="hidden" name="pageno" value="{{ pageno }}" /> - <input type="submit" value="{{ output_type }}" /> - </div> - </form> - {% endfor %} - </div> - </div> - - {% if answers %} - <div id="answers"><span>{{ _('Answers') }}</span> - {% for answer in answers %} - <span>{{ answer }}</span> - {% endfor %} - </div> - {% endif %} - - {% if suggestions %} - <div id="suggestions"><span id="suggestions-title">{{ _('Suggestions') }} : </span> - {% set first = true %} - {% for suggestion in suggestions %} - {% if not first %} • {% endif %}<form method="{{ method or 'POST' }}" action="{{ url_for('index') }}"> - <input type="hidden" name="q" value="{{ suggestion.url }}"> - <input type="submit" class="suggestion" value="{{ suggestion.title }}" /> - </form> - {% set first = false %} - {% endfor %} - </div> - {% endif %} - - {% if infoboxes %} - <div id="infoboxes"> - {% for infobox in infoboxes %} - {% include 'legacy/infobox.html' %} - {% endfor %} - </div> - {% endif %} - - {% for result in results %} - {% if result['template'] %} - {% include get_result_template('legacy', result['template']) %} - {% else %} - {% include 'legacy/result_templates/default.html' %} - {% endif %} - {% endfor %} - - {% if paging %} - <div id="pagination"> - {% if pageno > 1 %} - <form method="{{ method or 'POST' }}" action="{{ url_for('index') }}"> - <div class="{% if rtl %}right{% else %}left{% endif %}"> - <input type="hidden" name="q" value="{{ q|e }}" /> - {% for category in selected_categories %} - <input type="hidden" name="category_{{ category }}" value="1"/> - {% endfor %} - <input type="hidden" name="pageno" value="{{ pageno-1 }}" /> - <input type="submit" value="<< {{ _('previous page') }}" /> - </div> - </form> - {% endif %} - <form method="{{ method or 'POST' }}" action="{{ url_for('index') }}"> - <div class="{% if rtl %}left{% else %}right{% endif %}"> - {% 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+1 }}" /> - <input type="submit" value="{{ _('next page') }} >>" /> - </div> - </form> - - <br /> - </div> - {% endif %} -</div> -{% endblock %} diff --git a/searx/templates/legacy/search.html b/searx/templates/legacy/search.html deleted file mode 100644 index 4d37f9b..0000000 --- a/searx/templates/legacy/search.html +++ /dev/null @@ -1,8 +0,0 @@ -<form method="{{ method or 'POST' }}" action="{{ url_for('index') }}" id="search_form"> - <div id="search_wrapper"> - <input type="text" placeholder="{{ _('Search for...') }}" id="q" class="q" name="q" tabindex="1" autocomplete="off" size="100" {% if q %}value="{{ q }}"{% endif %}/> - <input type="submit" value="search" id="search_submit" /> - </div> - {% set display_tooltip = true %} - {% include 'legacy/categories.html' %} -</form> diff --git a/searx/templates/legacy/stats.html b/searx/templates/legacy/stats.html deleted file mode 100644 index 372447e..0000000 --- a/searx/templates/legacy/stats.html +++ /dev/null @@ -1,22 +0,0 @@ -{% extends "legacy/base.html" %} -{% block head %} {% endblock %} -{% block content %} -<h2>{{ _('Engine stats') }}</h2> - -{% for stat_name,stat_category in stats %} -<div class="left"> - <table> - <tr colspan="3"> - <th>{{ stat_name }}</th> - </tr> - {% for engine in stat_category %} - <tr> - <td>{{ engine.name }}</td> - <td>{{ '%.02f'|format(engine.avg) }}</td> - <td class="percentage"><div style="width: {{ engine.percentage }}%"> </div></td> - </tr> - {% endfor %} - </table> -</div> -{% endfor %} -{% endblock %} diff --git a/searx/templates/oscar/404.html b/searx/templates/oscar/404.html index 5a50880..cdb31db 100644 --- a/searx/templates/oscar/404.html +++ b/searx/templates/oscar/404.html @@ -3,7 +3,7 @@ <div class="text-center"> <h1>{{ _('Page not found') }}</h1> {% autoescape false %} - <p>{{ _('Go to %(search_page)s.', search_page=unicode('<a href="{}">{}</a>').format(url_for('index'), _('search page'))) }}</p> + <p>{{ _('Go to %(search_page)s.', search_page='<a href="{}">{}</a>'.format(url_for('index'), _('search page'))) }}</p> {% endautoescape %} </div> {% endblock %} diff --git a/searx/templates/oscar/advanced.html b/searx/templates/oscar/advanced.html index bf5f863..0b13d50 100644 --- a/searx/templates/oscar/advanced.html +++ b/searx/templates/oscar/advanced.html @@ -1,4 +1,4 @@ -<input type="checkbox" name="advanced_search" id="check-advanced" {% if advanced_search %} checked="checked"{% endif %}> +<input type="checkbox" name="advanced_search" class="visually-hidden" id="check-advanced" {% if advanced_search %} checked="checked"{% endif %}> <label for="check-advanced">{{- "" -}} <span class="glyphicon glyphicon-cog"></span> {{- _('Advanced settings') -}} diff --git a/searx/templates/oscar/base.html b/searx/templates/oscar/base.html index 66a9e60..6134bd7 100644 --- a/searx/templates/oscar/base.html +++ b/searx/templates/oscar/base.html @@ -1,16 +1,14 @@ {% from 'oscar/macros.html' import icon %} <!DOCTYPE html> -<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en"{% if rtl %} dir="rtl"{% endif %}> +<html lang="{{ preferences.get_value('locale') }}" xml:lang="{{ preferences.get_value('locale') }}"{% if rtl %} dir="rtl"{% endif %} class="nojs"> <head> <meta charset="UTF-8" /> <meta name="description" content="searx - a privacy-respecting, hackable metasearch engine" /> <meta name="keywords" content="searx, search, search engine, metasearch, meta search" /> - <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="generator" content="searx/{{ searx_version }}"> <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=2.0, user-scalable=1" /> {% block meta %}{% endblock %} - <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') -%} @@ -19,17 +17,16 @@ {{' '}}<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" /> + {% set templates = results|map(attribute='template')|unique|list -%} + {%- set load_leaflet = 'map.html' in templates -%} + {%- if load_leaflet -%} + {{' '}}<link rel="stylesheet" href="{{ url_for('static', filename='css/leaflet.min.css') }}" type="text/css" /> + {%- endif %} + {%- for css in styles %} <link rel="stylesheet" href="{{ url_for('static', filename=css) }}" type="text/css" /> {% endfor %} - <!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries --> - <!--[if lt IE 9]> - <script src="{{ url_for('static', filename='js/html5shiv.min.js') }}"></script> - <script src="{{ url_for('static', filename='js/respond.min.js') }}"></script> - <![endif]--> - <link rel="shortcut icon" href="{{ url_for('static', filename='img/favicon.png') }}" /> {% block styles %} @@ -37,17 +34,17 @@ {% block head %} {% endblock %} - <link title="{{ instance_name }}" type="application/opensearchdescription+xml" rel="search" href="{{ url_for('opensearch') }}"/> + <link title="{{ instance_name }}" type="application/opensearchdescription+xml" rel="search" href="{{ opensearch_url }}"/> <noscript> <style type="text/css"> .tab-content > .active_if_nojs, .active_if_nojs {display: block !important; visibility: visible !important;} .margin_top_if_nojs {margin-top: 20px;} - .hide_if_nojs {display: none !important;overflow:none !important;} + .hide_if_nojs {display: none !important;overflow: hidden !important;} .disabled_if_nojs {pointer-events: none; cursor: default; text-decoration: line-through;} </style> </noscript> </head> -<body> +<body class="{{ endpoint }}_endpoint" > {% include 'oscar/navbar.html' %} <div class="container"> @@ -85,22 +82,24 @@ {% endblock %} <p class="text-muted"> <small> - {{ _('Powered by') }} <a href="https://asciimoo.github.io/searx/">searx</a> - {{ searx_version }} - {{ _('a privacy-respecting, hackable metasearch engine') }}<br/> - <a href="https://github.com/asciimoo/searx">{{ _('Source code') }}</a> | - <a href="https://github.com/asciimoo/searx/issues">{{ _('Issue tracker') }}</a> | - <a href="https://github.com/asciimoo/searx/wiki/Searx-instances">{{ _('Public instances') }}</a> + {{ _('Powered by') }} <a href="{{ brand.DOCS_URL }}">searx</a> - {{ searx_version }} - {{ _('a privacy-respecting, hackable metasearch engine') }}<br/> + <a href="{{ brand.GIT_URL }}">{{ _('Source code') }}</a> | + <a href="{{ brand.ISSUE_URL }}">{{ _('Issue tracker') }}</a> | + <a href="{{ brand.PUBLIC_INSTANCES }}">{{ _('Public instances') }}</a>{% if brand.CONTACT_URL %} | + <a href="{{ brand.CONTACT_URL }}">{{ _('Contact instance maintainer') }}</a>{% endif %} </small> </p> </div> </div> - <script src="{{ url_for('static', filename='js/jquery-1.11.1.min.js') }}"></script> + <script src="{{ url_for('static', filename='js/jquery.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 load_leaflet %}{{" "}}<script src="{{ url_for('static', filename='js/leaflet.js') }}"></script>{{ "\n" }}{% endif %} + {% if autocomplete %}{{" "}}<script src="{{ url_for('static', filename='js/typeahead.bundle.min.js') }}"></script>{{ "\n" }}{% 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> + data-autocompleter="{% if autocomplete %}true{% else %}false{% endif %}" + data-translations="{{ translations }}"></script> {% for script in scripts %} {{""}}<script src="{{ url_for('static', filename=script) }}"></script> {% endfor %} diff --git a/searx/templates/oscar/categories.html b/searx/templates/oscar/categories.html index a5c5f61..afb3893 100644 --- a/searx/templates/oscar/categories.html +++ b/searx/templates/oscar/categories.html @@ -1,13 +1,17 @@ <div id="categories"> {%- if rtl -%} {% for category in categories | reverse -%} + <a> <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> + </a> {%- endfor %} {%- else -%} {% for category in categories -%} + <a> <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> + </a> {%- endfor %} {%- endif -%} </div> diff --git a/searx/templates/oscar/index.html b/searx/templates/oscar/index.html index b941f5f..fd8625d 100644 --- a/searx/templates/oscar/index.html +++ b/searx/templates/oscar/index.html @@ -1,17 +1,16 @@ {% extends "oscar/base.html" %} {% block content %} <div class="container-fluid"> - <div class="row"> + <div class="row">{{- "" -}} <div class="text-center col-sm-12 col-md-12"> - {% if cookies['oscar-style'] == 'pointhi' %} + {%- if cookies['oscar-style'] == 'pointhi' -%} <h1 class="text-hide center-block"><img class="center-block img-responsive" src="{{ url_for('static', filename='img/searx_logo.png') }}" alt="searx logo"/>searx</h1> - {% else %} - <h1 class="text-hide center-block" id="main-logo"> - <img class="center-block img-responsive" src="{{ url_for('static', filename='img/logo_searx_a.png') }}" alt="searx logo" /> - searx - </h1> - {% endif %} - </div> + {%- else -%} + <div class="text-hide center-block" id="main-logo">{{- "" -}} + <img class="center-block img-responsive" src="{{ url_for('static', filename='img/logo_searx_a.png') }}" alt="searx logo" />searx{{- "" -}} + </div> + {%- endif -%} + </div>{{- "" -}} </div> <div class="row"> <div class="text-center col-sm-12 col-md-12"> diff --git a/searx/templates/oscar/infobox.html b/searx/templates/oscar/infobox.html index 9802f11..8a12b80 100644 --- a/searx/templates/oscar/infobox.html +++ b/searx/templates/oscar/infobox.html @@ -1,10 +1,19 @@ {% 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="infobox_part"> + <div class="{% if not rtl %}pull-right{% endif %}"> + {% for engine in infobox.engines %} + <span class="label label-default">{{ engine }}</span> + {% endfor %} + </div> + <h4 class="panel-title"><bdi>{{ infobox.infobox }}</bdi></h4>{{- "" -}} + {% for u in infobox.urls %}{% if u.official %} <a class="header_url" href="{{ u.url }}">{{ u.url }}</a>{% endif %}{% endfor %} + </div> </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 %} + <input type="checkbox" class="infobox_checkbox" id="expand_infobox_{{ infobox.engine }}" hidden> + <div class="panel-body infobox_body"> + {% if infobox.img_src %}<img class="img-responsive center-block infobox_part" src="{{ image_proxify(infobox.img_src) }}" />{% endif %} {% if infobox.content %}<bdi><p class="infobox_part">{{ infobox.content | safe }}</p></bdi>{% endif %} @@ -33,4 +42,8 @@ </div> {% endif %} </div> + <label for="expand_infobox_{{ infobox.engine }}" class="infobox_toggle panel-footer"> + <span class="infobox_label_down glyphicon glyphicon-chevron-down"></span> + <span class="infobox_label_up glyphicon glyphicon-chevron-up"></span> + </label> </div> diff --git a/searx/templates/oscar/languages.html b/searx/templates/oscar/languages.html index 5aff9f9..0846caa 100644 --- a/searx/templates/oscar/languages.html +++ b/searx/templates/oscar/languages.html @@ -1,4 +1,6 @@ -<select class="language custom-select form-control" id="language" name="language" accesskey="l"> +{% from 'oscar/macros.html' import custom_select_class %} +<label class="visually-hidden" for="language">{{ _('Language') }}</label> +<select class="language form-control {{ custom_select_class(rtl) }}" 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 %}> diff --git a/searx/templates/oscar/macros.html b/searx/templates/oscar/macros.html index d2d1dc6..06e7d40 100644 --- a/searx/templates/oscar/macros.html +++ b/searx/templates/oscar/macros.html @@ -1,6 +1,6 @@ <!-- Draw glyphicon icon from bootstrap-theme --> -{% macro icon(action) -%} - <span class="glyphicon glyphicon-{{ action }}"></span> +{% macro icon(action, alt) -%} + <span title="{{ alt }}" class="glyphicon glyphicon-{{ action }}"></span> {%- endmacro %} <!-- Draw favicon --> @@ -8,34 +8,41 @@ <img width="32" height="32" class="favicon" src="{{ url_for('static', filename='themes/oscar/img/icons/' + favicon + '.png') }}" alt="{{ favicon }}" /> {%- endmacro %} -{%- macro result_link(url, title, classes='') -%} -<a href="{{ url }}" {% if classes %}class="{{ classes }}" {% endif %}{% if results_on_new_tab %}target="_blank" rel="noopener noreferrer"{% else %}rel="noreferrer"{% endif %}>{{ title }}</a> +{%- macro result_link(url, title, classes='', id='') -%} +<a href="{{ url }}" {% if classes %}class="{{ classes }}" {% endif %}{% if results_on_new_tab %}target="_blank" rel="noopener noreferrer"{% else %}rel="noreferrer"{% endif %}{% if id %} aria-labelledby="result-{{id}}"{%endif%}>{{ title }}</a> {%- endmacro -%} <!-- Draw result header --> -{% macro result_header(result, favicons) -%} -<h4 class="result_header">{% if result.engine~".png" in favicons %}{{ draw_favicon(result.engine) }} {% endif %}{% if result.url %}{{ result_link(result.url, result.title|safe) }}{% else %}{{ result.title|safe}}{% endif %}</h4> +{% macro result_header(result, favicons, id) -%} +<h4 class="result_header" id="result-{{id}}">{% if result.engine~".png" in favicons %}{{ draw_favicon(result.engine) }}{% endif %}{% if result.url %}{{ result_link(result.url, result.title|safe, id=id) }}{% else %}{{ result.title|safe}}{% endif %}</h4> {%- endmacro %} <!-- Draw result sub header --> -{% macro result_sub_header(result) -%} - {% if result.publishedDate %}<time class="text-muted" datetime="{{ result.pubdate }}" >{{ result.publishedDate }}</time>{% endif %} - {% if result.magnetlink %}<small> • {{ result_link(result.magnetlink, icon('magnet') + _('magnet link'), "magnetlink") }}</small>{% endif %} - {% if result.torrentfile %}<small> • {{ result_link(result.torrentfile, icon('download-alt') + _('torrent file'), "torrentfile") }}</small>{% endif %} +{% macro result_sub_header(result, id) -%} + {%- if result.publishedDate %}<time class="text-muted" datetime="{{ result.pubdate }}" >{{ result.publishedDate }}</time>{% endif -%} + {%- if result.magnetlink %}<small> • {{ result_link(result.magnetlink, icon('magnet') + _('magnet link'), "magnetlink", id) }}</small>{% endif -%} + {%- if result.torrentfile %}<small> • {{ result_link(result.torrentfile, icon('download-alt') + _('torrent file'), "torrentfile", id) }}</small>{% endif -%} {%- endmacro %} <!-- Draw result footer --> -{% macro result_footer(result) -%} +{% macro result_footer(result, id) -%} <div class="clearfix"></div>{{- "" -}} <div class="pull-right"> {%- for engine in result.engines -%} <span class="label label-default">{{ engine }}</span> {%- endfor -%} {%- if result.url -%} - <small>{{ result_link("https://web.archive.org/web/" + result.url, icon('link') + _('cached'), "text-info") }}</small> + {%- if result.cached_url -%} + <small>{{ result_link(result.cached_url, icon('link') + _('cached'), "text-info", id) }}</small> + {%- elif not result.is_onion -%} + <small>{{ result_link("https://web.archive.org/web/" + result.url, icon('link') + _('cached'), "text-info", id) }}</small> + {% if archive_today %} + <small>{{ result_link("https://archive.today/" + result.url, icon('link') + _('archive'), "text-info", id) }}</small> + {% endif %} + {%- endif -%} {%- endif -%} {%- if proxify -%} - <small>{{ result_link(proxify(result.url), icon('sort') + _('proxied'), "text-info") }}</small> + <small>{{ result_link(proxify(result.url), icon('sort') + _('proxied'), "text-info", id) }}</small> {%- endif -%} </div> {%- if result.pretty_url -%} @@ -43,65 +50,103 @@ {%- endif -%} {%- endmacro %} +<!-- Draw result footer without cache link --> +{% macro result_footer_nocache(result) -%} + <div class="clearfix"></div>{{- "" -}} + <div class="pull-right"> + {%- for engine in result.engines -%} + <span class="label label-default">{{ engine }}</span> + {%- endfor -%} + {%- if proxify -%} + <small>{{ result_link(proxify(result.url), icon('sort') + _('proxied'), "text-info") }}</small> + {%- endif -%} +</div>{{- "" -}} +<div class="external-link">{{ result.pretty_url }}</div> +{%- endmacro %} + <!-- Draw result footer --> -{% macro result_footer_rtl(result) -%} - <div class="clearfix"></div>{{- "" -}} - {% for engine in result.engines -%} +{% macro result_footer_rtl(result, id) -%} + <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 result.cached_url -%} + <small>{{ result_link(result.cached_url, icon('link') + _('cached'), "text-info", id) }}</small> + {%- elif not result.is_onion -%} + <small>{{ result_link("https://web.archive.org/web/" + result.url, icon('link') + _('cached'), "text-info", id) }}</small> + {% if archive_today %} + <small>{{ result_link("https://archive.today/" + result.url, icon('link') + _('archive'), "text-info", id) }}</small> + {% endif %} + {%- endif -%} + {%- endif -%} + {%- if proxify -%} + <small>{{ result_link(proxify(result.url), icon('sort') + _('proxied'), "text-info", id) }}</small> {%- endif -%} - {% if proxify -%} - <small>{{ result_link(proxify(result.url), icon('sort') + _('proxied'), "text-info") }}</small> - {%- endif %} {%- if result.pretty_url -%} <div class="external-link">{{ result.pretty_url }}</div> - {%- endif %} + {%- endif -%} +{%- endmacro %} + +<!-- Draw result footer without cache link --> +{% macro result_footer_nocache_rtl(result) -%} + <div class="clearfix"></div> + {%- for engine in result.engines -%} + <span class="label label-default">{{ engine }}</span> + {%- endfor -%} + {%- if proxify -%} + <small>{{ result_link(proxify(result.url), icon('sort') + _('proxied'), "text-info") }}</small> + {%- endif -%} + <div class="external-link">{{ result.pretty_url }}</div> {%- endmacro %} -{% macro preferences_item_header(info, label, rtl) -%} - {% if rtl %} - <div class="row form-group"> - <label class="col-sm-3 col-md-2 pull-right">{{ label }}</label> - <span class="col-sm-5 col-md-6 help-block pull-left">{{ info }}</span> +{% macro preferences_item_header(info, label, rtl, id) -%} + {%- if rtl -%} + <div class="row form-group">{{- "" -}} + <label class="col-sm-3 col-md-2 pull-right"{% if id %} for="{{id}}"{% endif %}>{{ label }}</label>{{- "" -}} + <span class="col-sm-5 col-md-6 help-block pull-left">{{ info }}</span>{{- "" -}} <div class="col-sm-4 col-md-4"> - {% else %} - <div class="row form-group"> - <label class="col-sm-3 col-md-2">{{ label }}</label> + {%- else -%} + <div class="row form-group">{{- "" -}} + <label class="col-sm-3 col-md-2"{% if id %} for="{{id}}"{% endif %}>{{ label }}</label>{{- "" -}} <div class="col-sm-4 col-md-4"> - {% endif %} + {%- endif -%} {%- endmacro %} {% macro preferences_item_footer(info, label, rtl) -%} - {% if rtl %} - </div> + {%- if rtl -%} + </div>{{- "" -}} </div> - {% else %} + {%- else -%} </div> - <span class="col-sm-5 col-md-6 help-block">{{ info }}</span> + <span class="col-sm-5 col-md-6 help-block">{{ info }}</span>{{- "" -}} </div> - {% endif %} + {%- endif -%} +{%- endmacro %} + +{% macro custom_select_class(rtl) -%} +custom-select{% if rtl %}-rtl{% endif %} {%- endmacro %} {% macro checkbox_toggle(id, blocked) -%} - <div class="onoffswitch"> - <input type="checkbox" id="{{ id }}" name="{{ id }}"{% if blocked %} checked="checked"{% endif %} class="onoffswitch-checkbox"> - <label class="onoffswitch-label" for="{{ id }}"> - <span class="onoffswitch-inner"></span> - <span class="onoffswitch-switch"></span> - </label> - </div> + <div class="onoffswitch">{{- "" -}} + <input type="checkbox" id="{{ id }}" name="{{ id }}"{% if blocked %} checked="checked"{% endif %} class="onoffswitch-checkbox">{{- "" -}} + <label class="onoffswitch-label" for="{{ id }}">{{- "" -}} + <span class="onoffswitch-inner"></span>{{- "" -}} + <span class="onoffswitch-switch"></span>{{- "" -}} + </label>{{- "" -}} + <label class="visually-hidden" for="{{ id }}">{{ _('Allow') }}</label>{{- "" -}} + </div>{{- "" -}} {%- endmacro %} {% macro support_toggle(supports) -%} - {% if supports %} + {%- if supports -%} <span class="label label-success"> - {{ _("supported") }} + {{- _("supported") -}} </span> - {% else %} + {%- else -%} <span class="label label-danger"> - {{ _("not supported") }} + {{- _("not supported") -}} </span> - {% endif %} + {%- endif -%} {%- endmacro %} diff --git a/searx/templates/oscar/messages/no_results.html b/searx/templates/oscar/messages/no_results.html index 16b5984..82bf2f7 100644 --- a/searx/templates/oscar/messages/no_results.html +++ b/searx/templates/oscar/messages/no_results.html @@ -7,7 +7,7 @@ {{ engine_name }} ({{ error_type }}){% if not loop.last %}, {% endif %} {% endfor %} </p> - <p><small>{{ _('Please, try again later or find another searx instance.') }}</small></p> + <p><small>{{ _('Please, try again later or find another searx instance.') }} (<a href="{{ brand.PUBLIC_INSTANCES }}">{{ _('Public instances') }}</a>)</small></p> </div> {% else %} <div class="alert alert-info fade in" role="alert"> diff --git a/searx/templates/oscar/preferences.html b/searx/templates/oscar/preferences.html index 1a484dd..45cd12a 100644 --- a/searx/templates/oscar/preferences.html +++ b/searx/templates/oscar/preferences.html @@ -1,5 +1,15 @@ -{% from 'oscar/macros.html' import preferences_item_header, preferences_item_header_rtl, preferences_item_footer, preferences_item_footer_rtl, checkbox_toggle, support_toggle %} +{% from 'oscar/macros.html' import preferences_item_header, preferences_item_header_rtl, preferences_item_footer, preferences_item_footer_rtl, checkbox_toggle, support_toggle, custom_select_class %} {% extends "oscar/base.html" %} +{% macro engine_about(search_engine, id) -%} +{% if search_engine.about is defined %} +{% set about = search_engine.about %} +<div class="engine-tooltip" role="tooltip" id="{{ id }}">{{- "" -}} + <h5><a href="{{about.website}}" rel="noreferrer">{{about.website}}</a></h5> + {%- if about.wikidata_id -%}<p><a href="https://www.wikidata.org/wiki/{{about.wikidata_id}}" rel="noreferrer">wikidata.org/wiki/{{about.wikidata_id}}</a></p>{%- endif -%} + {%- if search_engine.enable_http %}<p>{{ icon('exclamation-sign', 'No HTTPS') }}{{ _('No HTTPS')}}</p>{% endif -%} +</div> +{%- endif -%} +{%- endmacro %} {% block title %}{{ _('preferences') }} - {% endblock %} {% block content %} @@ -9,7 +19,7 @@ <form method="post" action="{{ url_for('preferences') }}" id="search_form"> <!-- Nav tabs --> - <ul class="nav nav-tabs nav-justified hide_if_nojs" role="tablist" style="margin-bottom:20px;"> + <ul class="nav nav-tabs nav-justified hide_if_nojs" role="tablist"> <li class="active"><a href="#tab_general" role="tab" data-toggle="tab">{{ _('General') }}</a></li> <li><a href="#tab_engine" role="tab" data-toggle="tab">{{ _('Engines') }}</a></li> <li><a href="#tab_plugins" role="tab" data-toggle="tab">{{ _('Plugins') }}</a></li> @@ -25,119 +35,178 @@ <div class="tab-pane active" id="tab_general"> <fieldset> <div class="container-fluid"> + {% if 'categories' not in locked_preferences %} <div class="row form-group"> {% if rtl %} <div class="col-sm-11 col-md-10"> {% include 'oscar/categories.html' %} </div> - <label class="col-sm-3 col-md-2">{{ _('Default categories') }}</label> + <label class="col-sm-3 col-md-2" for="categories">{{ _('Default categories') }}</label> {% else %} - <label class="col-sm-3 col-md-2">{{ _('Default categories') }}</label> + <label class="col-sm-3 col-md-2" for="categories">{{ _('Default categories') }}</label> <div class="col-sm-11 col-md-10 search-categories"> {% include 'oscar/categories.html' %} </div> {% endif %} </div> + {% endif %} + {% if 'language' not in locked_preferences %} {% set language_label = _('Search language') %} {% set language_info = _('What language do you prefer for search?') %} - {{ preferences_item_header(language_info, language_label, rtl) }} + {{ preferences_item_header(language_info, language_label, rtl, 'language') }} {% include 'oscar/languages.html' %} {{ preferences_item_footer(language_info, language_label, rtl) }} + {% endif %} + {% if 'locale' not in locked_preferences %} {% set locale_label = _('Interface language') %} {% set locale_info = _('Change the language of the layout') %} - {{ preferences_item_header(locale_info, locale_label, rtl) }} - <select class="form-control" name='locale'> + {{ preferences_item_header(locale_info, locale_label, rtl, 'locale') }} + <select class="form-control {{ custom_select_class(rtl)}}" name="locale" id="locale"> {% for locale_id,locale_name in locales.items() | sort %} <option value="{{ locale_id }}" {% if locale_id == current_locale %}selected="selected"{% endif %}>{{ locale_name }}</option> {% endfor %} </select> {{ preferences_item_footer(locale_info, locale_label, rtl) }} + {% endif %} + {% if 'autocomplete' not in locked_preferences %} {% set autocomplete_label = _('Autocomplete') %} {% set autocomplete_info = _('Find stuff as you type') %} - {{ preferences_item_header(autocomplete_info, autocomplete_label, rtl) }} - <select class="form-control" name="autocomplete"> + {{ preferences_item_header(autocomplete_info, autocomplete_label, rtl, 'autocomplete') }} + <select class="form-control {{ custom_select_class(rtl) }}" name="autocomplete" id="autocomplete"> <option value=""> - </option> {% for backend in autocomplete_backends %} <option value="{{ backend }}" {% if backend == autocomplete %}selected="selected"{% endif %}>{{ backend }}</option> {% endfor %} </select> {{ preferences_item_footer(autocomplete_info, autocomplete_label, rtl) }} + {% endif %} + {% if 'image_proxy' not in locked_preferences %} {% set image_proxy_label = _('Image proxy') %} {% set image_proxy_info = _('Proxying image results through searx') %} - {{ preferences_item_header(image_proxy_info, image_proxy_label, rtl) }} - <select class="form-control" name='image_proxy'> + {{ preferences_item_header(image_proxy_info, image_proxy_label, rtl, 'image_proxy') }} + <select class="form-control {{ custom_select_class(rtl) }}" name="image_proxy" id="image_proxy"> <option value="1" {% if image_proxy %}selected="selected"{% endif %}>{{ _('Enabled') }}</option> <option value="" {% if not image_proxy %}selected="selected"{% endif %}>{{ _('Disabled')}}</option> </select> {{ preferences_item_footer(image_proxy_info, image_proxy_label, rtl) }} + {% endif %} + {% if 'method' not in locked_preferences %} {% set method_label = _('Method') %} {% set method_info = _('Change how forms are submited, <a href="http://en.wikipedia.org/wiki/Hypertext_Transfer_Protocol#Request_methods" rel="external">learn more about request methods</a>') %} - {{ preferences_item_header(method_info, method_label, rtl) }} - <select class="form-control" name='method'> + {{ preferences_item_header(method_info, method_label, rtl, 'method') }} + <select class="form-control {{ custom_select_class(rtl) }}" name="method" id="method"> <option value="POST" {% if method == 'POST' %}selected="selected"{% endif %}>POST</option> <option value="GET" {% if method == 'GET' %}selected="selected"{% endif %}>GET</option> </select> {{ preferences_item_footer(method_info, method_label, rtl) }} + {% endif %} + {% if 'safesearch' not in locked_preferences %} {% set safesearch_label = _('SafeSearch') %} {% set safesearch_info = _('Filter content') %} - {{ preferences_item_header(safesearch_info, safesearch_label, rtl) }} - <select class="form-control" name='safesearch'> + {{ preferences_item_header(safesearch_info, safesearch_label, rtl, 'safesearch') }} + <select class="form-control {{ custom_select_class(rtl) }}" name="safesearch" id="safesearch"> <option value="2" {% if safesearch == '2' %}selected="selected"{% endif %}>{{ _('Strict') }}</option> <option value="1" {% if safesearch == '1' %}selected="selected"{% endif %}>{{ _('Moderate') }}</option> <option value="0" {% if safesearch == '0' %}selected="selected"{% endif %}>{{ _('None') }}</option> </select> {{ preferences_item_footer(safesearch_info, safesearch_label, rtl) }} + {% endif %} + {% if 'theme' not in locked_preferences %} {% set theme_label = _('Themes') %} {% set theme_info = _('Change searx layout') %} - {{ preferences_item_header(theme_info, theme_label, rtl) }} - <select class="form-control" name="theme"> + {{ preferences_item_header(theme_info, theme_label, rtl, 'theme') }} + <select class="form-control {{ custom_select_class(rtl) }}" name="theme" id="theme"> {% for name in themes %} <option value="{{ name }}" {% if name == theme %}selected="selected"{% endif %}>{{ name }}</option> {% endfor %} </select> {{ preferences_item_footer(theme_info, theme_label, rtl) }} + {% endif %} - {{ preferences_item_header(_('Choose style for this theme'), _('Style'), rtl) }} - <select class="form-control" name='oscar-style'> + {% if 'oscar-style' not in locked_preferences %} + {{ preferences_item_header(_('Choose style for this theme'), _('Style'), rtl, 'oscar_style') }} + <select class="form-control {{ custom_select_class(rtl) }}" name="oscar-style" id="oscar_style"> <option value="logicodev" >Logicodev</option> <option value="pointhi" {% if preferences.get_value('oscar-style') == 'pointhi' %}selected="selected"{% endif %}>Pointhi</option> <option value="logicodev-dark" {% if preferences.get_value('oscar-style') == 'logicodev-dark' %}selected="selected"{% endif %}>Logicodev dark</option> </select> {{ preferences_item_footer(_('Choose style for this theme'), _('Style'), rtl) }} + {% endif %} + {% if 'results_on_new_tab' not in locked_preferences %} {% set label = _('Results on new tabs') %} {% set info = _('Open result links on new browser tabs') %} - {{ preferences_item_header(info, label, rtl) }} - <select class="form-control" name='results_on_new_tab'> + {{ preferences_item_header(info, label, rtl, 'results_on_new_tab') }} + <select class="form-control {{ custom_select_class(rtl) }}" name="results_on_new_tab" id="results_on_new_tab"> <option value="1" {% if results_on_new_tab %}selected="selected"{% endif %}>{{ _('On') }}</option> <option value="0" {% if not results_on_new_tab %}selected="selected"{% endif %}>{{ _('Off')}}</option> </select> {{ preferences_item_footer(info, label, rtl) }} + {% endif %} + + {% if 'autofocus' not in locked_preferences %} + {% set label = _('Autofocus search field') %} + {% set info = _('Turn off if you use your keyboard to scroll') %} + {{ preferences_item_header(info, label, rtl, 'autofocus') }} + <select class="form-control {{ custom_select_class(rtl) }}" name="autofocus" id="autofocus"> + <option value="1" {% if autofocus %}selected="selected"{% endif %}>{{ _('On') }}</option> + <option value="0" {% if not autofocus %}selected="selected"{% endif %}>{{ _('Off')}}</option> + </select> + {{ preferences_item_footer(info, label, rtl) }} + {% endif %} + {% if 'archive_today' not in locked_preferences %} + {% set label = _('Show archive.today links') %} + {% set info = _('Alternative link cache service') %} + {{ preferences_item_header(info, label, rtl, 'archive_today') }} + <select class="form-control {{ custom_select_class(rtl) }}" name="archive_today" id="archive_today"> + <option value="1" {% if archive_today %}selected="selected"{% endif %}>{{ _('On') }}</option> + <option value="0" {% if not archive_today %}selected="selected"{% endif %}>{{ _('Off')}}</option> + </select> + {{ preferences_item_footer(info, label, rtl) }} + {% endif %} + + {% set label = _('Show advanced settings') %} + {% set info = _('Show advanced settings panel in the home page by default') %} + {{ preferences_item_header(info, label, rtl, 'advanced_search') }} + <select class="form-control {{ custom_select_class(rtl) }}" name="advanced_search" id="advanced_search"> + <option value="1" {% if preferences.get_value('advanced_search')%}selected="selected"{% endif %}>{{ _('On') }}</option> + <option value="0" {% if not preferences.get_value('advanced_search')%}selected="selected"{% endif %}>{{ _('Off')}}</option> + </select> + {{ preferences_item_footer(info, label, rtl) }} + + {% if 'doi_resolver' not in locked_preferences %} {% set label = _('Open Access DOI resolver') %} {% set info = _('Redirect to open-access versions of publications when available (plugin required)') %} - {{ preferences_item_header(info, label, rtl) }} - <select class="form-control" id='doi_resolver' name='doi_resolver'> + {{ preferences_item_header(info, label, rtl, 'doi_resolver') }} + <select class="form-control {{ custom_select_class(rtl) }}" name="doi_resolver" id="doi_resolver"> {% for doi_resolver_name,doi_resolver_url in doi_resolvers.items() %} - <option value="{{ doi_resolver_name }}" {% if doi_resolver_name == current_doi_resolver %}selected="selected"{% endif %}> + <option value="{{ doi_resolver_name }}" {% if doi_resolver_url == current_doi_resolver %}selected="selected"{% endif %}> {{ doi_resolver_name }} - {{ doi_resolver_url }} </option> {% endfor %} </select> {{ preferences_item_footer(info, label, rtl) }} + {% endif %} + + {% set label = _('Engine tokens') %} + {% set info = _('Access tokens for private engines') %} + {{ preferences_item_header(info, label, rtl, 'tokens') }} + <input class="form-control" id="tokens" name="tokens" value='{{ preferences.tokens.get_value() }}'/> + {{ preferences_item_footer(info, label, rtl) }} </div> </fieldset> </div> <div class="tab-pane active_if_nojs" id="tab_engine"> <!-- Nav tabs --> - <ul class="nav nav-tabs nav-justified hide_if_nojs" role="tablist" style="margin-bottom:20px;"> + <ul class="nav nav-tabs nav-justified hide_if_nojs" role="tablist"> {% for categ in all_categories %} <li{% if loop.first %} class="active"{% endif %}><a href="#tab_engine_{{ categ|replace(' ', '_') }}" role="tab" data-toggle="tab">{{ _(categ) }}</a></li> {% endfor %} @@ -149,6 +218,14 @@ <!-- Tab panes --> <div class="tab-content"> + + <div class="hide_if_nojs"> + <p class="text-{% if rtl %}left{% else %}right{% endif %}"> + <button type="button" class="btn btn-default btn-success" id="allow-all-engines">{{ _("Allow all") }}</button> + <button type="button" class="btn btn-default btn-danger" id="disable-all-engines">{{ _("Disable all") }}</button> + </p> + </div> + {% for categ in all_categories %} <noscript><label>{{ _(categ) }}</label> </noscript> @@ -159,50 +236,54 @@ <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 scope="col">{{ _("Allow") }}</th> + <th scope="col">{{ _("Engine name") }}</th> + <th scope="col">{{ _("Shortcut") }}</th> + <th scope="col">{{ _("Selected language") }}</th> + <th scope="col">{{ _("SafeSearch") }}</th> + <th scope="col">{{ _("Time range") }}</th> + <th scope="col">{{ _("Avg. time") }}</th> + <th scope="col">{{ _("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 scope="col" class="text-right">{{ _("Max time") }}</th> + <th scope="col" class="text-right">{{ _("Avg. time") }}</th> + <th scope="col" class="text-right">{{ _("Time range") }}</th> + <th scope="col" class="text-right">{{ _("SafeSearch") }}</th> + <th scope="col" class="text-right">{{ _("Selected language") }}</th> + <th scope="col" class="text-right">{{ _("Shortcut") }}</th> + <th scope="col" class="text-right">{{ _("Engine name") }}</th> + <th scope="col" class="text-right">{{ _("Allow") }}</th> {% endif %} </tr> {% for search_engine in engines_by_category[categ] %} {% if not search_engine.private %} <tr> {% if not rtl %} - <td class="onoff-checkbox"> - {{ 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 class="onoff-checkbox"> + {{- checkbox_toggle('engine_' + search_engine.name|replace(' ', '_') + '__' + categ|replace(' ', '_'), (search_engine.name, categ) in disabled_engines) -}} + </td> + <th scope="row"><span aria-labelledby="{{ 'tooltip_' + categ + '_' + search_engine.name }}"> + {%- if search_engine.enable_http %}{{ icon('exclamation-sign', 'No HTTPS') }}{% endif -%} + {{- search_engine.name -}}</span> + {{- engine_about(search_engine, 'tooltip_' + categ + '_' + 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 class="{{ 'danger' if stats[search_engine.name]['warn_time'] else '' }}">{% if stats[search_engine.name]['warn_time'] %}{{ icon('exclamation-sign')}} {% endif %}{{ '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 '' }}">{% if stats[search_engine.name]['warn_timeout'] %}{{ icon('exclamation-sign') }} {% endif %}{{ search_engine.timeout }}</td> + {% else %} + <td class="{{ 'danger' if stats[search_engine.name]['warn_timeout'] else '' }}">{{ search_engine.timeout }}{% if stats[search_engine.name]['warn_time'] %} {{ icon('exclamation-sign')}}{% endif %}</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 }}{% if stats[search_engine.name]['warn_time'] %} {{ icon('exclamation-sign')}}{% endif %}</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"> + <th scope="row"><span>{% if search_engine.enable_http %}{{ icon('exclamation-sign', 'No HTTPS') }}{% endif %}{{ search_engine.name }}</span>{{ engine_about(search_engine) }}</th> + <td class="onoff-checkbox"> {{ checkbox_toggle('engine_' + search_engine.name|replace(' ', '_') + '__' + categ|replace(' ', '_'), (search_engine.name, categ) in disabled_engines) }} - </td> + </td> {% endif %} </tr> {% endif %} @@ -222,12 +303,13 @@ <fieldset> <div class="container-fluid"> {% for plugin in plugins %} + {% if plugin.preference_section != 'onions' %} <div class="panel panel-default"> <div class="panel-heading"> <h3 class="panel-title">{{ _(plugin.name) }}</h3> </div> <div class="panel-body"> - <div class="col-xs-6 col-sm-4 col-md-6">{{ _(plugin.description) }}</div> + <div class="col-xs-6 col-sm-4 col-md-6"><label for="{{'plugin_' + plugin.id}}">{{ _(plugin.description) }}</label></div> <div class="col-xs-6 col-sm-4 col-md-6"> <div class="onoff-checkbox"> {{ checkbox_toggle('plugin_' + plugin.id, plugin.id not in allowed_plugins) }} @@ -235,6 +317,7 @@ </div> </div> </div> + {% endif %} {% endfor %} </div> </fieldset> @@ -245,23 +328,23 @@ <noscript> <h3>{{ _('Answerers') }}</h3> </noscript> - <p class="text-muted" style="margin:20px 0;"> + <p class="text-muted"> {{ _('This is the list of searx\'s instant answering modules.') }} </p> <table class="table table-striped"> <tr> - <th class="text-muted">{{ _('Name') }}</th> - <th class="text-muted">{{ _('Keywords') }}</th> - <th class="text-muted">{{ _('Description') }}</th> - <th class="text-muted">{{ _('Examples') }}</th> + <th{% if rtl %} class="text-right"{% endif %}>{{ _('Name') }}</th> + <th{% if rtl %} class="text-right"{% endif %}>{{ _('Keywords') }}</th> + <th{% if rtl %} class="text-right"{% endif %}>{{ _('Description') }}</th> + <th{% if rtl %} class="text-right"{% endif %}>{{ _('Examples') }}</th> </tr> {% for answerer in answerers %} <tr> - <td class="text-muted">{{ answerer.info.name }}</td> - <td class="text-muted">{{ answerer.keywords|join(', ') }}</td> - <td class="text-muted">{{ answerer.info.description }}</td> - <td class="text-muted">{{ answerer.info.examples|join(', ') }}</td> + <td>{{ answerer.info.name }}</td> + <td>{{ answerer.keywords|join(', ') }}</td> + <td>{{ answerer.info.description }}</td> + <td>{{ answerer.info.examples|join(', ') }}</td> </tr> {% endfor %} </table> @@ -272,20 +355,20 @@ <noscript> <h3>{{ _('Cookies') }}</h3> </noscript> - <p class="text-muted" style="margin:20px 0;"> + <p class="text-muted"> {{ _('This is the list of cookies and their values searx is storing on your computer.') }}<br /> {{ _('With that list, you can assess searx transparency.') }}<br /> </p> {% if cookies %} <table class="table table-striped"> <tr> - <th class="text-muted" style="padding-right:40px;">{{ _('Cookie name') }}</th> - <th class="text-muted">{{ _('Value') }}</th> + <th class="text-muted{% if rtl %} text-right{% endif %}">{{ _('Cookie name') }}</th> + <th class="text-muted{% if rtl %} text-right{% endif %}">{{ _('Value') }}</th> </tr> {% for cookie in cookies %} <tr> - <td class="text-muted" style="padding-right:40px;">{{ cookie }}</td> + <td class="text-muted">{{ cookie }}</td> <td class="text-muted">{{ cookies[cookie] }}</td> </tr> {% endfor %} @@ -295,17 +378,23 @@ {% endif %} </div> </div> - <p class="text-muted" style="margin:20px 0;">{{ _('These settings are stored in your cookies, this allows us not to store this data about you.') }} - <br /> - {{ _("These cookies serve your sole convenience, we don't use these cookies to track you.") }} + + <p class="text-muted"> + {{ _('These settings are stored in your cookies, this allows us not to store this data about you.') }} + {{ _("These cookies serve your sole convenience, we don't use these cookies to track you.") }} </p> - <p style="margin:20px 0;">{{ _('Search URL of the currently saved preferences') }} <small class="text-muted">({{ _('Note: specifying custom settings in the search URL can reduce privacy by leaking data to the clicked result sites.') }})</small>:<br/> - <input readonly="" class="form-control select-all-on-click cursor-text" type="url" value="{{ url_for('index', _external=True) }}?preferences={{ preferences_url_params|e }}{% raw %}&q=%s{% endraw %}"> + + <p> + {{ _('Search URL of the currently saved preferences') }} + <small class="text-muted">({{ _('Note: specifying custom settings in the search URL can reduce privacy by leaking data to the clicked result sites.') }})</small>: </p> - <input type="submit" class="btn btn-primary" value="{{ _('save') }}" /> + <div class="tab-pane"> + <input readonly="" class="form-control select-all-on-click cursor-text" type="url" value="{{ url_for('index', _external=True) }}?preferences={{ preferences_url_params|e }}{% raw %}&q=%s{% endraw %}"> + <input type="submit" class="btn btn-primary" value="{{ _('save') }}" /> <a href="{{ url_for('index') }}"><div class="btn btn-default">{{ _('back') }}</div></a> <a href="{{ url_for('clear_cookies') }}"><div class="btn btn-default">{{ _('Reset defaults') }}</div></a> + </div> </form> </div> {% endblock %} diff --git a/searx/templates/oscar/result_templates/code.html b/searx/templates/oscar/result_templates/code.html index a1c18a6..c7d93e2 100644 --- a/searx/templates/oscar/result_templates/code.html +++ b/searx/templates/oscar/result_templates/code.html @@ -1,11 +1,11 @@ -{% from 'oscar/macros.html' import result_header, result_sub_header, result_footer, result_footer_rtl, icon %} +{% from 'oscar/macros.html' import result_header, result_sub_header, result_footer, result_footer_rtl, icon with context%} {{ result_header(result, favicons) }} {{ result_sub_header(result) }} {% if result.content %}<p class="result-content">{{ result.content|safe }}</p>{% endif %} -{% if result.repository %}<p class="result-content">{{ icon('file') }} <a href="{{ result.repository }}" {% if results_on_new_tab %}target="_blank" rel="noopener noreferrer"{% else %}rel="noreferrer"{% endif %}>{{ result.repository }}</a></p>{% endif %} +{% if result.repository %}<p class="result-content">{{ icon('file') }} <a href="{{ result.repository }}" {% if results_on_new_tab %}target="_blank" rel="noopener noreferrer"{% else %}rel="noreferrer"{% endif %} aria-labelledby="result-{{loop.index}}">{{ result.repository }}</a></p>{% endif %} <div dir="ltr"> {{ result.codelines|code_highlighter(result.code_language)|safe }} diff --git a/searx/templates/oscar/result_templates/default.html b/searx/templates/oscar/result_templates/default.html index 885cbbf..53cfee5 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) -}} +{{- result_header(result, favicons, loop.index) -}} +{{- result_sub_header(result, loop.index) -}} {%- 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> + <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') }}" aria-labelledby="result-{{loop.index}}">{{ icon('music') }} {{ _('show media') }}</a></small> {%- endif -%} {%- if result.embedded -%} <div id="result-media-{{ index }}" class="collapse"> - {{ result.embedded|safe }} + {{- 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> +{%- if result.img_src or result.thumbnail -%} +<div class="container-fluid">{{- "" -}} + <div class="row">{{- "" -}} + <img src="{{ image_proxify(result.img_src or result.thumbnail) }}" 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) }} +{{ result_footer_rtl(result, loop.index) }} {%- else -%} -{{ result_footer(result) }} +{{ result_footer(result, loop.index) }} {%- endif -%} diff --git a/searx/templates/oscar/result_templates/files.html b/searx/templates/oscar/result_templates/files.html new file mode 100644 index 0000000..e2fec6f --- /dev/null +++ b/searx/templates/oscar/result_templates/files.html @@ -0,0 +1,55 @@ +{% from 'oscar/macros.html' import result_header, result_sub_header, result_footer_nocache, result_footer_nocache_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') }}"> + {%- if result.mtype == 'audio' %}{{ icon('music') -}} + {%- elif result.mtype == 'video' %} {{ icon('film') -}} + {%- endif %} {{ _('show media') }}</a></small> +{%- endif -%} + +{%- if result.embedded -%} +<div id="result-media-{{ index }}" class="collapse"> + {{- result.embedded|safe -}} +</div> +{%- endif -%} + +{%- if result.abstract %}<p class="result-content result-abstract">{{ result.abstract|safe }}</p>{% 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 -%} + +<table class="result-metadata result-content"> +{%- if result.author %}<tr><td>{{ _('Author') }}</td><td>{{ result.author|safe }}</td></tr>{% endif -%} + +{%- if result.filename %}<tr><td>{{ _('Filename') }}</td><td>{{ result.filename|safe }}</td></tr>{% endif -%} + +{%- if result.size %}<tr><td>{{ _('Filesize') }}</td><td> + {%- if result.size < 1024 %}{{ result.size }} {{ _('Bytes') -}} + {%- elif result.size < 1024*1024 %}{{ '{0:0.2f}'.format(result.size/1024) }} {{ _('kiB') -}} + {%- elif result.size < 1024*1024*1024 %}{{ '{0:0.2f}'.format(result.size/1024/1024) }} {{ _('MiB') -}} + {%- elif result.size < 1024*1024*1024*1024 %}{{ '{0:0.2f}'.format(result.size/1024/1024/1024) }} {{ _('GiB') -}} + {%- else %}{{ '{0:0.2f}'.format(result.size/1024/1024/1024/1024) }} {{ _('TiB') }}{% endif -%} + </td></tr> +{%- endif -%} + +{%- if result.time %}<tr><td>{{ _('Date') }}</td><td>{{ result.time|safe }}</td></tr>{% endif -%} + +{%- if result.mtype %}<tr><td>{{ _('Type') }}</td><td>{{ result.mtype|safe }}/{{ result.subtype|safe }}</td></tr>{% endif -%} +</table> + +{%- if rtl -%} +{{ result_footer_nocache_rtl(result) }} +{%- else -%} +{{ result_footer_nocache(result) }} +{%- endif -%} diff --git a/searx/templates/oscar/result_templates/images.html b/searx/templates/oscar/result_templates/images.html index d0a3b7b..96cdd53 100644 --- a/searx/templates/oscar/result_templates/images.html +++ b/searx/templates/oscar/result_templates/images.html @@ -1,6 +1,6 @@ -{%- from 'oscar/macros.html' import draw_favicon -%} +{%- from 'oscar/macros.html' import draw_favicon with context -%} -<a href="{{ result.img_src }}" {% if results_on_new_tab %}target="_blank" rel="noopener noreferrer"{% else %}rel="noreferrer"{% endif %} data-toggle="modal" data-target="#modal-{{ index }}-{{pageno}}">{{- "" -}} +<a href="{{ result.img_src }}" {% if results_on_new_tab %}target="_blank" rel="noopener noreferrer"{% else %}rel="noreferrer"{% endif %} data-toggle="modal" data-target="#modal-{{ index }}-{{pageno}}" id="result-{{loop.index}}">{{- "" -}} <img src="{% if result.thumbnail_src %}{{ image_proxify(result.thumbnail_src) }}{% else %}{{ image_proxify(result.img_src) }}{% endif %}" alt="{{ result.title|striptags }}" title="{{ result.title|striptags }}" class="img-thumbnail">{{- "" -}} </a> <div class="modal fade" id="modal-{{ index }}-{{ pageno }}" tabindex="-1" role="dialog" aria-hidden="true">{{- "" -}} diff --git a/searx/templates/oscar/result_templates/key-value.html b/searx/templates/oscar/result_templates/key-value.html index 67c748e..9d75682 100644 --- a/searx/templates/oscar/result_templates/key-value.html +++ b/searx/templates/oscar/result_templates/key-value.html @@ -1,12 +1,12 @@ {% from 'oscar/macros.html' import result_footer, result_footer_rtl with context %} -<div class="panel panel-default"> +<div class="result result-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'] %} + {% if key in ['engine', 'engines', 'template', 'score', 'category', 'positions', 'pretty_url', 'parsed_url'] %} {% continue %} {% endif %} <tr> - <td><b>{{ key|upper }}</b>: {{ value }}</td> + <td><b>{{ key|upper }}</b>: {{ value|truncate }}</td> </tr> {% endfor %} </table> diff --git a/searx/templates/oscar/result_templates/map.html b/searx/templates/oscar/result_templates/map.html index 712375d..eb3fccf 100644 --- a/searx/templates/oscar/result_templates/map.html +++ b/searx/templates/oscar/result_templates/map.html @@ -1,72 +1,76 @@ {% from 'oscar/macros.html' import result_header, result_sub_header, result_footer, result_footer_rtl, icon %} -{{ result_header(result, favicons) }} -{{ result_sub_header(result) }} +{{- result_header(result, favicons, loop.index) -}} +{{- result_sub_header(result, loop.index) -}} -{% if (result.latitude and result.longitude) or result.boundingbox %} - <small> • <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 %} +<div class="container-fluid"> -{# {% 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="row"> + {%- if result.img_src -%}<img src="{{ image_proxify(result.img_src) }}" title="{{ result.title|striptags }}" class="img-thumbnail">{%- endif -%} -<div class="container-fluid"> + {%- if result.type_icon or result.type -%} + <p class="result-content"> + {%- if result.type_icon -%} + <img src="{{ image_proxify(result.type_icon) }}" title="{{ result.type|striptags }}" class="img-type"> + {%- endif -%} + {{ result.type if result.type is not none else '' }} + </p> + {%- endif -%} -{% 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.content %}<p class="result-content">{{ result.content|safe }}</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 class="result-content result-map-details"> + {%- if result.address -%} + <tr> + <th scope="row"> + {{ result.address_label or _('address') }} + </th> + <td class="result-content result-adress" itemscope itemtype="http://schema.org/PostalAddress"> + {%- if result.address.name -%} + <strong itemprop="name" class="hidden">{{ result.address.name }}</strong> + {%- 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 -%} + </td> + </tr> + {%- endif %} + {%- for info in result.data -%} + <tr><th scope="row">{{ info.label }}</th><td>{{ info.value|safe }}</td></tr> + {%- endfor -%} + {%- for link in result.links -%} + <tr><th scope="row">{{ link.label }}</th><td><a class="text-info cursor-pointer" href="{{ link.url }}">{{ link.url_label|safe }}</a></td></tr> + {%- endfor -%} </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 %} #} + <p class="result-content"> + {%- if (result.latitude and result.longitude) or result.boundingbox -%} + <span><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></span> + {%- endif -%} + </p> -{% if result.content %}<p class="row result-content col-xs-12 col-sm-12 col-md-12">{{ result.content|safe }}</p>{% endif %} - -</div> + </div> -{% if (result.latitude and result.longitude) or result.boundingbox %} +{%- 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 %} +{%- endif -%} -{% if rtl %} -{{ result_footer_rtl(result) }} +</div> +{%- if rtl -%} +{{- result_footer_rtl(result, loop.index) -}} {% else %} -{{ result_footer(result) }} -{% endif %} +{{- result_footer(result, loop.index) -}} +{%- endif -%} diff --git a/searx/templates/oscar/result_templates/products.html b/searx/templates/oscar/result_templates/products.html new file mode 100644 index 0000000..149e3c9 --- /dev/null +++ b/searx/templates/oscar/result_templates/products.html @@ -0,0 +1,23 @@ +{% from 'oscar/macros.html' import draw_favicon, icon, result_header, result_sub_header, result_footer_rtl, result_footer %} + +{{ result_header(result, favicons) }} +{{ result_sub_header(result) }} + +<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-3 col-md-3 result-content" src="{{ image_proxify(result.thumbnail) }}" alt="{{ result.title|striptags }} {{ result.engine }}" /></a> + <p class="col-xs-12 col-sm-9 col-md-9 result-content"> + {% if result.price %}<big>{{ result.price|safe }}</big></br>{% endif %} + {% if result.shipping %}<small>{{ result.shipping|safe }}</small></br>{% endif %} + {% if result.source_country %}<small>{{ result.source_country|safe }}</small></br>{% endif %} + {% if result.content %}{{ result.content|safe }}{% endif %} + {% if result.has_stock is defined %}<br>{% if result.has_stock %}{{ icon('check', _('Has stock')) }}{% else %}{{ icon('alert', _('Out of stock')) }}{% endif %}{% endif %} + </p> + </div> +</div> + +{% 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 089367e..9f66715 100644 --- a/searx/templates/oscar/result_templates/torrent.html +++ b/searx/templates/oscar/result_templates/torrent.html @@ -1,25 +1,25 @@ {% from 'oscar/macros.html' import result_header, result_sub_header, result_footer, result_footer_rtl, icon %} -{{ result_header(result, favicons) }} -{{ result_sub_header(result) }} +{{- result_header(result, favicons, loop.index) -}} +{{- result_sub_header(result, loop.index) -}} -{% if result.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') }} +{%- 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') }} - {% elif result.filesize < 1024*1024 %}{{ '{0:0.2f}'.format(result.filesize/1024) }} {{ _('kiB') }} - {% elif result.filesize < 1024*1024*1024 %}{{ '{0:0.2f}'.format(result.filesize/1024/1024) }} {{ _('MiB') }} - {% elif result.filesize < 1024*1024*1024*1024 %}{{ '{0:0.2f}'.format(result.filesize/1024/1024/1024) }} {{ _('GiB') }} - {% else %}{{ '{0:0.2f}'.format(result.filesize/1024/1024/1024/1024) }} {{ _('TiB') }}{% endif %} - </span>{% endif %} -{% if result.files %}<br />{{ icon('file') }} {{ _('Number of Files') }} <span class="badge">{{ result.files }}</span>{% endif %} + {%- if result.filesize < 1024 %}{{ result.filesize }} {{ _('Bytes') -}} + {%- elif result.filesize < 1024*1024 %}{{ '{0:0.2f}'.format(result.filesize/1024) }} {{ _('kiB') -}} + {%- elif result.filesize < 1024*1024*1024 %}{{ '{0:0.2f}'.format(result.filesize/1024/1024) }} {{ _('MiB') -}} + {%- elif result.filesize < 1024*1024*1024*1024 %}{{ '{0:0.2f}'.format(result.filesize/1024/1024/1024) }} {{ _('GiB') -}} + {%- else %}{{ '{0:0.2f}'.format(result.filesize/1024/1024/1024/1024) }} {{ _('TiB') }}{% endif -%} + </span>{% endif -%} +{%- if result.files %}<br />{{ icon('file') }} {{ _('Number of Files') }} <span class="badge">{{ result.files }}</span>{% endif -%} -{% if result.content %}<br />{{ result.content|safe }}{% endif %} +{%- if result.content %}<br />{{ result.content|safe }}{% endif -%} </p> -{% if rtl %} -{{ result_footer_rtl(result) }} -{% else %} -{{ result_footer(result) }} -{% endif %} +{%- if rtl -%} +{{ result_footer_rtl(result, loop.index) }} +{%- else -%} +{{ result_footer(result, loop.index) }} +{%- endif -%} diff --git a/searx/templates/oscar/result_templates/videos.html b/searx/templates/oscar/result_templates/videos.html index 3c1913d..ad17ffe 100644 --- a/searx/templates/oscar/result_templates/videos.html +++ b/searx/templates/oscar/result_templates/videos.html @@ -1,27 +1,29 @@ {% from 'oscar/macros.html' import result_header, result_sub_header, result_footer, result_footer_rtl, icon %} -{{ result_header(result, favicons) }} -{{ result_sub_header(result) }} +{{- result_header(result, favicons, loop.index) -}} +{{- result_sub_header(result, loop.index) -}} -{% if result.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 -%} + <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') }}" aria-labelledby="result-{{loop.index}}">{{ icon('film') }} {{ _('show video') }}</a></small> +{%- endif -%} -{% if result.embedded %} +{%- if result.embedded -%} <div id="result-video-{{ index }}" class="collapse"> - {{ result.embedded|safe }} + {{- result.embedded|safe -}} </div> -{% endif %} +{%- 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 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) }}" aria-labelledby="result-{{loop.index}}" /></a> + {%- if result.author %}<p class="col-xs-12 col-sm-8 col-md-8 result-content"><b>{{ _('Author') }}</b>: {{ result.author }}</p>{% endif -%} + {%- if result.length %}<p class="col-xs-12 col-sm-8 col-md-8 result-content"><b>{{ _('Length') }}</b>: {{ result.length }}</p>{% endif -%} + {%- 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 %} +{%- if rtl -%} +{{ result_footer_rtl(result, loop.index) }} +{%- else -%} +{{ result_footer(result, loop.index) }} +{%- endif -%} diff --git a/searx/templates/oscar/results.html b/searx/templates/oscar/results.html index 43e3e26..df2d424 100644 --- a/searx/templates/oscar/results.html +++ b/searx/templates/oscar/results.html @@ -7,7 +7,14 @@ <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 -%} +{% macro engine_data_form(engine_data) -%} + {% for engine_name, kv_data in engine_data.items() %} + {% for k, v in kv_data.items() %} + <input type="hidden" name="engine_data-{{ engine_name }}-{{ k|e }}" value="{{ v|e }}" /> + {% endfor %} + {% endfor %} +{%- endmacro %} +{%- macro search_url() %}{{ url_for('search', _external=True) }}?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 %} @@ -42,7 +49,13 @@ </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"> + <form method="{{ method or 'POST' }}" action="{{ url_for('search') }}" role="navigation" class="form-inline pull-{% if rtl %}right{% else %}left{% endif %} suggestion_item"> + {% if current_language != 'all' %} + <input type="hidden" name="language" value="{{ current_language }}"> + {% endif %} + {% if time_range %} + <input type="hidden" name="time_range" value="{{ time_range }}"> + {% endif %} <input type="hidden" name="q" value="{{ suggestion.url }}"> <button type="submit" class="btn btn-default btn-xs">{{ suggestion.title }}</button> </form> @@ -51,7 +64,7 @@ </div> {%- endif %} - <div class="panel panel-default"> + <div class="panel panel-default hidden-xs"> <div class="panel-heading">{{- "" -}} <h4 class="panel-title">{{ _('Links') }}</h4>{{- "" -}} </div> @@ -65,13 +78,15 @@ <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"> + <form method="{{ method or 'POST' }}" action="{{ url_for('search') }}" 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> + <br /><label><a href="{{ search_url() }}&format=rss">{{ _('RSS subscription') }}</a></label> + <div class="clearfix"></div> </div> </div> </div><!-- /#sidebar_results --> @@ -81,26 +96,38 @@ {% 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 class="clearfix"> + <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('search') }}" role="navigation" class="form-inline pull-left suggestion_item">{{- "" -}} + {% if current_language != 'all' %} + <input type="hidden" name="language" value="{{ current_language }}"> + {% endif %} + {% if time_range %} + <input type="hidden" name="time_range" value="{{ time_range }}"> + {% endif %} + <input type="hidden" name="q" value="{{ correction.url }}">{{- "" -}} + <button type="submit" class="btn btn-default btn-xs">{{ correction.title }}</button>{{- "" -}} + </form> + {% endfor %} + </div> </div> {%- endif %} {% if answers -%} - {%- for answer in answers %} + {%- for answer in answers.values() %} <div class="result well"> - <span>{{ answer }}</span> + {% if answer.url %} + <a href="{{ answer.url }}">{{ answer.answer }}</a> + {% else %} + <span>{{ answer.answer }}</span> + {% endif %} </div> {%- endfor %} {%- endif %} {% 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 %}{% for e in result.engines %} {{ e }}{% endfor %}"> {%- set index = loop.index -%} {%- if result.template -%} {% include get_result_template('oscar', result['template']) %} @@ -120,14 +147,16 @@ {% if rtl %} <div id="pagination"> <div class="pull-left">{{- "" -}} - <form method="{{ method or 'POST' }}" action="{{ url_for('index') }}" class="pull-left"> + <form method="{{ method or 'POST' }}" action="{{ url_for('search') }}" class="pull-left"> {{- search_form_attrs(pageno+1) -}} + {{- engine_data_form(engine_data) -}} <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"> + <form method="{{ method or 'POST' }}" action="{{ url_for('search') }}" class="pull-left"> {{- search_form_attrs(pageno-1) -}} + {{- engine_data_form(engine_data) -}} <button type="submit" class="btn btn-default" {% if pageno == 1 %}disabled{% endif %}><span class="glyphicon glyphicon-forward"></span> {{ _('previous page') }}</button>{{- "" -}} </form>{{- "" -}} </div> @@ -136,14 +165,16 @@ {% else %} <div id="pagination"> <div class="pull-left">{{- "" -}} - <form method="{{ method or 'POST' }}" action="{{ url_for('index') }}" class="pull-left"> + <form method="{{ method or 'POST' }}" action="{{ url_for('search') }}" class="pull-left"> {{- search_form_attrs(pageno-1) -}} + {{- engine_data_form(engine_data) -}} <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"> + <form method="{{ method or 'POST' }}" action="{{ url_for('search') }}" class="pull-left"> {{- search_form_attrs(pageno+1) -}} + {{- engine_data_form(engine_data) -}} <button type="submit" class="btn btn-default"><span class="glyphicon glyphicon-forward"></span> {{ _('next page') }}</button>{{- "" -}} </form>{{- "" -}} </div> diff --git a/searx/templates/oscar/search.html b/searx/templates/oscar/search.html index cad9eca..841e48e 100644 --- a/searx/templates/oscar/search.html +++ b/searx/templates/oscar/search.html @@ -1,11 +1,12 @@ {% from 'oscar/macros.html' import icon %} -<form method="{{ method or 'POST' }}" action="{{ url_for('index') }}" id="search_form" role="search"> +<form method="{{ method or 'POST' }}" action="{{ url_for('search') }}" 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"> + <input type="search" {% if autofocus %}autofocus{% endif %} 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> + <button type="button" id="clear_search" class="btn btn-default hide_if_nojs" aria-label="{{ _('Clear search') }}">{{ icon('remove') }}</button> </span> </div> </div> diff --git a/searx/templates/oscar/search_full.html b/searx/templates/oscar/search_full.html index 6564631..d398230 100644 --- a/searx/templates/oscar/search_full.html +++ b/searx/templates/oscar/search_full.html @@ -1,14 +1,15 @@ {% from 'oscar/macros.html' import icon %} -<form method="{{ method or 'POST' }}" action="{{ url_for('index') }}" id="search_form" role="search"> +<form method="{{ method or 'POST' }}" action="{{ url_for('search') }}" 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"> + <input type="search" autofocus 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> + <button type="reset" class="btn btn-default input-lg" aria-label="{{ _('Clear search') }}"><span class="hide_if_nojs">{{ icon('remove') }}</span><span class="hidden active_if_nojs">{{ _('Clear') }}</span></button> </span> </div> <div class="col-md-8 col-md-offset-2 advanced"> diff --git a/searx/templates/oscar/time-range.html b/searx/templates/oscar/time-range.html index fb1c075..6087dd4 100644 --- a/searx/templates/oscar/time-range.html +++ b/searx/templates/oscar/time-range.html @@ -1,4 +1,6 @@ -<select name="time_range" id="time-range" class="custom-select form-control" accesskey="t">{{- "" -}} +{% from 'oscar/macros.html' import custom_select_class %} +<label class="visually-hidden" for="time-range">{{ _('Time range') }}</label> +<select name="time_range" id="time-range" class="{{ custom_select_class(rtl) }} form-control" accesskey="t">{{- "" -}} <option id="time-range-anytime" value="" {{ "selected" if time_range=="" or not time_range else ""}}> {{- _('Anytime') -}} </option>{{- "" -}} diff --git a/searx/templates/pix-art/404.html b/searx/templates/pix-art/404.html deleted file mode 100644 index 389bb5e..0000000 --- a/searx/templates/pix-art/404.html +++ /dev/null @@ -1,9 +0,0 @@ -{% extends "pix-art/base.html" %} -{% block content %} -<div class="center"> - <h1>{{ _('Page not found') }}</h1> - {% autoescape false %} - <p>{{ _('Go to %(search_page)s.', search_page=unicode('<a href="{}">{}</a>').format(url_for('index'), _('search page'))) }}</p> - {% endautoescape %} -</div> -{% endblock %} diff --git a/searx/templates/pix-art/about.html b/searx/templates/pix-art/about.html deleted file mode 100644 index f76a689..0000000 --- a/searx/templates/pix-art/about.html +++ /dev/null @@ -1,4 +0,0 @@ -{% extends 'pix-art/base.html' %} -{% block content %} -{% include '__common__/about.html' %} -{% endblock %} diff --git a/searx/templates/pix-art/base.html b/searx/templates/pix-art/base.html deleted file mode 100644 index 6af8823..0000000 --- a/searx/templates/pix-art/base.html +++ /dev/null @@ -1,35 +0,0 @@ -<!DOCTYPE html> -<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en"{% if rtl %} dir="rtl"{% endif %}> - <head> - <meta charset="UTF-8" /> - <meta name="description" content="searx - a privacy-respecting, hackable metasearch engine" /> - <meta name="keywords" content="searx, search, search engine, metasearch, meta search" /> - <meta name="generator" content="searx/{{ searx_version }}"> - <meta name="referrer" content="no-referrer"> - <meta name="viewport" content="width=device-width, maximum-scale=1.0, user-scalable=1" /> - <title>{% block title %}{% endblock %}searx</title> - <link rel="stylesheet" href="{{ url_for('static', filename='css/style.css') }}" type="text/css" media="screen" /> - <link rel="shortcut icon" href="{{ url_for('static', filename='img/favicon.png') }}?v=2" /> - {% block styles %} - {% endblock %} - {% block meta %}{% endblock %} - {% block head %} - {% endblock %} - <script type="text/javascript"> - var favicons = [[]]; - </script> - </head> - <body> - <div id="container"> - {% block content %} - {% endblock %} - <script type="text/javascript"> - searx = {}; - </script> - <script src="{{ url_for('static', filename='js/searx.js') }}" ></script> - <script type="text/javascript"> - load_images(1); - </script> - </div> - </body> -</html> diff --git a/searx/templates/pix-art/index.html b/searx/templates/pix-art/index.html deleted file mode 100644 index a0c61f9..0000000 --- a/searx/templates/pix-art/index.html +++ /dev/null @@ -1,12 +0,0 @@ -{% extends "pix-art/base.html" %} -{% block content %} -<div class="center"> - <div class="title"><h1><img src="{{ url_for('static', filename='img/searx-pixel.png') }}" alt="searx Logo"/></h1></div> - {% include 'pix-art/search.html' %} - <p class="top_margin"> - <a href="{{ url_for('about') }}" class="hmarg">{{ _('about') }}</a> - <a href="{{ url_for('preferences') }}" class="hmarg">{{ _('preferences') }}</a> - </p> -</div> -{% endblock %} - diff --git a/searx/templates/pix-art/preferences.html b/searx/templates/pix-art/preferences.html deleted file mode 100644 index 05876de..0000000 --- a/searx/templates/pix-art/preferences.html +++ /dev/null @@ -1,82 +0,0 @@ -{% extends "legacy/base.html" %} -{% block head %} {% endblock %} -{% block content %} -<div class="row"> - <h2>{{ _('Preferences') }}</h2> - - <form method="post" action="{{ url_for('preferences') }}" id="search_form"> - <fieldset> - <legend>{{ _('Search language') }}</legend> - <p> - <select name='language'> - <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> - </p> - </fieldset> - <fieldset> - <legend>{{ _('Interface language') }}</legend> - <p> - <select name='locale'> - {% for locale_id,locale_name in locales.items() | sort %} - <option value="{{ locale_id }}" {% if locale_id == current_locale %}selected="selected"{% endif %}>{{ locale_name }}</option> - {% endfor %} - </select> - </p> - </fieldset> - <fieldset> - <legend>{{ _('Method') }}</legend> - <p> - <select name='method'> - <option value="POST" {% if method == 'POST' %}selected="selected"{% endif %}>POST</option> - <option value="GET" {% if method == 'GET' %}selected="selected"{% endif %}>GET</option> - </select> - </p> - </fieldset> - <fieldset> - <legend>{{ _('Themes') }}</legend> - <p> - <select name="theme"> - {% for name in themes %} - <option value="{{ name }}" {% if name == theme %}selected="selected"{% endif %}>{{ name }}</option> - {% endfor %} - </select> - </p> - </fieldset> - <fieldset> - <legend>{{ _('Currently used search engines') }}</legend> - - <table> - <tr> - <th>{{ _('Engine name') }}</th> - <th>{{ _('Allow') }} / {{ _('Block') }}</th> - </tr> - {% for categ in all_categories %} - {% for search_engine in engines_by_category[categ] %} - - {% if not search_engine.private %} - <tr> - <td>{{ search_engine.name }} ({{ shortcuts[search_engine.name] }})‎</td> - <td class="engine_checkbox"> - <input type="checkbox" id="engine_{{ categ|replace(' ', '_') }}_{{ search_engine.name|replace(' ', '_') }}" name="engine_{{ search_engine.name }}__{{ categ }}"{% if (search_engine.name, categ) in disabled_engines %} checked="checked"{% endif %} /> - <label class="allow" for="engine_{{ categ|replace(' ', '_') }}_{{ search_engine.name|replace(' ', '_') }}">{{ _('Allow') }}</label> - <label class="deny" for="engine_{{ categ|replace(' ', '_') }}_{{ search_engine.name|replace(' ', '_') }}">{{ _('Block') }}</label> - </td> - </tr> - {% endif %} - {% endfor %} - {% endfor %} - </table> - </fieldset> - <p class="small_font">{{ _('These settings are stored in your cookies, this allows us not to store this data about you.') }} - <br /> - {{ _("These cookies serve your sole convenience, we don't use these cookies to track you.") }} - </p> - - <input type="submit" value="{{ _('save') }}" /> - <div class="{% if rtl %}left{% else %}right{% endif %} preferences_back"><a href="{{ url_for('index') }}">{{ _('back') }}</a></div> - </form> -</div> -{% endblock %} diff --git a/searx/templates/pix-art/result_templates/default.html b/searx/templates/pix-art/result_templates/default.html deleted file mode 100644 index ada81e5..0000000 --- a/searx/templates/pix-art/result_templates/default.html +++ /dev/null @@ -1,7 +0,0 @@ -<a href="{{ result.url }}" title="{{ result.title | striptags }}" rel="noreferrer"> - <canvas id="canvas-{{ pageno }}-{{ index }}" class="icon" width="16" height="16"></canvas> -</a> -<script type="text/javascript"> -favicons[{{ pageno }}][{{ index }}] = 'http://{{ result.url | extract_domain }}/favicon.ico'; -</script> - diff --git a/searx/templates/pix-art/result_templates/images.html b/searx/templates/pix-art/result_templates/images.html deleted file mode 100644 index d85f841..0000000 --- a/searx/templates/pix-art/result_templates/images.html +++ /dev/null @@ -1,6 +0,0 @@ -<div class="image_result"> - <p> - <a href="{{ result.img_src }}" rel="noreferrer"><img src="{% if result.thumbnail_src %}{{ image_proxify(result.thumbnail_src) }}{% else %}{{ image_proxify(result.img_src) }}{% endif %}" title="{{ result.title|striptags }}" alt="{{ result.title|striptags }}" /></a> - <span class="url"><a href="{{ result.url }}" rel="noreferrer" class="small_font">{{ _('original context') }}</a></span> - </p> -</div> diff --git a/searx/templates/pix-art/results.html b/searx/templates/pix-art/results.html deleted file mode 100644 index 8999e05..0000000 --- a/searx/templates/pix-art/results.html +++ /dev/null @@ -1,32 +0,0 @@ -{% if pageno > 1 %} - {% for result in results %} - {% set index = loop.index %} - {% include 'pix-art/result_templates/default.html' %} - {% endfor %} -{% else %} -{% extends "pix-art/base.html" %} -{% block title %}{{ q|e }} - {% endblock %} -{% block meta %}{% endblock %} -{% block content %} -<div id="logo"><a href="./"><img src="{{ url_for('static', filename='img/searx-pixel-small.png') }}" alt="searx Logo"/></a></div> -<div class="preferences_container right"><a href="{{ url_for('preferences') }}" id="preferences"><span>preferences</span></a></div> -<div class="small search center"> - {% include 'pix-art/search.html' %} -</div> -<script type="text/javascript"> - favicons[{{ pageno }}] = []; -</script> -<div id="results"> - <span id="results_list"> - {% for result in results %} - {% set index = loop.index %} - {% include 'pix-art/result_templates/default.html' %} - {% endfor %} - </span> - <div id="pagination"> - <br /> - <input type="button" onclick="load_more('{{ q|e }}', {{ pageno+1 }})" id="load_more" value="{{ _('Load more...') }}" /> - </div> -</div> -{% endblock %} -{% endif %} diff --git a/searx/templates/pix-art/search.html b/searx/templates/pix-art/search.html deleted file mode 100644 index 4d129ec..0000000 --- a/searx/templates/pix-art/search.html +++ /dev/null @@ -1,9 +0,0 @@ -<form method="{{ method or 'POST' }}" action="{{ url_for('index') }}" id="search_form"> - <div id="search_wrapper"> - <input type="text" placeholder="{{ _('Search for...') }}" id="q" class="q" name="q" tabindex="1" size="100" {% if q %}value="{{ q }}"{% endif %}/> - <input type="submit" value="" id="search_submit" /> - {% for category in categories %} - <input type="hidden" name="category_{{ category }}" value="1"/> - {% endfor %} - </div> -</form> diff --git a/searx/templates/pix-art/stats.html b/searx/templates/pix-art/stats.html deleted file mode 100644 index 372447e..0000000 --- a/searx/templates/pix-art/stats.html +++ /dev/null @@ -1,22 +0,0 @@ -{% extends "legacy/base.html" %} -{% block head %} {% endblock %} -{% block content %} -<h2>{{ _('Engine stats') }}</h2> - -{% for stat_name,stat_category in stats %} -<div class="left"> - <table> - <tr colspan="3"> - <th>{{ stat_name }}</th> - </tr> - {% for engine in stat_category %} - <tr> - <td>{{ engine.name }}</td> - <td>{{ '%.02f'|format(engine.avg) }}</td> - <td class="percentage"><div style="width: {{ engine.percentage }}%"> </div></td> - </tr> - {% endfor %} - </table> -</div> -{% endfor %} -{% endblock %} diff --git a/searx/templates/simple/404.html b/searx/templates/simple/404.html index 11d6043..1a10514 100644 --- a/searx/templates/simple/404.html +++ b/searx/templates/simple/404.html @@ -3,7 +3,7 @@ <div class="center"> <h1>{{ _('Page not found') }}</h1> {% autoescape false %} - <p>{{ _('Go to %(search_page)s.', search_page=unicode('<a href="{}">{}</a>').format(url_for('index'), _('search page'))) }}</p> + <p>{{ _('Go to %(search_page)s.', search_page='<a href="{}">{}</a>'.format(url_for('index'), _('search page'))) }}</p> {% endautoescape %} </div> {% endblock %} diff --git a/searx/templates/simple/base.html b/searx/templates/simple/base.html index 92597b6..17c9785 100644 --- a/searx/templates/simple/base.html +++ b/searx/templates/simple/base.html @@ -2,7 +2,7 @@ <html class="no-js" lang="en" {% if rtl %} dir="rtl"{% endif %}> <head> <meta charset="UTF-8" /> - <meta name="description" content="searx - a privacy-respecting, hackable metasearch engine"> + <meta name="description" content="searx — a privacy-respecting, hackable metasearch engine"> <meta name="keywords" content="searx, search, search engine, metasearch, meta search"> <meta name="generator" content="searx/{{ searx_version }}"> <meta name="referrer" content="no-referrer"> @@ -25,14 +25,14 @@ data-search-on-category-select="{{ 'true' if 'plugins/js/search_on_category_select.js' in scripts else 'false'}}" data-infinite-scroll="{{ 'true' if 'plugins/js/infinite_scroll.js' in scripts else 'false' }}" data-static-path="{{ url_for('static', filename='themes/simple') }}/" - data-no-item-found="{{ _('No item found') }}"></script> + data-translations="{{ translations }}"></script> <!--<![endif]--> {% block head %} - <link title="{{ instance_name }}" type="application/opensearchdescription+xml" rel="search" href="{{ url_for('opensearch') }}"/> + <link title="{{ instance_name }}" type="application/opensearchdescription+xml" rel="search" href="{{ opensearch_url }}"/> {% endblock %} <link rel="shortcut icon" href="{{ url_for('static', filename='img/favicon.png') }}" /> </head> -<body> +<body class="{{ endpoint }}_endpoint" > <main id="main_{{ self._TemplateReference__context.name|replace("simple/", "")|replace(".html", "") }}"> {% if errors %} <div class="dialog-error" role="alert"> @@ -50,10 +50,11 @@ </main> <footer> <p> - {{ _('Powered by') }} <a href="{{ url_for('about') }}">searx</a> - {{ searx_version }} - {{ _('a privacy-respecting, hackable metasearch engine') }}<br/> - <a href="https://github.com/asciimoo/searx">{{ _('Source code') }}</a> | - <a href="https://github.com/asciimoo/searx/issues">{{ _('Issue tracker') }}</a> | - <a href="https://github.com/asciimoo/searx/wiki/Searx-instances">{{ _('Public instances') }}</a> + {{ _('Powered by') }} <a href="{{ url_for('about') }}">searx</a> - {{ searx_version }} — {{ _('a privacy-respecting, hackable metasearch engine') }}<br/> + <a href="{{ brand.GIT_URL }}">{{ _('Source code') }}</a> | + <a href="{{ brand.ISSUE_URL }}">{{ _('Issue tracker') }}</a> | + <a href="{{ brand.PUBLIC_INSTANCES }}">{{ _('Public instances') }}</a>{% if brand.CONTACT_URL %} | + <a href="{{ brand.CONTACT_URL }}">{{ _('Contact instance maintainer') }}</a>{% endif %} </p> </footer> <!--[if gte IE 9]>--> diff --git a/searx/templates/simple/categories.html b/searx/templates/simple/categories.html index 127d55b..6724d06 100644 --- a/searx/templates/simple/categories.html +++ b/searx/templates/simple/categories.html @@ -1,7 +1,7 @@ <div id="categories">{{- '' -}} <div id="categories_container"> {%- for category in categories -%} - <div class="category"><input type="checkbox" id="checkbox_{{ category|replace(' ', '_') }}" name="category_{{ category }}"{% if category in selected_categories %} checked="checked"{% endif %}/><label for="checkbox_{{ category|replace(' ', '_') }}" class="tooltips">{{ _(category) }}</label></div> + <div class="category"><a><input type="checkbox" id="checkbox_{{ category|replace(' ', '_') }}" name="category_{{ category }}"{% if category in selected_categories %} checked="checked"{% endif %}/><label for="checkbox_{{ category|replace(' ', '_') }}" class="tooltips">{{ _(category) }}</label></a></div> {%- endfor -%} {%- if display_tooltip %}<div class="help">{{ _('Click on the magnifier to perform search') }}</div>{% endif -%} </div>{{- '' -}} diff --git a/searx/templates/simple/infobox.html b/searx/templates/simple/infobox.html index 50b5689..56c51af 100644 --- a/searx/templates/simple/infobox.html +++ b/searx/templates/simple/infobox.html @@ -1,7 +1,6 @@ <aside class="infobox"> <h2><bdi>{{ infobox.infobox }}</bdi></h2> {% if infobox.img_src %}<img src="{{ image_proxify(infobox.img_src) }}" title="{{ infobox.infobox|striptags }}" alt="{{ infobox.infobox|striptags }}" />{% endif %} - <p><bdi>{{ infobox.entity }}</bdi></p> <p><bdi>{{ infobox.content | safe }}</bdi></p> {% if infobox.attributes %} <div class="attributes"> @@ -34,7 +33,7 @@ <div> <h3><bdi>{{ topic.name }}</bdi></h3> {% for suggestion in topic.suggestions %} - <form method="{{ method or 'POST' }}" action="{{ url_for('index') }}"> + <form method="{{ method or 'POST' }}" action="{{ url_for('search') }}"> <input type="hidden" name="q" value="{{ suggestion }}"> <input type="hidden" name="time_range" value="{{ time_range }}"> <input type="hidden" name="language" value="{{ current_language }}"> diff --git a/searx/templates/simple/macros.html b/searx/templates/simple/macros.html index f0b3627..1eb4266 100644 --- a/searx/templates/simple/macros.html +++ b/searx/templates/simple/macros.html @@ -1,6 +1,6 @@ <!-- Draw glyphicon icon from bootstrap-theme --> -{% macro icon(action) -%} - <span class="ion-icon-big ion-{{ action }}"></span> +{% macro icon(action, alt) -%} + <span title="{{ alt }}" class="ion-icon-big ion-{{ action }}"></span> {%- endmacro %} {% macro icon_small(action) -%} @@ -26,7 +26,7 @@ <!-- Draw result header --> {% macro result_header(result, favicons, image_proxify) -%} -<article class="result {% if result['template'] %}result-{{ result.template|replace('.html', '') }}{% else %}result-default{% endif %} {% if result['category'] %}category-{{ result['category'] }}{% endif %}"> +<article class="result {% if result['template'] %}result-{{ result.template|replace('.html', '') }}{% else %}result-default{% endif %} {% if result['category'] %}category-{{ result['category'] }}{% endif %}{% for e in result.engines %} {{ e }}{% endfor %}"> {%- if result.img_src %}{{ result_open_link(result.url) }}<img class="image" src="{{ image_proxify(result.img_src) }}" alt="{{ result.title|striptags }}" title="{{ result.title|striptags }}" class="image" />{{ result_close_link() }}{% endif -%} {%- if result.thumbnail %}{{ result_open_link(result.url) }}<img class="thumbnail" src="{{ image_proxify(result.thumbnail) }}" title="{{ result.title|striptags }}" alt="{{ result.title|striptags }}"/>{{ result_close_link() }}{% endif -%} <h3>{{ result_link(result.url, result.title|safe) }}</h3> diff --git a/searx/templates/simple/messages/no_results.html b/searx/templates/simple/messages/no_results.html index fa984b0..df75ef2 100644 --- a/searx/templates/simple/messages/no_results.html +++ b/searx/templates/simple/messages/no_results.html @@ -7,7 +7,7 @@ {{ engine_name }} ({{ error_type }}){% if not loop.last %}, {% endif %} {% endfor %} </p> - <p><small>{{ _('Please, try again later or find another searx instance.') }}</small></p> + <p><small>{{ _('Please, try again later or find another searx instance.') }} (<a href="{{ brand.PUBLIC_INSTANCES }}">{{ _('Public instances') }}</a>) </small></p> </div> {% else %} <div class="dialog-error" role="alert"> diff --git a/searx/templates/simple/preferences.html b/searx/templates/simple/preferences.html index 7437ed4..a0ed779 100644 --- a/searx/templates/simple/preferences.html +++ b/searx/templates/simple/preferences.html @@ -1,4 +1,4 @@ -{% from 'simple/macros.html' import tabs_open, tabs_close, tab_header, tab_footer, checkbox_onoff, checkbox %} +{% from 'simple/macros.html' import icon, tabs_open, tabs_close, tab_header, tab_footer, checkbox_onoff, checkbox %} {% extends "simple/base.html" %} @@ -18,6 +18,17 @@ {%- endfor -%} {%- endmacro -%} +{% macro engine_about(search_engine) -%} +{% if search_engine.about is defined %} +{% set about = search_engine.about %} +<div class="engine-tooltip" role="tooltip">{{- "" -}} + <p><a href="{{about.website}}" rel="noreferrer">{{about.website}}</a></p> + {%- if about.wikidata_id -%}<p><a href="https://www.wikidata.org/wiki/{{about.wikidata_id}}" rel="noreferrer">wikidata.org/wiki/{{about.wikidata_id}}</a></p>{%- endif -%} + {%- if search_engine.enable_http %}<p>{{ icon('exclamation-sign', 'No HTTPS') }}{{ _('No HTTPS')}}</p>{% endif -%} +</div> +{%- endif -%} +{%- endmacro %} + {% block head %} {% endblock %} {% block content %} @@ -30,11 +41,14 @@ {{ tabs_open() }} {{ tab_header('maintab', 'general', _('General')) }} + {% if 'categories' not in locked_preferences %} <fieldset> <legend>{{ _('Default categories') }}</legend> {% set display_tooltip = false %} {% include 'simple/categories.html' %} </fieldset> + {% endif %} + {% if 'language' not in locked_preferences %} <fieldset> <legend>{{ _('Search language') }}</legend> <p class="value">{{- '' -}} @@ -47,6 +61,8 @@ </p> <div class="description">{{ _('What language do you prefer for search?') }}</div> </fieldset> + {% endif %} + {% if 'autocomplete' not in locked_preferences %} <fieldset> <legend>{{ _('Autocomplete') }}</legend> <p class="value"> @@ -59,6 +75,8 @@ </p> <div class="description">{{ _('Find stuff as you type') }}</div> </fieldset> + {% endif %} + {% if 'safesearch' not in locked_preferences %} <fieldset> <legend>{{ _('SafeSearch') }}</legend> <p class="value"> @@ -70,13 +88,15 @@ </p> <p class="description">{{ _('Filter content') }}</p> </fieldset> + {% endif %} {{ plugin_preferences('general') }} + {% if 'doi_resolver' not in locked_preferences %} <fieldset> <legend>{{ _('Open Access DOI resolver') }}</legend> <p class="value"> <select id='doi_resolver' name='doi_resolver'> {%- for doi_resolver_name,doi_resolver_url in doi_resolvers.items() -%} - <option value="{{ doi_resolver_name }}" {% if doi_resolver_name == current_doi_resolver %}selected="selected"{% endif %}> + <option value="{{ doi_resolver_name }}" {% if doi_resolver_url == current_doi_resolver %}selected="selected"{% endif %}> {{- doi_resolver_name }} - {{ doi_resolver_url -}} </option> {%- endfor -%} @@ -84,6 +104,7 @@ </p> <div class="description"><!-- {{ _('Redirect to open-access versions of publications when available (plugin required)') }} --></div> </fieldset> + {% endif %} {{ tab_footer() }} {{ tab_header('maintab', 'engines', _('Engines')) }} @@ -111,7 +132,7 @@ {% set engine_id = 'engine_' + search_engine.name|replace(' ', '_') + '__' + categ|replace(' ', '_') %} <tr> <td class="engine_checkbox">{{ checkbox_onoff(engine_id, (search_engine.name, categ) in disabled_engines) }}</td> - <th class="name">{{ search_engine.name }}</th> + <th class="name">{% if search_engine.enable_http %}{{ icon('warning', 'No HTTPS') }}{% endif %} {{ search_engine.name }} {{ engine_about(search_engine) }}</th> <td class="shortcut">{{ shortcuts[search_engine.name] }}</td> <td>{{ checkbox(engine_id + '_supported_languages', current_language == 'all' or current_language in search_engine.supported_languages or current_language.split('-')[0] in search_engine.supported_languages, true, true) }}</td> <td>{{ checkbox(engine_id + '_safesearch', search_engine.safesearch==True, true, true) }}</td> @@ -129,6 +150,7 @@ {{ tab_footer() }} {{ tab_header('maintab', 'ui', _('User interface')) }} + {% if 'locale' not in locked_preferences %} <fieldset> <legend>{{ _('Interface language') }}</legend> <p class="value"> @@ -140,6 +162,8 @@ </p> <div class="description">{{ _('Change the language of the layout') }}</div> </fieldset> + {% endif %} + {% if 'theme' not in locked_preferences %} <fieldset> <legend>{{ _('Themes') }}</legend> <p class="value"> @@ -151,6 +175,8 @@ </p> <div class="description">{{ _('Change searx layout') }}</div> </fieldset> + {% endif %} + {% if 'results_on_new_tab' not in locked_preferences %} <fieldset> <legend>{{ _('Results on new tabs') }}</legend> <p class="value"> @@ -161,6 +187,19 @@ </p> <div class="description">{{_('Open result links on new browser tabs') }}</div> </fieldset> + {% endif %} + {% if 'autofocus' not in locked_preferences %} + <fieldset> + <legend>{{ _('Autofocus search field') }}</legend> + <p class="value"> + <select name='autofocus'> + <option value="1" {% if autofocus %}selected="selected"{% endif %}>{{ _('On') }}</option> + <option value="0" {% if not autofocus %}selected="selected"{% endif %}>{{ _('Off')}}</option> + </select> + </p> + <div class="description">{{_('Turn off if you use your keyboard to scroll') }}</div> + </fieldset> + {% endif %} {{ plugin_preferences('ui') }} {{ tab_footer() }} @@ -197,6 +236,7 @@ {{ tab_footer() }} {{ tab_header('maintab', 'privacy', _('Privacy')) }} + {% if 'method' not in locked_preferences %} <fieldset> <legend>{{ _('Method') }}</legend> <p class="value"> @@ -207,6 +247,8 @@ </p> <div class="description">{{ _('Search language') }}</div> </fieldset> + {% endif %} + {% if 'image_proxy' not in locked_preferences %} <fieldset> <legend>{{ _('Image proxy') }}</legend> <p class="value"> @@ -217,6 +259,7 @@ </p> <div class="description">{{ _('Proxying image results through searx') }}</div> </fieldset> + {% endif %} {{ plugin_preferences('privacy') }} {{ tab_footer() }} diff --git a/searx/templates/simple/result_templates/map.html b/searx/templates/simple/result_templates/map.html index 2de4451..8b08bda 100644 --- a/searx/templates/simple/result_templates/map.html +++ b/searx/templates/simple/result_templates/map.html @@ -3,64 +3,47 @@ {{ result_header(result, favicons, image_proxify) -}} {{- result_sub_header(result) -}} -{%- if (result.latitude and result.longitude) or result.boundingbox -%} - <small> • <a class="btn-collapse collapsed searx_init_map hide_if_nojs" data-target="#result-map-{{ index }}" data-btn-text-collapsed="{{ _('show map') }}" data-btn-text-not-collapsed="{{ _('hide map') }}" 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 %}>{{ icon( 'globe') }} {{ _('show map') }}</a></small> -{%- endif -%} - -{%- if result.osm and (result.osm.type and result.osm.id) -%} - <small> • <a class="btn-collapse collapsed hide_if_nojs searx_overpass_request" data-target="#result-overpass-{{ index }}" data-btn-text-collapsed="{{ _('show details') }}" data-btn-text-not-collapsed="{{ _('hide details') }}" 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 }}">{{ icon('location') }} {{ _('show details') }}</a></small> -{%- endif -%} -{#- -{% if (result.latitude and result.longitude) %} - <small> • <a class="btn-collapse disabled_if_nojs" data-target="#result-geodata-{{ index }}" data-btn-text-collapsed="{{ _('show geodata') }}" data-btn-text-not-collapsed="{{ _('hide geodata') }}">{{ icon('location') }} {{ _('show geodata') }}</a></small> -{% endif %} --#} +{%- if result.content %}<p class="content">{{ result.content|safe }}</p>{% endif -%} -{%- if result.address -%} -<p itemscope itemtype="http://schema.org/PostalAddress" class="content"> - {%- 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/> +<table> + {%- if result.address -%} + <tr> + <th scope="row">{{ result.address_label or _('address') }}</th> + <td itemscope itemtype="http://schema.org/PostalAddress"> + {%- if result.address.name -%} + <strong itemprop="name" class="hidden">{{ result.address.name }}</strong> + {%- 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 -%} + </td> + </tr> {%- 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 -%} + {%- for info in result.data -%} + <tr><th scope="row">{{ info.label }}</th><td>{{ info.value|safe }}</td></tr> + {%- endfor -%} + {%- for link in result.links -%} + <tr><th scope="row">{{ link.label }}</th><td><a class="text-info cursor-pointer" href="{{ link.url }}">{{ link.url|safe }}</a></td></tr> + {%- endfor -%} +</table> -{%- if result.content %}<p class="content">{{ result.content|safe }}</p>{% endif -%} +{%- if (result.latitude and result.longitude) or result.boundingbox -%} + <small> <a class="btn-collapse collapsed searx_init_map hide_if_nojs" data-target="#result-map-{{ index }}" data-btn-text-collapsed="{{ _('show map') }}" data-btn-text-not-collapsed="{{ _('hide map') }}" 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 %}>{{ icon( 'globe') }} {{ _('show map') }}</a></small> +{%- endif -%} {{- result_sub_footer(result, proxify) -}} -{% if result.osm and (result.osm.type and result.osm.id) -%} - <div class="result-content invisible" id="result-overpass-{{ index }}"{% if rtl %} dir="ltr"{% endif %}> - <div id="result-overpass-table-loading-{{ index }}"><div class="loader">{{ _('Loading...') }}</div></div> - <table id="result-overpass-table-{{ index }}"> - <tbody> - </tbody> - </table> - </div> -{%- endif %} - -{#- -{% if (result.latitude and result.longitude) -%} - <div id="result-geodata-{{ index }}" class="invisible"> - <strong>Longitude:</strong> {{ result.longitude }} <br/> - <strong>Latitude:</strong> {{ result.latitude }} - </div> -{%- endif %} --#} - {% if (result.latitude and result.longitude) or result.boundingbox -%} <div id="result-map-{{ index }}" class="invisible"><div id="osm-map-{{ index }}" style="height:300px; width:100%; margin: 10px 0;" ></div></div> {%- endif %} diff --git a/searx/templates/simple/results.html b/searx/templates/simple/results.html index 8885abc..7ece6c7 100644 --- a/searx/templates/simple/results.html +++ b/searx/templates/simple/results.html @@ -1,7 +1,14 @@ {% extends "simple/base.html" %} {% from 'simple/macros.html' import icon, icon_small %} +{% macro engine_data_form(engine_data) -%} + {% for engine_name, kv_data in engine_data.items() %} + {% for k, v in kv_data.items() %} + <input type="hidden" name="engine_data-{{ engine_name }}-{{ k|e }}" value="{{ v|e }}" /> + {% endfor %} + {% endfor %} +{%- endmacro %} {% block title %}{% if method == 'GET' %}{{- q|e -}} -{% endif %}{% endblock %} -{% block meta %}<link rel="alternate" type="application/rss+xml" title="Searx search: {{ q|e }}" href="{{ url_for('index') }}?q={{ q|urlencode }}&categories={{ selected_categories|join(",") | replace(' ','+') }}&pageno={{ pageno }}&time_range={{ time_range }}&language={{ current_language }}&safesearch={{ safesearch }}&format=rss">{% endblock %} +{% block meta %}<link rel="alternate" type="application/rss+xml" title="Searx search: {{ q|e }}" href="{{ url_for('search', _external=True) }}?q={{ q|urlencode }}&categories={{ selected_categories|join(",") | replace(' ','+') }}&pageno={{ pageno }}&time_range={{ time_range }}&language={{ current_language }}&safesearch={{ safesearch }}&format=rss">{% endblock %} {% block content %} <nav id="linkto_preferences"><a href="{{ url_for('preferences') }}">{{ icon('navicon-round') }}</a></nav> {% include 'simple/search.html' %} @@ -15,8 +22,14 @@ <div id="results" class="{{ only_template }}"> {% if answers -%} <div id="answers"><h4 class="title">{{ _('Answers') }} : </h4> - {%- for answer in answers -%} - <div class="answer">{{- answer -}}</div> + {%- for answer in answers.values() -%} + <div class="answer"> + {% if answer.url %} + <a href="{{ answer.url }}">{{ answer.answer }}</a> + {% else %} + <span>{{ answer.answer }}</span> + {% endif %} + </div> {%- endfor -%} </div> {%- endif %} @@ -49,7 +62,7 @@ <h4 class="title">{{ _('Suggestions') }} : </h4> <div class="wrapper"> {% for suggestion in suggestions %} - <form method="{{ method or 'POST' }}" action="{{ url_for('index') }}"> + <form method="{{ method or 'POST' }}" action="{{ url_for('search') }}"> <input type="hidden" name="q" value="{{ suggestion.url }}"> <input type="hidden" name="time_range" value="{{ time_range }}"> <input type="hidden" name="language" value="{{ current_language }}"> @@ -65,13 +78,13 @@ <div id="search_url"> <h4 class="title">{{ _('Search URL') }} :</h4> - <div class="selectable_url"><pre>{{ base_url }}?q={{ q|urlencode }}&language={{ current_language }}&time_range={{ time_range }}&safesearch={{ safesearch }}{% if pageno > 1 %}&pageno={{ pageno }}{% endif %}{% if selected_categories %}&categories={{ selected_categories|join(",") | replace(' ','+') }}{% endif %}{% if timeout_limit %}&timeout_limit={{ timeout_limit|urlencode }}{% endif %}</pre></div> + <div class="selectable_url"><pre>{{ url_for('search', _external=True) }}?q={{ q|urlencode }}&language={{ current_language }}&time_range={{ time_range }}&safesearch={{ safesearch }}{% if pageno > 1 %}&pageno={{ pageno }}{% endif %}{% if selected_categories %}&categories={{ selected_categories|join(",") | replace(' ','+') }}{% endif %}{% if timeout_limit %}&timeout_limit={{ timeout_limit|urlencode }}{% endif %}</pre></div> </div> <div id="apis"> <h4 class="title">{{ _('Download results') }}</h4> {% for output_type in ('csv', 'json', 'rss') %} <div class="left"> - <form method="{{ method or 'POST' }}" action="{{ url_for('index') }}"> + <form method="{{ method or 'POST' }}" action="{{ url_for('search') }}"> <input type="hidden" name="q" value="{{ q|e }}"> {% for category in selected_categories %} <input type="hidden" name="category_{{ category }}" value="1"> @@ -94,7 +107,7 @@ <h4>{{ _('Try searching for:') }}</h4> {% for correction in corrections %} <div class="left"> - <form method="{{ method or 'POST' }}" action="{{ url_for('index') }}" role="navigation"> + <form method="{{ method or 'POST' }}" action="{{ url_for('search') }}" role="navigation"> <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 }}"> @@ -127,9 +140,10 @@ {% if paging %} <nav id="pagination"> {% if pageno > 1 %} - <form method="{{ method or 'POST' }}" action="{{ url_for('index') }}"> + <form method="{{ method or 'POST' }}" action="{{ url_for('search') }}"> <div class="{% if rtl %}right{% else %}left{% endif %}"> <input type="hidden" name="q" value="{{ q|e }}" > + {{- engine_data_form(engine_data) -}} {% for category in selected_categories %} <input type="hidden" name="category_{{ category }}" value="1" > {% endfor %} @@ -143,9 +157,10 @@ </div> </form> {% endif %} - <form method="{{ method or 'POST' }}" action="{{ url_for('index') }}"> + <form method="{{ method or 'POST' }}" action="{{ url_for('search') }}"> <div class="{% if rtl %}left{% else %}right{% endif %}"> <input type="hidden" name="q" value="{{ q|e }}" > + {{- engine_data_form(engine_data) -}} {% for category in selected_categories %} <input type="hidden" name="category_{{ category }}" value="1" > {% endfor %} diff --git a/searx/templates/simple/search.html b/searx/templates/simple/search.html index e9023b4..a4ee392 100644 --- a/searx/templates/simple/search.html +++ b/searx/templates/simple/search.html @@ -1,7 +1,7 @@ -<form id="search" method="{{ method or 'POST' }}" action="{{ url_for('index') }}"> +<form id="search" method="{{ method or 'POST' }}" action="{{ url_for('search') }}"> <div id="search_wrapper"> <div class="search_box"> - <input id="q" name="q" type="text" placeholder="{{ _('Search for...') }}" tabindex="1" autocomplete="off" spellcheck="false" dir="auto" {% if q %}value="{{ q }}"{% endif %} > + <input id="q" {% if autofocus %}autofocus{% endif %} name="q" type="text" placeholder="{{ _('Search for...') }}" tabindex="1" autocomplete="off" spellcheck="false" dir="auto" {% if q %}value="{{ q }}"{% endif %} > <button id="clear_search" type="button" tabindex="-1"><span class="hide_if_nojs">{{ icon('close') }}</span><span class="show_if_nojs">{{ _('Clear search') }}</span></button> <button id="send_search" type="submit" tabindex="-1"><span class="hide_if_nojs">{{ icon('search') }}</span><span class="show_if_nojs">{{ _('Start search') }}</span></button> </div> |