results.html 8.1 KB

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