diff options
Diffstat (limited to 'searx/templates')
| -rw-r--r-- | searx/templates/simple/answer/legacy.html | 8 | ||||
| -rw-r--r-- | searx/templates/simple/answer/translations.html | 52 | ||||
| -rw-r--r-- | searx/templates/simple/answerers/translate.html | 38 | ||||
| -rw-r--r-- | searx/templates/simple/base.html | 1 | ||||
| -rw-r--r-- | searx/templates/simple/elements/answers.html | 8 | ||||
| -rw-r--r-- | searx/templates/simple/elements/corrections.html | 19 | ||||
| -rw-r--r-- | searx/templates/simple/preferences.html | 44 | ||||
| -rw-r--r-- | searx/templates/simple/preferences/answerers.html | 18 | ||||
| -rw-r--r-- | searx/templates/simple/preferences/doi_resolver.html | 6 | ||||
| -rw-r--r-- | searx/templates/simple/results.html | 50 |
10 files changed, 136 insertions, 108 deletions
diff --git a/searx/templates/simple/answer/legacy.html b/searx/templates/simple/answer/legacy.html new file mode 100644 index 000000000..432087ec1 --- /dev/null +++ b/searx/templates/simple/answer/legacy.html @@ -0,0 +1,8 @@ +<span>{{ answer.answer }}</span> +{%- if answer.url -%} + <a href="{{ answer.url }}" class="answer-url" + {%- if results_on_new_tab %} target="_blank" rel="noopener noreferrer" + {%- else -%} rel="noreferrer" + {%- endif -%} + >{{ urlparse(answer.url).hostname }}</a> +{% endif -%} diff --git a/searx/templates/simple/answer/translations.html b/searx/templates/simple/answer/translations.html new file mode 100644 index 000000000..e756a57a0 --- /dev/null +++ b/searx/templates/simple/answer/translations.html @@ -0,0 +1,52 @@ +<details class="answer-translations"> + <summary>{{ answer.translations[0].text }}</summary> + <dl> + {%- for item in answer.translations -%} + <dt>{{ item.text }}</dt> + <dd> + {%- if item.transliteration -%} + <div class="item-transliteration">{{ item.transliteration }}</div> + {%- endif -%} + + {%- if item.examples -%} + <div>{{ _('Examples') }}</div> + <ul> + {%- for i in item.examples -%} + <li>{{ i }}</li> + {%- endfor -%} + </ul> + {%- endif -%} + + {%- if item.definitions -%} + <div>{{ _('Definitions') }}</div> + <ul> + {%- for i in item.definitions -%} + <li>{{ i }}</li> + {%- endfor -%} + </ul> + {%- endif -%} + + {%- if item.synonyms -%} + <div>{{ _('Synonyms') }}</div> + <ul> + {%- for i in item.synonyms -%} + <li>{{ i }}</li> + {%- endfor -%} + </ul> + {%- endif -%} + </dd> + {%- endfor -%} + </dl> +</details> + +{%- if answer.url -%} +<a href="{{ answer.url }}" class="answer-url" + {%- if results_on_new_tab %} + target="_blank" rel="noopener noreferrer" + {%- else -%} + rel="noreferrer" + {%- endif -%} + >{{ answer.engine }}</a> +{%- else -%} +<span class="answer-url">{{ answer.engine }}</span> +{% endif -%} diff --git a/searx/templates/simple/answerers/translate.html b/searx/templates/simple/answerers/translate.html deleted file mode 100644 index a1c38eecf..000000000 --- a/searx/templates/simple/answerers/translate.html +++ /dev/null @@ -1,38 +0,0 @@ -<div class="answer-translations"> -{% for translation in translations %} - {% if loop.index > 1 %} - <hr /> - {% endif %} - <h3>{{ translation.text }}</h3> - {% if translation.transliteration %} - <b>translation.transliteration</b> - {% endif %} {% if translation.definitions %} - <dl> - <dt>{{ _('Definitions') }}</dt> - <ul> - {% for definition in translation.definitions %} - <li>{{ definition }}</li> - {% endfor %} - <ul> - </dl> - {% endif %} {% if translation.examples %} - <dl> - <dt>{{ _('Examples') }}</dt> - <ul> - {% for example in translation.examples %} - <li>{{ example }}</li> - {% endfor %} - </ul> - </dl> - {% endif %} {% if translation.synonyms %} - <dl> - <dt>{{ _('Synonyms') }}</dt> - <ul> - {% for synonym in translation.synonyms %} - <li>{{ synonym }}</li> - {% endfor %} - </ul> - </dl> - {% endif %} -{% endfor %} -</div> diff --git a/searx/templates/simple/base.html b/searx/templates/simple/base.html index 93a1a3902..93249fbf8 100644 --- a/searx/templates/simple/base.html +++ b/searx/templates/simple/base.html @@ -20,7 +20,6 @@ {% if get_setting('server.limiter') or get_setting('server.public_instance') %} <link rel="stylesheet" href="{{ url_for('client_token', token=link_token) }}" type="text/css"> {% endif %} - {% block styles %}{% endblock %} <!--[if gte IE 9]>--> <script src="{{ url_for('static', filename='js/searxng.head.min.js') }}" client_settings="{{ client_settings }}"></script> <!--<![endif]--> diff --git a/searx/templates/simple/elements/answers.html b/searx/templates/simple/elements/answers.html new file mode 100644 index 000000000..e4a72d768 --- /dev/null +++ b/searx/templates/simple/elements/answers.html @@ -0,0 +1,8 @@ + <div id="answers" role="complementary" aria-labelledby="answers-title"> + <h4 class="title" id="answers-title">{{ _('Answers') }} : </h4> + {%- for answer in answers -%} + <div class="answer"> + {%- include ("simple/" + (answer.template or "answer/legacy.html")) -%} + </div> + {%- endfor -%} + </div> diff --git a/searx/templates/simple/elements/corrections.html b/searx/templates/simple/elements/corrections.html new file mode 100644 index 000000000..57556b43f --- /dev/null +++ b/searx/templates/simple/elements/corrections.html @@ -0,0 +1,19 @@ + <div id="corrections" role="complementary" aria-labelledby="corrections-title"> + <h4 id="corrections-title">{{ _('Try searching for:') }}</h4> + {% for correction in corrections %} + <div class="left"> + <form method="{{ method or 'POST' }}" action="{{ url_for('search') }}" role="navigation"> + {% for category in selected_categories %} + <input type="hidden" name="category_{{ category }}" value="1"> + {% endfor %} + <input type="hidden" name="q" value="{{ correction.url }}"> + <input type="hidden" name="language" value="{{ current_language }}"> + <input type="hidden" name="time_range" value="{{ time_range }}"> + <input type="hidden" name="safesearch" value="{{ safesearch }}"> + <input type="hidden" name="theme" value="{{ theme }}"> + {% if timeout_limit %}<input type="hidden" name="timeout_limit" value="{{ timeout_limit }}" >{% endif %} + <input type="submit" role="link" value="{{ correction.title }}"> + </form> + </div> + {% endfor %} + </div> diff --git a/searx/templates/simple/preferences.html b/searx/templates/simple/preferences.html index 665f2e638..d68e90e4a 100644 --- a/searx/templates/simple/preferences.html +++ b/searx/templates/simple/preferences.html @@ -37,19 +37,19 @@ {%- endmacro -%} {%- macro plugin_preferences(section) -%} -{%- for plugin in plugins -%} -{%- if plugin.preference_section == section -%} -<fieldset>{{- '' -}} - <legend>{{ _(plugin.name) }}</legend>{{- '' -}} - <div class="value"> - {{- checkbox_onoff_reversed('plugin_' + plugin.id, plugin.id not in allowed_plugins, 'plugin_labelledby' + plugin.id) -}} - </div>{{- '' -}} - <div class="description" id="{{ 'plugin_labelledby' + plugin.id }}"> - {{- _(plugin.description) -}} - </div>{{- '' -}} -</fieldset> -{%- endif -%} -{%- endfor -%} + {%- for plugin in plugins_storage -%} + {%- if plugin.preference_section == section -%} + <fieldset>{{- '' -}} + <legend>{{ _(plugin.name) }}</legend>{{- '' -}} + <div class="value"> + {{- checkbox_onoff_reversed('plugin_' + plugin.id, plugin.id not in allowed_plugins, 'plugin_labelledby' + plugin.id) -}} + </div>{{- '' -}} + <div class="description" id="{{ 'plugin_labelledby' + plugin.id }}"> + {{- _(plugin.description) -}} + </div>{{- '' -}} + </fieldset> + {%- endif -%} + {%- endfor -%} {%- endmacro -%} {%- macro engine_about(search_engine) -%} @@ -158,6 +158,7 @@ <form id="search_form" method="post" action="{{ url_for('preferences') }}" autocomplete="off"> {{- tabs_open() -}} + {# tab: general #} {{- tab_header('maintab', 'general', _('General'), True) -}} {%- if 'categories' not in locked_preferences -%} @@ -179,13 +180,16 @@ {% if 'safesearch' not in locked_preferences %} {%- include 'simple/preferences/safesearch.html' -%} {%- endif -%} + {%- include 'simple/preferences/tokens.html' -%} {{- plugin_preferences('general') -}} + + {%- if 'doi_resolver' not in locked_preferences %} {%- include 'simple/preferences/doi_resolver.html' -%} {%- endif -%} - {%- include 'simple/preferences/tokens.html' -%} {{- tab_footer() -}} + {# tab: ui #} {{- tab_header('maintab', 'ui', _('User interface')) -}} {%- if 'locale' not in locked_preferences -%} @@ -208,6 +212,7 @@ {{- plugin_preferences('ui') -}} {{- tab_footer() -}} + {# tab: privacy #} {{- tab_header('maintab', 'privacy', _('Privacy')) -}} {%- if 'method' not in locked_preferences -%} @@ -222,6 +227,8 @@ {{- plugin_preferences('privacy') -}} {{- tab_footer() -}} + {# tab: enignes #} + {{- tab_header('maintab', 'engines', _('Engines')) -}} <p> {{- _('Currently used search engines') -}} @@ -231,18 +238,23 @@ {{- tabs_close() -}} {{- tab_footer() -}} + {# tab: query #} {{- tab_header('maintab', 'query', _('Special Queries')) -}} - {%- if answerers -%} + {%- if answer_storage -%} {%- include 'simple/preferences/answerers.html' -%} {%- endif -%} {{- tab_footer() -}} + {# tab: cookies #} + {{- tab_header('maintab', 'cookies', _('Cookies')) -}} {%- include 'simple/preferences/cookies.html' -%} {{- tab_footer() -}} - {{- tabs_close() -}} + + {# footer with save & reset buttons #} + {%- include 'simple/preferences/footer.html' -%} </form>{{- '' -}} diff --git a/searx/templates/simple/preferences/answerers.html b/searx/templates/simple/preferences/answerers.html index 983646ae9..b424fafc3 100644 --- a/searx/templates/simple/preferences/answerers.html +++ b/searx/templates/simple/preferences/answerers.html @@ -2,7 +2,7 @@ <table class="striped">{{- '' -}} <tr>{{- '' -}} <th>{{ _('Allow') }}</th>{{- '' -}} - <th>{{ _('Keywords') }}</th>{{- '' -}} + <th>{{ _('Keywords (first word in query)') }}</th>{{- '' -}} <th>{{ _('Name') }}</th>{{- '' -}} <th>{{ _('Description') }}</th>{{- '' -}} <th>{{ _('Examples') }}</th>{{- '' -}} @@ -14,13 +14,13 @@ </th>{{- '' -}} </tr> - {%- for answerer in answerers -%} + {%- for info in answer_storage -%} <tr>{{- '' -}} <td class="checkbox-col"></td>{{- '' -}} - <td>{{ answerer.keywords|join(', ') }}</td>{{- '' -}} - <td>{{ answerer.info.name }}</td>{{- '' -}} - <td>{{ answerer.info.description }}</td>{{- '' -}} - <td>{{ answerer.info.examples|join(', ') }}</td>{{- '' -}} + <td>{{ info.keywords|join(', ') }}</td>{{- '' -}} + <td>{{ info.name }}</td>{{- '' -}} + <td>{{ info.description }}</td>{{- '' -}} + <td>{{ info.examples|join(', ') }}</td>{{- '' -}} </tr> {%- endfor -%} @@ -30,14 +30,14 @@ </th>{{- '' -}} </th> - {%- for plugin in plugins -%} + {%- for plugin in plugins_storage -%} {%- if plugin.preference_section == 'query' -%} <tr>{{- '' -}} <td class="checkbox-col">{{- checkbox_onoff_reversed('plugin_' + plugin.id, plugin.id not in allowed_plugins, 'plugin_labelledby' + plugin.id) -}}</td>{{- '' -}} - <td>{{ plugin.query_keywords|join(', ') }}</td>{{- '' -}} + <td>{{ plugin.keywords|join(', ') }}</td>{{- '' -}} <td>{{ _(plugin.name) }}</td>{{- '' -}} <td id="{{ 'plugin_labelledby' + plugin.id }}">{{ _(plugin.description) }}</td>{{- '' -}} - <td>{{ plugin.query_examples }}</td>{{- '' -}} + <td>{{ plugin.examples|join(', ') }}</td>{{- '' -}} </tr> {%- endif -%} {%- endfor -%} diff --git a/searx/templates/simple/preferences/doi_resolver.html b/searx/templates/simple/preferences/doi_resolver.html index a53e964f9..34c76fecb 100644 --- a/searx/templates/simple/preferences/doi_resolver.html +++ b/searx/templates/simple/preferences/doi_resolver.html @@ -1,3 +1,7 @@ +<div class="pref-group">{{- _('Digital Object Identifier (DOI)') -}}</div> + +{{- plugin_preferences('general/doi_resolver') -}} + <fieldset>{{- '' -}} <legend id="pref_doi_resolver">{{- _('Open Access DOI resolver') -}}</legend>{{- '' -}} <div class="value">{{- '' -}} @@ -5,7 +9,7 @@ {%- for doi_resolver_name,doi_resolver_url in doi_resolvers.items() -%} <option value="{{ doi_resolver_name }}" {%- if doi_resolver_url == current_doi_resolver %} selected="selected" {%- endif -%}> - {{- doi_resolver_name }} - {{ doi_resolver_url -}} + {{- doi_resolver_name }} - {{ doi_resolver_url -}} </option> {%- endfor -%} </select>{{- '' -}} diff --git a/searx/templates/simple/results.html b/searx/templates/simple/results.html index 047c49dbd..9c2168554 100644 --- a/searx/templates/simple/results.html +++ b/searx/templates/simple/results.html @@ -19,28 +19,10 @@ {% endif %} <div id="results" class="{{ only_template }}"> - {% if answers -%} - <div id="answers" role="complementary" aria-labelledby="answers-title"><h4 class="title" id="answers-title">{{ _('Answers') }} : </h4> - {%- for answer in answers.values() -%} - <div class="answer"> - {%- if answer.answer_type == 'translations' -%} - {% with translations=answer.translations %} - {% include 'simple/answerers/translate.html' %} - {% endwith %} - {%- else -%} - <span>{{ answer.answer }}</span> - {%- if answer.url -%} - <a href="{{ answer.url }}" class="answer-url" - {%- if results_on_new_tab %} target="_blank" rel="noopener noreferrer" - {%- else -%} rel="noreferrer" - {%- endif -%} - >{{ urlparse(answer.url).hostname }}</a> - {% endif -%} - {%- endif -%} - </div> - {%- endfor -%} - </div> - {%- endif %} + + {%- if answers -%} + {%- include 'simple/elements/answers.html' -%} + {%- endif %} <div id="sidebar"> @@ -76,27 +58,9 @@ <div id="sidebar-end-collapsible"></div> </div> - {% if corrections %} - <div id="corrections" role="complementary" aria-labelledby="corrections-title"> - <h4 id="corrections-title">{{ _('Try searching for:') }}</h4> - {% for correction in corrections %} - <div class="left"> - <form method="{{ method or 'POST' }}" action="{{ url_for('search') }}" role="navigation"> - {% for category in selected_categories %} - <input type="hidden" name="category_{{ category }}" value="1"> - {% endfor %} - <input type="hidden" name="q" value="{{ correction.url }}"> - <input type="hidden" name="language" value="{{ current_language }}"> - <input type="hidden" name="time_range" value="{{ time_range }}"> - <input type="hidden" name="safesearch" value="{{ safesearch }}"> - <input type="hidden" name="theme" value="{{ theme }}"> - {% if timeout_limit %}<input type="hidden" name="timeout_limit" value="{{ timeout_limit }}" >{% endif %} - <input type="submit" role="link" value="{{ correction.title }}"> - </form> - </div> - {% endfor %} - </div> - {% endif %} + {%- if corrections -%} + {%- include 'simple/elements/corrections' -%} + {%- endif -%} <div id="urls" role="main"> {% for result in results %} |