Pārlūkot izejas kodu

Few fixes

- Whitespaces
- Change a few <p> in <span>
- Add RSS to allow browser detection
- A few UIUX changes
- Add a few more allowed translations
Cqoicebordel 10 gadus atpakaļ
vecāks
revīzija
389fc3b8b2

+ 31
- 30
searx/templates/default/base.html Parādīt failu

@@ -1,33 +1,34 @@
1 1
 <!DOCTYPE html>
2 2
 <html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
3
-<head>
4
-    <meta charset="UTF-8" />
5
-    <meta name="description" content="Searx - a privacy-respecting, hackable metasearch engine" />
6
-    <meta name="keywords" content="searx, search, search engine, metasearch, meta search" />
7
-    <meta name="generator" content="searx/{{ searx_version }}">
8
-    <meta name="viewport" content="width=device-width, maximum-scale=1.0, user-scalable=1" />
9
-    <title>{% block title %}{% endblock %}searx</title>
10
-    <link rel="stylesheet" href="{{ url_for('static', filename='css/style.css') }}" type="text/css" media="screen" />
11
-    <link rel="shortcut icon" href="{{ url_for('static', filename='img/favicon.png') }}?v=2" />
12
-    {% block styles %}
13
-    {% endblock %}
14
-    {% block head %}
15
-    <link title="searx" type="application/opensearchdescription+xml" rel="search" href="{{ url_for('opensearch') }}"/>
16
-    {% endblock %}
17
-</head>
18
-<body>
19
-<div id="container">
20
-{% block content %}
21
-{% endblock %}
22
-{% if autocomplete %}
23
-<script src="{{ url_for('static', filename='js/mootools-core-1.4.5-min.js') }}" ></script>
24
-<script src="{{ url_for('static', filename='js/mootools-autocompleter-1.1.2-min.js') }}" ></script>
25
-{% endif %}
26
-<script type="text/javascript">
27
-        searx = {};
28
-        searx.autocompleter = {% if autocomplete %}true{% else %}false{% endif %};
29
-</script>
30
-<script src="{{ url_for('static', filename='js/searx.js') }}" ></script>
31
-</div>
32
-</body>
3
+    <head>
4
+        <meta charset="UTF-8" />
5
+        <meta name="description" content="Searx - a privacy-respecting, hackable metasearch engine" />
6
+        <meta name="keywords" content="searx, search, search engine, metasearch, meta search" />
7
+        <meta name="generator" content="searx/{{ searx_version }}">
8
+        <meta name="viewport" content="width=device-width, maximum-scale=1.0, user-scalable=1" />
9
+        <title>{% block title %}{% endblock %}searx</title>
10
+        <link rel="stylesheet" href="{{ url_for('static', filename='css/style.css') }}" type="text/css" media="screen" />
11
+        <link rel="shortcut icon" href="{{ url_for('static', filename='img/favicon.png') }}?v=2" />
12
+        {% block styles %}
13
+        {% endblock %}
14
+        {% block meta %}{% endblock %}
15
+        {% block head %}
16
+        <link title="searx" type="application/opensearchdescription+xml" rel="search" href="{{ url_for('opensearch') }}"/>
17
+        {% endblock %}
18
+    </head>
19
+    <body>
20
+        <div id="container">
21
+            {% block content %}
22
+            {% endblock %}
23
+            {% if autocomplete %}
24
+            <script src="{{ url_for('static', filename='js/mootools-core-1.4.5-min.js') }}" ></script>
25
+            <script src="{{ url_for('static', filename='js/mootools-autocompleter-1.1.2-min.js') }}" ></script>
26
+            {% endif %}
27
+            <script type="text/javascript">
28
+                    searx = {};
29
+                    searx.autocompleter = {% if autocomplete %}true{% else %}false{% endif %};
30
+            </script>
31
+            <script src="{{ url_for('static', filename='js/searx.js') }}" ></script>
32
+        </div>
33
+    </body>
33 34
 </html>

+ 3
- 3
searx/templates/default/categories.html Parādīt failu

@@ -1,10 +1,10 @@
1 1
 <div id="categories">
2 2
     <div id="categories_container">
3
-{% for category in categories %}
3
+        {% for category in categories %}
4 4
         <div class="checkbox_container">
5 5
              <input type="checkbox" id="checkbox_{{ category|replace(' ', '_') }}" name="category_{{ category }}" {% if category in selected_categories %}checked="checked"{% endif %} /><label for="checkbox_{{ category|replace(' ', '_') }}" class="tooltips">{{ _(category) }}</label>
6 6
         </div>
7
-{% endfor %}
8
-    <div class="hidden">{{ _('Click on the magnifier to perform search') }}</div>
7
+        {% endfor %}
8
+        {% if display_tooltip %}<div class="hidden">{{ _('Click on the magnifier to perform search') }}</div>{% endif %}
9 9
     </div>
10 10
 </div>

+ 38
- 38
searx/templates/default/infobox.html Parādīt failu

@@ -1,44 +1,44 @@
1 1
 <div class="infobox">
2
-  <h2>{{ infobox.infobox }}</h2>
3
-  {% if infobox.img_src %}<img src="{{ infobox.img_src }}" title="{{ infobox.infobox|striptags }}" alt="{{ infobox.infobox|striptags }}" />{% endif %}
4
-  <p>{{ infobox.entity }}</p>
5
-  <p>{{ infobox.content | safe }}</p>
6
-  {% if infobox.attributes %}
7
-  <div class="attributes">
8
-    <table>
9
-      {% for attribute in infobox.attributes %}
10
-      <tr><td>{{ attribute.label }}</td><td>{{ attribute.value }}</td></tr>
11
-      {% endfor %}
12
-    </table>
13
-  </div>
14
-  {% endif %}
2
+    <h2>{{ infobox.infobox }}</h2>
3
+    {% if infobox.img_src %}<img src="{{ infobox.img_src }}" title="{{ infobox.infobox|striptags }}" alt="{{ infobox.infobox|striptags }}" />{% endif %}
4
+    <p>{{ infobox.entity }}</p>
5
+    <p>{{ infobox.content | safe }}</p>
6
+    {% if infobox.attributes %}
7
+    <div class="attributes">
8
+        <table>
9
+            {% for attribute in infobox.attributes %}
10
+            <tr><td>{{ attribute.label }}</td><td>{{ attribute.value }}</td></tr>
11
+            {% endfor %}
12
+        </table>
13
+    </div>
14
+    {% endif %}
15 15
 
16
-  {% if infobox.urls %}
17
-  <div class="urls">
18
-    <ul>
19
-      {% for url in infobox.urls %}
20
-      <li class="url"><a href="{{ url.url }}">{{ url.title }}</a></li>
21
-      {% endfor %}
22
-    </ul>
23
-  </div>
24
-  {% endif %}
16
+    {% if infobox.urls %}
17
+    <div class="urls">
18
+        <ul>
19
+            {% for url in infobox.urls %}
20
+            <li class="url"><a href="{{ url.url }}">{{ url.title }}</a></li>
21
+            {% endfor %}
22
+        </ul>
23
+    </div>
24
+    {% endif %}
25 25
 
26
-  {% if infobox.relatedTopics %}
27
-  <div class="relatedTopics">
28
-      {% for topic in infobox.relatedTopics %}
29
-      <div>
30
-	<h3>{{ topic.name }}</h3>
31
-	{% for suggestion in topic.suggestions %}
32
-	<form method="{{ method or 'POST' }}" action="{{ url_for('index') }}">
33
-            <input type="hidden" name="q" value="{{ suggestion }}">
34
-            <input type="submit" value="{{ suggestion }}" />
35
-        </form>
36
-	{% endfor %}
37
-      </div>
38
-      {% endfor %}
39
-  </div>
40
-  {% endif %}
26
+    {% if infobox.relatedTopics %}
27
+    <div class="relatedTopics">
28
+        {% for topic in infobox.relatedTopics %}
29
+        <div>
30
+            <h3>{{ topic.name }}</h3>
31
+            {% for suggestion in topic.suggestions %}
32
+            <form method="{{ method or 'POST' }}" action="{{ url_for('index') }}">
33
+                <input type="hidden" name="q" value="{{ suggestion }}">
34
+                <input type="submit" value="{{ suggestion }}" />
35
+            </form>
36
+            {% endfor %}
37
+        </div>
38
+        {% endfor %}
39
+    </div>
40
+    {% endif %}
41 41
 
42
-  <br />
42
+    <br />
43 43
   
44 44
 </div>

+ 5
- 6
searx/templates/default/preferences.html Parādīt failu

@@ -7,9 +7,8 @@
7 7
     <form method="post" action="{{ url_for('preferences') }}" id="search_form">
8 8
     <fieldset>
9 9
         <legend>{{ _('Default categories') }}</legend>
10
-        <p>
10
+        {% set display_tooltip = false %}
11 11
         {% include 'default/categories.html' %}
12
-        </p>
13 12
     </fieldset>
14 13
     <fieldset>
15 14
         <legend>{{ _('Search language') }}</legend>
@@ -79,9 +78,9 @@
79 78
                 <td>{{ search_engine.name }} ({{ shortcuts[search_engine.name] }})</td>
80 79
                 <td>{{ _(categ) }}</td>
81 80
                 <td class="engine_checkbox">
82
-                    <input type="checkbox" id="engine_{{ categ }}_{{ search_engine.name|replace(' ', '_') }}" name="engine_{{ search_engine.name }}"{% if search_engine.name in blocked_engines %} checked="checked"{% endif %} />
83
-                    <label class="allow" for="engine_{{ categ }}_{{ search_engine.name|replace(' ', '_') }}">{{ _('Allow') }}</label>
84
-                    <label class="deny" for="engine_{{ categ }}_{{ search_engine.name|replace(' ', '_') }}">{{ _('Block') }}</label>
81
+                    <input type="checkbox" id="engine_{{ categ|replace(' ', '_') }}_{{ search_engine.name|replace(' ', '_') }}" name="engine_{{ search_engine.name }}"{% if search_engine.name in blocked_engines %} checked="checked"{% endif %} />
82
+                    <label class="allow" for="engine_{{ categ|replace(' ', '_') }}_{{ search_engine.name|replace(' ', '_') }}">{{ _('Allow') }}</label>
83
+                    <label class="deny" for="engine_{{ categ|replace(' ', '_') }}_{{ search_engine.name|replace(' ', '_') }}">{{ _('Block') }}</label>
85 84
                 </td>
86 85
             </tr>
87 86
             {% endif %}
@@ -95,7 +94,7 @@
95 94
     </p>
96 95
 
97 96
     <input type="submit" value="{{ _('save') }}" />
98
-	<div class="right preferences_back"><a href="{{ url_for('index') }}">{{ _('back') }}</a></div>
97
+    <div class="right preferences_back"><a href="{{ url_for('index') }}">{{ _('back') }}</a></div>
99 98
     </form>    
100 99
 </div>
101 100
 {% endblock %}

+ 2
- 2
searx/templates/default/result_templates/default.html Parādīt failu

@@ -1,6 +1,6 @@
1 1
 <div class="result {{ result.class }}">
2 2
     <h3 class="result_title">{% if "icon_"~result.engine~".ico" in favicons %}<img width="14" height="14" class="favicon" src="{{ url_for('static', filename='img/icons/icon_'+result.engine+'.ico') }}" alt="{{result.engine}}" />{% endif %}<a href="{{ result.url }}">{{ result.title|safe }}</a></h3>
3
-    <p class="url">{{ result.pretty_url }} <a class="cache_link" href="https://web.archive.org/web/{{ result.url }}">cached</a></p>
4
-    {% if result.publishedDate %}<p class="published_date">{{ result.publishedDate }}</p>{% endif %}
3
+    <p class="url">{{ result.pretty_url }} <a class="cache_link" href="https://web.archive.org/web/{{ result.url }}">cached</a>
4
+    {% if result.publishedDate %}<span class="published_date">{{ result.publishedDate }}</span>{% endif %}</p>
5 5
     <p class="content">{% if result.img_src %}<img src="{{ result.img_src }}" class="image" />{% endif %}{% if result.content %}{{ result.content|safe }}<br class="last"/>{% endif %}</p>
6 6
 </div>

+ 1
- 1
searx/templates/default/result_templates/images.html Parādīt failu

@@ -1,6 +1,6 @@
1 1
 <div class="image_result">
2 2
     <p>
3 3
         <a href="{{ result.img_src }}"><img src="{{ result.img_src }}" title="{{ result.title|striptags }}" alt="{{ result.title|striptags }}" /></a>
4
-        <span class="url"><a href="{{ result.url }}" class="small_font">original context</a></span>
4
+        <span class="url"><a href="{{ result.url }}" class="small_font">{{ _('original context') }}</a></span>
5 5
     </p>
6 6
 </div>

+ 8
- 8
searx/templates/default/result_templates/map.html Parādīt failu

@@ -1,13 +1,13 @@
1 1
 <div class="result {{ result.class }}">
2 2
 
3
-  {% if "icon_"~result.engine~".ico" in favicons %}
3
+    {% if "icon_"~result.engine~".ico" in favicons %}
4 4
     <img width="14" height="14" class="favicon" src="{{ url_for('static', filename='img/icons/icon_'+result.engine+'.ico') }}" alt="{{result.engine}}" />
5
-  {% endif %}
5
+    {% endif %}
6 6
 
7
-  <div>
8
-    <h3 class="result_title"><a href="{{ result.url }}">{{ result.title|safe }}</a></h3>
9
-    <p class="url">{{ result.pretty_url }} <a class="cache_link" href="https://web.archive.org/web/{{ result.url }}">cached</a></p>
10
-	{% if result.publishedDate %}<p class="published_date">{{ result.publishedDate }}</p>{% endif %}
11
-    <p class="content">{% if result.img_src %}<img src="{{ result.img_src }}" class="image" />{% endif %}{% if result.content %}{{ result.content|safe }}<br class="last"/>{% endif %}</p>
12
-  </div>
7
+    <div>
8
+        <h3 class="result_title"><a href="{{ result.url }}">{{ result.title|safe }}</a></h3>
9
+        <p class="url">{{ result.pretty_url }} <a class="cache_link" href="https://web.archive.org/web/{{ result.url }}">cached</a>
10
+        {% if result.publishedDate %}<span class="published_date">{{ result.publishedDate }}</span>{% endif %}</p>
11
+        <p class="content">{% if result.img_src %}<img src="{{ result.img_src }}" class="image" />{% endif %}{% if result.content %}{{ result.content|safe }}<br class="last"/>{% endif %}</p>
12
+    </div>
13 13
 </div>

+ 5
- 1
searx/templates/default/result_templates/torrent.html Parādīt failu

@@ -5,5 +5,9 @@
5 5
     <h3 class="result_title"><a href="{{ result.url }}">{{ result.title|safe }}</a></h3>
6 6
     <p class="url">{{ result.pretty_url }}</p>
7 7
     {% if result.content %}<p class="content">{{ result.content|safe }}</p>{% endif %}
8
-    <p><a href="{{ result.magnetlink }}" class="magnetlink">magnet link</a> - <span class="stats">Seed: {{ result.seed }}, Leech: {{ result.leech }}</span></p>
8
+    <p>
9
+        {% if result.magnetlink %}<a href="{{ result.magnetlink }}" class="magnetlink">{{ _('magnet link') }}</a>{% endif %} 
10
+        {% if result.torrentfile %}<a href="{{ result.torrentfile }}" class="torrentfile">{{ _('torrent file') }}</a>{% endif %} - 
11
+        <span class="stats">{{ _('Seeder') }} : {{ result.seed }}, {{ _('Leecher') }} : {{ result.leech }}</span>
12
+    </p>
9 13
 </div>

+ 3
- 3
searx/templates/default/result_templates/videos.html Parādīt failu

@@ -1,6 +1,6 @@
1 1
 <div class="result">
2 2
     <h3 class="result_title">{% if "icon_"~result.engine~".ico" in favicons %}<img width="14" height="14" class="favicon" src="{{ url_for('static', filename='img/icons/icon_'+result.engine+'.ico') }}" alt="{{result.engine}}" />{% endif %}<a href="{{ result.url }}">{{ result.title|safe }}</a></h3>
3
-      {% if result.publishedDate %}<p class="published_date">{{ result.publishedDate }}</p>{% endif %}
4
-      <a href="{{ result.url }}"><img class="thumbnail" src="{{ result.thumbnail }}" title="{{ result.title|striptags }}" alt="{{ result.title|striptags }}"/></a>
5
-      <p class="url">{{ result.url }}</p>
3
+    {% if result.publishedDate %}<span class="published_date">{{ result.publishedDate }}</span><br />{% endif %}
4
+    <a href="{{ result.url }}"><img class="thumbnail" src="{{ result.thumbnail }}" title="{{ result.title|striptags }}" alt="{{ result.title|striptags }}"/></a>
5
+    <p class="url">{{ result.url }}</p>
6 6
 </div>

+ 13
- 10
searx/templates/default/results.html Parādīt failu

@@ -1,5 +1,6 @@
1 1
 {% extends "default/base.html" %}
2 2
 {% block title %}{{ q }} - {% endblock %}
3
+{% block meta %}<link rel="alternate" type="application/rss+xml" title="Searx search: {{ q }}" href="{{ url_for('index') }}?q={{ q|urlencode }}&amp;format=rss&amp;{% for category in selected_categories %}category_{{ category }}=1&amp;{% endfor %}pageno={{ pageno }}">{% endblock %}
3 4
 {% block content %}
4 5
 <div class="preferences_container right"><a href="{{ url_for('preferences') }}" id="preferences"><span>preferences</span></a></div>
5 6
 <div class="small search center">
@@ -39,12 +40,14 @@
39 40
     {% endif %}
40 41
 
41 42
     {% if suggestions %}
42
-    <div id="suggestions"><span>{{ _('Suggestions') }}</span>
43
+    <div id="suggestions"><span id="suggestions-title">{{ _('Suggestions') }} : </span>
44
+        {% set first = true %}
43 45
         {% for suggestion in suggestions %}
44
-        <form method="{{ method or 'POST' }}" action="{{ url_for('index') }}">
46
+        {% if not first %} &bull; {% endif %}<form method="{{ method or 'POST' }}" action="{{ url_for('index') }}">
45 47
             <input type="hidden" name="q" value="{{ suggestion }}">
46
-            <input type="submit" value="{{ suggestion }}" />
48
+            <input type="submit" class="suggestion" value="{{ suggestion }}" />
47 49
         </form>
50
+        {% set first = false %}
48 51
         {% endfor %}
49 52
     </div>
50 53
     {% endif %}
@@ -55,7 +58,7 @@
55 58
          {% include 'default/infobox.html' %}
56 59
       {% endfor %}
57 60
     </div>
58
-    {% endif %}    
61
+    {% endif %}
59 62
 
60 63
     {% for result in results %}
61 64
         {% if result['template'] %}
@@ -81,12 +84,12 @@
81 84
         {% endif %}
82 85
         <form method="{{ method or 'POST' }}" action="{{ url_for('index') }}">
83 86
             <div class="right">
84
-            {% for category in selected_categories %}
85
-            <input type="hidden" name="category_{{ category }}" value="1"/>
86
-            {% endfor %}
87
-            <input type="hidden" name="q" value="{{ q }}" />
88
-            <input type="hidden" name="pageno" value="{{ pageno+1 }}" />
89
-            <input type="submit" value="{{ _('next page') }} >>" />
87
+                {% for category in selected_categories %}
88
+                <input type="hidden" name="category_{{ category }}" value="1"/>
89
+                {% endfor %}
90
+                <input type="hidden" name="q" value="{{ q }}" />
91
+                <input type="hidden" name="pageno" value="{{ pageno+1 }}" />
92
+                <input type="submit" value="{{ _('next page') }} >>" />
90 93
             </div>
91 94
         </form>
92 95
 

+ 6
- 5
searx/templates/default/search.html Parādīt failu

@@ -1,7 +1,8 @@
1 1
 <form method="{{ method or 'POST' }}" action="{{ url_for('index') }}" id="search_form">
2
-  <div id="search_wrapper">
3
-    <input type="text" placeholder="{{ _('Search for...') }}" id="q" class="q" name="q" tabindex="1" autocomplete="off" size="100" {% if q %}value="{{ q }}"{% endif %}/>
4
-    <input type="submit" value="search" id="search_submit" />
5
-  </div>
6
-  {% include 'default/categories.html' %}
2
+    <div id="search_wrapper">
3
+        <input type="text" placeholder="{{ _('Search for...') }}" id="q" class="q" name="q" tabindex="1" autocomplete="off" size="100" {% if q %}value="{{ q }}"{% endif %}/>
4
+        <input type="submit" value="search" id="search_submit" />
5
+    </div>
6
+    {% set display_tooltip = true %}
7
+    {% include 'default/categories.html' %}
7 8
 </form>