results.html 8.3 KB

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