Selaa lähdekoodia

Final commit on favicons

Definitely remove engine array
Change every themes to accomodate that change
Tweak of video template of oscar to add link on video thumbnail
Cqoicebordel 10 vuotta sitten
vanhempi
commit
83d6f36659

+ 2
- 2
searx/templates/courgette/result_templates/default.html Näytä tiedosto

@@ -1,7 +1,7 @@
1 1
 <div class="result {{ result.class }}">
2 2
 
3
-  {% if result['favicon'] %}
4
-    <img width="14" height="14" class="favicon" src="static/{{theme}}/img/icon_{{result['favicon']}}.ico" />
3
+  {% if "icon_"~result.engine~".ico" in favicons %}
4
+    <img width="14" height="14" class="favicon" src="static/{{theme}}/img/icon_{{result.engine}}.ico" alt="{{result.engine}}" />
5 5
   {% endif %}
6 6
 
7 7
   <div>

+ 2
- 2
searx/templates/courgette/result_templates/map.html Näytä tiedosto

@@ -1,7 +1,7 @@
1 1
 <div class="result {{ result.class }}">
2 2
 
3
-  {% if result['favicon'] %}
4
-    <img width="14" height="14" class="favicon" src="static/{{theme}}/img/icon_{{result['favicon']}}.ico" />
3
+  {% if "icon_"~result.engine~".ico" in favicons %}
4
+    <img width="14" height="14" class="favicon" src="static/{{theme}}/img/icon_{{result.engine}}.ico" alt="{{result.engine}}" />
5 5
   {% endif %}
6 6
 
7 7
   <div>

+ 3
- 5
searx/templates/courgette/result_templates/videos.html Näytä tiedosto

@@ -1,12 +1,10 @@
1 1
 <div class="result">
2
-  {% if result['favicon'] %}
3
-    <img width="14" height="14" class="favicon" src="static/{{theme}}/img/icon_{{result['favicon']}}.ico" />
2
+  {% if "icon_"~result.engine~".ico" in favicons %}
3
+    <img width="14" height="14" class="favicon" src="static/{{theme}}/img/icon_{{result.engine}}.ico" alt="{{result.engine}}" />
4 4
   {% endif %}
5 5
 
6
-    <p>
7 6
       <h3 class="result_title"><a href="{{ result.url }}">{{ result.title|safe }}</a></h3>
8 7
       {% if result.publishedDate %}<p class="published_date">{{ result.publishedDate }}</p>{% endif %}
9
-      <a href="{{ result.url }}"><img width="400px" src="{{ result.thumbnail }}" title={{ result.title }} alt=" {{ result.title }}"/></a>
8
+      <a href="{{ result.url }}"><img width="400" src="{{ result.thumbnail }}" title="{{ result.title|striptags }}" alt="{{ result.title|striptags }}"/></a>
10 9
       <p class="url">{{ result.url }}</p>
11
-    </p>
12 10
 </div>

+ 1
- 1
searx/templates/default/result_templates/default.html Näytä tiedosto

@@ -1,5 +1,5 @@
1 1
 <div class="result {{ result.class }}">
2
-    <h3 class="result_title"> {% if result['favicon'] %}<img width="14" height="14" class="favicon" src="static/{{theme}}/img/icon_{{result['favicon']}}.ico" />{% endif %}<a href="{{ result.url }}">{{ result.title|safe }}</a></h3>
2
+    <h3 class="result_title">{% if "icon_"~result.engine~".ico" in favicons %}<img width="14" height="14" class="favicon" src="static/{{theme}}/img/icon_{{result.engine}}.ico" alt="{{result.engine}}" />{% endif %}<a href="{{ result.url }}">{{ result.title|safe }}</a></h3>
3 3
     <p class="url">{{ result.pretty_url }} <a class="cache_link" href="https://web.archive.org/web/{{ result.url }}">cached</a></p>
4 4
     {% if result.publishedDate %}<p class="published_date">{{ result.publishedDate }}</p>{% endif %}
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>

+ 2
- 2
searx/templates/default/result_templates/map.html Näytä tiedosto

@@ -1,7 +1,7 @@
1 1
 <div class="result {{ result.class }}">
2 2
 
3
-  {% if result['favicon'] %}
4
-    <img width="14" height="14" class="favicon" src="static/{{theme}}/img/icon_{{result['favicon']}}.ico" />
3
+  {% if "icon_"~result.engine~".ico" in favicons %}
4
+    <img width="14" height="14" class="favicon" src="static/{{theme}}/img/icon_{{result.engine}}.ico" alt="{{result.engine}}" />
5 5
   {% endif %}
6 6
 
7 7
   <div>

+ 2
- 4
searx/templates/default/result_templates/videos.html Näytä tiedosto

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

+ 1
- 1
searx/templates/oscar/result_templates/default.html Näytä tiedosto

@@ -1,6 +1,6 @@
1 1
 {% from 'oscar/macros.html' import icon %}
2 2
 
3
-<h4 class="result_header">{% if result['favicon']~".png" in favicons %}<img width="32" height="32" class="favicon" src="static/{{ theme }}/img/icons/{{ result['favicon'] }}.png" alt="{{ result['favicon'] }}" /> {% endif %}<a href="{{ result.url }}">{{ result.title|safe }}</a></h4>
3
+<h4 class="result_header">{% if result.engine~".png" in favicons %}<img width="32" height="32" class="favicon" src="static/{{ theme }}/img/icons/{{ result.engine }}.png" alt="{{ result.engine }}" /> {% endif %}<a href="{{ result.url }}">{{ result.title|safe }}</a></h4>
4 4
 
5 5
 {% if result.publishedDate %}<time class="text-muted" datetime="{{ result.pubdate }}" >{{ result.publishedDate }}</time>{% endif %}
6 6
 <small><a class="text-info" href="https://web.archive.org/web/{{ result.url }}">{{ icon('link') }} {{ _('cached') }}</a></small>

+ 1
- 1
searx/templates/oscar/result_templates/images.html Näytä tiedosto

@@ -7,7 +7,7 @@
7 7
         <div class="modal-content">
8 8
             <div class="modal-header">
9 9
                 <button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">&times;</span><span class="sr-only">Close</span></button>
10
-                <h4 class="modal-title">{% if result['favicon']~".png" in favicons %}<img width="32" height="32" class="favicon" src="static/{{ theme }}/img/icons/{{ result['favicon'] }}.png" alt="{{ result['favicon'] }}" /> {% endif %}{{ result.title|striptags }}</h4>
10
+                <h4 class="modal-title">{% if result.engine~".png" in favicons %}<img width="32" height="32" class="favicon" src="static/{{ theme }}/img/icons/{{ result.engine }}.png" alt="{{ result.engine }}" /> {% endif %}{{ result.title|striptags }}</h4>
11 11
             </div>
12 12
             <div class="modal-body">
13 13
                 <img class="img-responsive center-block" src="{{ result.img_src }}" alt="{{ result.title }}">

+ 1
- 1
searx/templates/oscar/result_templates/map.html Näytä tiedosto

@@ -1,6 +1,6 @@
1 1
 {% from 'oscar/macros.html' import icon %}
2 2
 
3
-<h4 class="result_header">{% if result['favicon']~".png" in favicons %}<img width="32" height="32" class="favicon" src="static/{{ theme }}/img/icons/{{ result['favicon'] }}.png" alt="{{ result['favicon'] }}" /> {% endif %}<a href="{{ result.url }}">{{ result.title|safe }}</a></h4>
3
+<h4 class="result_header">{% if result.engine~".png" in favicons %}<img width="32" height="32" class="favicon" src="static/{{ theme }}/img/icons/{{ result.engine }}.png" alt="{{ result.engine }}" /> {% endif %}<a href="{{ result.url }}">{{ result.title|safe }}</a></h4>
4 4
 
5 5
 {% if result.publishedDate %}<time class="text-muted" datetime="{{ result.pubdate }}" >{{ result.publishedDate }}</time>{% endif %}
6 6
 

+ 1
- 1
searx/templates/oscar/result_templates/torrent.html Näytä tiedosto

@@ -1,6 +1,6 @@
1 1
 {% from 'oscar/macros.html' import icon %}
2 2
 
3
-<h4 class="result_header">{% if result['favicon']~".png" in favicons %}<img width="32" height="32" class="favicon" src="static/{{ theme }}/img/icons/{{ result['favicon'] }}.png" alt="{{ result['favicon'] }}" /> {% endif %}<a href="{{ result.url }}">{{ result.title|safe }}</a></h4>
3
+<h4 class="result_header">{% if result.engine~".png" in favicons %}<img width="32" height="32" class="favicon" src="static/{{ theme }}/img/icons/{{ result.engine }}.png" alt="{{ result.engine }}" /> {% endif %}<a href="{{ result.url }}">{{ result.title|safe }}</a></h4>
4 4
 
5 5
 {% if result.publishedDate %}<time class="text-muted" datetime="{{ result.pubdate }}" >{{ result.publishedDate }}</time>{% endif %}
6 6
 <small><a class="text-info" href="https://web.archive.org/web/{{ result.url }}">{{ icon('link') }} {{ _('cached') }}</a></small>

+ 2
- 2
searx/templates/oscar/result_templates/videos.html Näytä tiedosto

@@ -1,13 +1,13 @@
1 1
 {% from 'oscar/macros.html' import icon %}
2 2
 
3
-<h4 class="result_header">{% if result['favicon']~".png" in favicons %}<img width="32" height="32" class="favicon" src="static/{{ theme }}/img/icons/{{ result['favicon'] }}.png" alt="{{ result['favicon'] }}" /> {% endif %}<a href="{{ result.url }}">{{ result.title|safe }}</a></h4>
3
+<h4 class="result_header">{% if result.engine~".png" in favicons %}<img width="32" height="32" class="favicon" src="static/{{ theme }}/img/icons/{{ result.engine }}.png" alt="{{ result.engine }}" /> {% endif %}<a href="{{ result.url }}">{{ result.title|safe }}</a></h4>
4 4
     
5 5
 {% if result.publishedDate %}<time class="text-muted" datetime="{{ result.pubdate }}" >{{ result.publishedDate }}</time>{% endif %}
6 6
 <small><a class="text-info" href="https://web.archive.org/web/{{ result.url }}">{{ icon('link') }} {{ _('cached') }}</a></small>
7 7
 
8 8
 <div class="container-fluid">
9 9
     <div class="row">
10
-        <img class="thumbnail col-xs-6 col-sm-4 col-md-4 result-content" src="{{ result.thumbnail|safe }}" alt="{{ result.title|urlencode }} {{ result['favicon'] }}" />
10
+        <a href="{{ result.url }}"><img class="thumbnail col-xs-6 col-sm-4 col-md-4 result-content" src="{{ result.thumbnail|safe }}" alt="{{ result.title|striptags }} {{ result.engine }}" /></a>
11 11
         {% if result.content %}<p class="col-xs-12 col-sm-8 col-md-8 result-content">{{ result.content|safe }}</p>{% endif %}
12 12
     </div>
13 13
 </div>

+ 0
- 8
searx/webapp.py Näytä tiedosto

@@ -68,10 +68,6 @@ app.secret_key = settings['server']['secret_key']
68 68
 
69 69
 babel = Babel(app)
70 70
 
71
-#TODO configurable via settings.yml
72
-favicons = ['wikipedia', 'youtube', 'vimeo', 'dailymotion', 'soundcloud',
73
-            'twitter', 'stackoverflow', 'github', 'deviantart']
74
-            
75 71
 global_favicons = []
76 72
 for indice,theme in enumerate(themes):
77 73
     global_favicons.append([])
@@ -294,10 +290,6 @@ def index():
294 290
             result['pretty_url'] = u'{0}[...]{1}'.format(*url_parts)
295 291
         else:
296 292
             result['pretty_url'] = result['url']
297
-
298
-        for engine in result['engines']:
299
-            if engine in favicons:
300
-                result['favicon'] = engine
301 293
                 
302 294
         # TODO, check if timezone is calculated right
303 295
         if 'publishedDate' in result: