results.html 9.0 KB

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