results.html 8.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187
  1. {% extends "simple/base.html" %}
  2. {% from 'simple/icons.html' import icon, icon_big, icon_small %}
  3. {% macro engine_data_form(engine_data) -%}
  4. {% for engine_name, kv_data in engine_data.items() %}
  5. {% for k, v in kv_data.items() %}
  6. <input type="hidden" name="engine_data-{{ engine_name }}-{{ k|e }}" value="{{ v|e }}" />
  7. {% endfor %}
  8. {% endfor %}
  9. {%- endmacro %}
  10. {% block title %}{% if query_in_title %}{{- q|e }} - {% endif %}{% endblock %}
  11. {% block meta %}<link rel="alternate" type="application/rss+xml" title="Searx search: {{ q|e }}" href="{{ url_for('search', _external=True) }}?q={{ q|urlencode }}&amp;categories={{ selected_categories|join(",") | replace(' ','+') }}&amp;pageno={{ pageno }}&amp;time_range={{ time_range }}&amp;language={{ current_language }}&amp;safesearch={{ safesearch }}&amp;format=rss">{% endblock %}
  12. {% block content %}
  13. {% include 'simple/search.html' %}
  14. {% if results and results|map(attribute='template')|unique|list|count == 1 %}
  15. {% set only_template = 'only_template_' + results[0]['template']|default('default')|replace('.html', '') %}
  16. {% else %}
  17. {% set unique_template = '' %}
  18. {% endif %}
  19. <div id="results" class="{{ only_template }}">
  20. {% if answers -%}
  21. <div id="answers"><h4 class="title">{{ _('Answers') }} : </h4>
  22. {%- for answer in answers.values() -%}
  23. <div class="answer">
  24. {% if answer.url %}
  25. <a href="{{ answer.url }}">{{ answer.answer }}</a>
  26. {% else %}
  27. <span>{{ answer.answer }}</span>
  28. {% endif %}
  29. </div>
  30. {%- endfor -%}
  31. </div>
  32. {%- endif %}
  33. <div id="sidebar">
  34. {% if number_of_results != '0' -%}
  35. <p id="result_count"><small>{{ _('Number of results') }}: {{ number_of_results }}</small></p>
  36. {%- endif %}
  37. {% if unresponsive_engines and results|length >= 1 %}
  38. <div class="dialog-error" role="alert">
  39. {{ icon_big('warning') }}
  40. <div>
  41. <p><strong>{{ _('Error!') }}</strong> {{ _('Engines cannot retrieve results') }}:</p>
  42. {%- for engine_name, error_type in unresponsive_engines -%}
  43. <p>{{- engine_name }} (
  44. <a href="{{ url_for('stats', engine=engine_name|e) }}" title="{{ _('View error logs and submit a bug report') }}">
  45. {{- error_type -}}
  46. </a> ){{- '' -}}
  47. </p>
  48. {% endfor %}
  49. </div>
  50. </div>
  51. {% endif %}
  52. {% if infoboxes %}
  53. <div id="infoboxes">
  54. {% for infobox in infoboxes -%}
  55. {% include 'simple/infobox.html' %}
  56. {%- endfor %}
  57. </div>
  58. {% endif %}
  59. {% if suggestions %}
  60. <div id="suggestions">
  61. <h4 class="title">{{ _('Suggestions') }} : </h4>
  62. <div class="wrapper">
  63. {% for suggestion in suggestions %}
  64. <form method="{{ method or 'POST' }}" action="{{ url_for('search') }}">
  65. <input type="hidden" name="q" value="{{ suggestion.url }}">
  66. <input type="hidden" name="time_range" value="{{ time_range }}">
  67. <input type="hidden" name="language" value="{{ current_language }}">
  68. <input type="hidden" name="safesearch" value="{{ safesearch }}">
  69. <input type="hidden" name="theme" value="{{ theme }}">
  70. {% if timeout_limit %}<input type="hidden" name="timeout_limit" value="{{ timeout_limit|e }}" >{% endif %}
  71. <input type="submit" class="suggestion" value="&bull; {{ suggestion.title }}">
  72. </form>
  73. {% endfor %}
  74. </div>
  75. </div>
  76. {% endif %}
  77. <div id="search_url">
  78. <h4 class="title">{{ _('Search URL') }} :</h4>
  79. <div class="selectable_url"><pre>{{ url_for('search', _external=True) }}?q={{ q|urlencode }}&amp;language={{ current_language }}&amp;time_range={{ time_range }}&amp;safesearch={{ safesearch }}{% if pageno > 1 %}&amp;pageno={{ pageno }}{% endif %}{% if selected_categories %}&amp;categories={{ selected_categories|join(",") | replace(' ','+') }}{% endif %}{% if timeout_limit %}&amp;timeout_limit={{ timeout_limit|urlencode }}{% endif %}</pre></div>
  80. </div>
  81. <div id="apis">
  82. {% if search_formats %}
  83. <h4 class="title">{{ _('Download results') }}</h4>
  84. {% for output_type in search_formats %}
  85. <div class="left">
  86. <form method="{{ method or 'POST' }}" action="{{ url_for('search') }}">
  87. <input type="hidden" name="q" value="{{ q|e }}">
  88. {% for category in selected_categories %}
  89. <input type="hidden" name="category_{{ category }}" value="1">
  90. {% endfor %}
  91. <input type="hidden" name="pageno" value="{{ pageno }}">
  92. <input type="hidden" name="time_range" value="{{ time_range }}">
  93. <input type="hidden" name="language" value="{{ current_language }}">
  94. <input type="hidden" name="safesearch" value="{{ safesearch }}">
  95. <input type="hidden" name="format" value="{{ output_type }}">
  96. {% if timeout_limit %}<input type="hidden" name="timeout_limit" value="{{ timeout_limit|e }}" >{% endif %}
  97. <input type="submit" value="{{ output_type }}">
  98. </form>
  99. </div>
  100. {% endfor %}
  101. {% endif %}
  102. </div>
  103. </div>
  104. {% if corrections %}
  105. <div id="corrections">
  106. <h4>{{ _('Try searching for:') }}</h4>
  107. {% for correction in corrections %}
  108. <div class="left">
  109. <form method="{{ method or 'POST' }}" action="{{ url_for('search') }}" role="navigation">
  110. <input type="hidden" name="q" value="{{ correction.url }}">
  111. <input type="hidden" name="time_range" value="{{ time_range }}">
  112. <input type="hidden" name="language" value="{{ current_language }}">
  113. <input type="hidden" name="safesearch" value="{{ safesearch }}">
  114. <input type="hidden" name="theme" value="{{ theme }}">
  115. {% if timeout_limit %}<input type="hidden" name="timeout_limit" value="{{ timeout_limit }}" >{% endif %}
  116. <input type="submit" value="{{ correction.title }}">
  117. </form>
  118. </div>
  119. {% endfor %}
  120. </div>
  121. {% endif %}
  122. <div id="urls">
  123. {% for result in results %}
  124. {% set index = loop.index %}
  125. {% if result['template'] %}
  126. {% include get_result_template('simple', result['template']) %}
  127. {% else %}
  128. {% include 'simple/result_templates/default.html' %}
  129. {% endif %}
  130. {% endfor %}
  131. {% if not results and not answers %}
  132. {% include 'simple/messages/no_results.html' %}
  133. {% endif %}
  134. </div>
  135. <div id="backToTop">
  136. <a href="#">{{ icon_small('chevron-up-outline') }}</a>
  137. </div>
  138. {% if paging %}
  139. <nav id="pagination">
  140. {% if pageno > 1 %}
  141. <form method="{{ method or 'POST' }}" action="{{ url_for('search') }}" class="previous_page">
  142. <div class="{% if rtl %}right{% else %}left{% endif %}">
  143. <input type="hidden" name="q" value="{{ q|e }}" >
  144. {{- engine_data_form(engine_data) -}}
  145. {% for category in selected_categories %}
  146. <input type="hidden" name="category_{{ category }}" value="1" >
  147. {% endfor %}
  148. <input type="hidden" name="pageno" value="{{ pageno-1 }}" >
  149. <input type="hidden" name="time_range" value="{{ time_range }}" >
  150. <input type="hidden" name="language" value="{{ current_language }}" >
  151. <input type="hidden" name="safesearch" value="{{ safesearch }}" >
  152. <input type="hidden" name="theme" value="{{ theme }}" >
  153. {% if timeout_limit %}<input type="hidden" name="timeout_limit" value="{{ timeout_limit|e }}" >{% endif %}
  154. <button type="submit">{{ icon_small('chevron-left') }} {{ _('Previous page') }}</button>
  155. </div>
  156. </form>
  157. {% endif %}
  158. <form method="{{ method or 'POST' }}" action="{{ url_for('search') }}" class="next_page">
  159. <div class="{% if rtl %}left{% else %}right{% endif %}">
  160. <input type="hidden" name="q" value="{{ q|e }}" >
  161. {{- engine_data_form(engine_data) -}}
  162. {% for category in selected_categories %}
  163. <input type="hidden" name="category_{{ category }}" value="1" >
  164. {% endfor %}
  165. <input type="hidden" name="pageno" value="{{ pageno+1 }}" >
  166. <input type="hidden" name="time_range" value="{{ time_range }}" >
  167. <input type="hidden" name="language" value="{{ current_language }}" >
  168. <input type="hidden" name="safesearch" value="{{ safesearch }}" >
  169. <input type="hidden" name="theme" value="{{ theme }}" >
  170. {% if timeout_limit %}<input type="hidden" name="timeout_limit" value="{{ timeout_limit|e }}" >{% endif %}
  171. <button type="submit">{{ _('Next page') }} {{ icon_small('chevron-right') }}</button>
  172. </div>
  173. </form>
  174. </nav>
  175. {% endif %}
  176. </div>
  177. {% endblock %}