results.html 8.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185
  1. {% extends "simple/base.html" %}
  2. {% from 'simple/macros.html' import icon, 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 method == 'GET' %}{{- 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('navicon-round') }}</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. <p><strong>{{ _('Error!') }}</strong> {{ _('Engines cannot retrieve results') }}:</p>
  41. {%- for engine_name, error_type in unresponsive_engines -%}
  42. <p>{{- engine_name }} (
  43. <a href="{{ url_for('stats', engine=engine_name|e) }}" title="{{ _('View error logs and submit a bug report') }}">
  44. {{- error_type -}}
  45. </a> ){{- '' -}}
  46. </p>
  47. {% endfor %}
  48. </div>
  49. {% endif %}
  50. {% if infoboxes %}
  51. <div id="infoboxes">
  52. {% for infobox in infoboxes -%}
  53. {% include 'simple/infobox.html' %}
  54. {%- endfor %}
  55. </div>
  56. {% endif %}
  57. {% if suggestions %}
  58. <div id="suggestions">
  59. <h4 class="title">{{ _('Suggestions') }} : </h4>
  60. <div class="wrapper">
  61. {% for suggestion in suggestions %}
  62. <form method="{{ method or 'POST' }}" action="{{ url_for('search') }}">
  63. <input type="hidden" name="q" value="{{ suggestion.url }}">
  64. <input type="hidden" name="time_range" value="{{ time_range }}">
  65. <input type="hidden" name="language" value="{{ current_language }}">
  66. <input type="hidden" name="safesearch" value="{{ safesearch }}">
  67. <input type="hidden" name="theme" value="{{ theme }}">
  68. {% if timeout_limit %}<input type="hidden" name="timeout_limit" value="{{ timeout_limit|e }}" >{% endif %}
  69. <input type="submit" class="suggestion" value="&bull; {{ suggestion.title }}">
  70. </form>
  71. {% endfor %}
  72. </div>
  73. </div>
  74. {% endif %}
  75. <div id="search_url">
  76. <h4 class="title">{{ _('Search URL') }} :</h4>
  77. <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>
  78. </div>
  79. <div id="apis">
  80. {% if search_formats %}
  81. <h4 class="title">{{ _('Download results') }}</h4>
  82. {% for output_type in search_formats %}
  83. <div class="left">
  84. <form method="{{ method or 'POST' }}" action="{{ url_for('search') }}">
  85. <input type="hidden" name="q" value="{{ q|e }}">
  86. {% for category in selected_categories %}
  87. <input type="hidden" name="category_{{ category }}" value="1">
  88. {% endfor %}
  89. <input type="hidden" name="pageno" value="{{ pageno }}">
  90. <input type="hidden" name="time_range" value="{{ time_range }}">
  91. <input type="hidden" name="language" value="{{ current_language }}">
  92. <input type="hidden" name="safesearch" value="{{ safesearch }}">
  93. <input type="hidden" name="format" value="{{ output_type }}">
  94. {% if timeout_limit %}<input type="hidden" name="timeout_limit" value="{{ timeout_limit|e }}" >{% endif %}
  95. <input type="submit" value="{{ output_type }}">
  96. </form>
  97. </div>
  98. {% endfor %}
  99. {% endif %}
  100. </div>
  101. </div>
  102. {% if corrections %}
  103. <div id="corrections">
  104. <h4>{{ _('Try searching for:') }}</h4>
  105. {% for correction in corrections %}
  106. <div class="left">
  107. <form method="{{ method or 'POST' }}" action="{{ url_for('search') }}" role="navigation">
  108. <input type="hidden" name="q" value="{{ correction.url }}">
  109. <input type="hidden" name="time_range" value="{{ time_range }}">
  110. <input type="hidden" name="language" value="{{ current_language }}">
  111. <input type="hidden" name="safesearch" value="{{ safesearch }}">
  112. <input type="hidden" name="theme" value="{{ theme }}">
  113. {% if timeout_limit %}<input type="hidden" name="timeout_limit" value="{{ timeout_limit }}" >{% endif %}
  114. <input type="submit" value="{{ correction.title }}">
  115. </form>
  116. </div>
  117. {% endfor %}
  118. </div>
  119. {% endif %}
  120. <div id="urls">
  121. {% for result in results %}
  122. {% set index = loop.index %}
  123. {% if result['template'] %}
  124. {% include get_result_template('simple', result['template']) %}
  125. {% else %}
  126. {% include 'simple/result_templates/default.html' %}
  127. {% endif %}
  128. {% endfor %}
  129. {% if not results and not answers %}
  130. {% include 'simple/messages/no_results.html' %}
  131. {% endif %}
  132. </div>
  133. <div id="backToTop">
  134. <a href="#">{{ icon_small('chevron-up') }}</a>
  135. </div>
  136. {% if paging %}
  137. <nav id="pagination">
  138. {% if pageno > 1 %}
  139. <form method="{{ method or 'POST' }}" action="{{ url_for('search') }}">
  140. <div class="{% if rtl %}right{% else %}left{% endif %}">
  141. <input type="hidden" name="q" value="{{ q|e }}" >
  142. {{- engine_data_form(engine_data) -}}
  143. {% for category in selected_categories %}
  144. <input type="hidden" name="category_{{ category }}" value="1" >
  145. {% endfor %}
  146. <input type="hidden" name="pageno" value="{{ pageno-1 }}" >
  147. <input type="hidden" name="time_range" value="{{ time_range }}" >
  148. <input type="hidden" name="language" value="{{ current_language }}" >
  149. <input type="hidden" name="safesearch" value="{{ safesearch }}" >
  150. <input type="hidden" name="theme" value="{{ theme }}" >
  151. {% if timeout_limit %}<input type="hidden" name="timeout_limit" value="{{ timeout_limit|e }}" >{% endif %}
  152. <button type="submit">{{ icon_small('chevron-left') }} {{ _('previous page') }}</button>
  153. </div>
  154. </form>
  155. {% endif %}
  156. <form method="{{ method or 'POST' }}" action="{{ url_for('search') }}">
  157. <div class="{% if rtl %}left{% else %}right{% endif %}">
  158. <input type="hidden" name="q" value="{{ q|e }}" >
  159. {{- engine_data_form(engine_data) -}}
  160. {% for category in selected_categories %}
  161. <input type="hidden" name="category_{{ category }}" value="1" >
  162. {% endfor %}
  163. <input type="hidden" name="pageno" value="{{ pageno+1 }}" >
  164. <input type="hidden" name="time_range" value="{{ time_range }}" >
  165. <input type="hidden" name="language" value="{{ current_language }}" >
  166. <input type="hidden" name="safesearch" value="{{ safesearch }}" >
  167. <input type="hidden" name="theme" value="{{ theme }}" >
  168. {% if timeout_limit %}<input type="hidden" name="timeout_limit" value="{{ timeout_limit|e }}" >{% endif %}
  169. <button type="submit">{{ _('next page') }} {{ icon_small('chevron-right') }}</button>
  170. </div>
  171. </form>
  172. </nav>
  173. {% endif %}
  174. </div>
  175. {% endblock %}