瀏覽代碼

Merge pull request #141 from Cqoicebordel/UX+Bugs+HTML

UX+bugs+html
Adam Tauber 10 年之前
父節點
當前提交
44409cb61f

+ 1
- 1
searx/templates/oscar/infobox.html 查看文件

@@ -3,7 +3,7 @@
3 3
         <h4 class="panel-title">{{ infobox.infobox }}</h4>
4 4
     </div>
5 5
     <div class="panel-body">
6
-        {% if infobox.img_src %}<img class="img-responsive center-block infobox_part" src="{{ infobox.img_src }}" />{% endif %}
6
+        {% if infobox.img_src %}<img class="img-responsive center-block infobox_part" src="{{ infobox.img_src }}" alt="{{ infobox.infobox }}" />{% endif %}
7 7
         {% if infobox.content %}<p class="infobox_part">{{ infobox.content }}</p>{% endif %}
8 8
 
9 9
         {% if infobox.attributes %}

+ 3
- 3
searx/templates/oscar/result_templates/default.html 查看文件

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

+ 2
- 2
searx/templates/oscar/result_templates/images.html 查看文件

@@ -1,5 +1,5 @@
1 1
 <a href="{{ result.img_src }}" data-toggle="modal" data-target="#modal-{{ index }}">
2
-    <img src="{{ result.img_src }}" alt="{{ result.title|e }}" class="img-thumbnail">
2
+    <img src="{{ result.img_src }}" alt="{{ result.title|striptags }}" title="{{ result.title|striptags }}" class="img-thumbnail">
3 3
 </a>
4 4
 
5 5
 <div class="modal fade" id="modal-{{ index }}" tabindex="-1" role="dialog" aria-hidden="true">
@@ -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'] %}<img width="32" height="32" class="favicon" src="static/{{ theme }}/img/icons/{{ result['favicon'] }}.png" /> {% endif %}{{ result.title|striptags }}</h4>
10
+                <h4 class="modal-title">{% if result['favicon'] %}<img width="32" height="32" class="favicon" src="static/{{ theme }}/img/icons/{{ result['favicon'] }}.png" alt="{{ result['favicon'] }}" /> {% 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 }}">

+ 2
- 2
searx/templates/oscar/result_templates/map.html 查看文件

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

+ 3
- 3
searx/templates/oscar/result_templates/torrent.html 查看文件

@@ -1,9 +1,9 @@
1 1
 {% from 'oscar/macros.html' import icon %}
2 2
 
3
-<h4 class="result_header">{% if result['favicon'] %}<img width="32" height="32" class="favicon" src="static/{{ theme }}/img/icons/{{ result['favicon'] }}.png" /> {% endif %}<a href="{{ result.url }}">{{ result.title|safe }}</a></h4>
3
+<h4 class="result_header">{% if result['favicon'] %}<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>
4 4
 
5
-{% if result.publishedDate %}<time class="text-muted" datetime="{{ result.publishedDate }}" pubdate>{{ result.publishedDate }}</time>{% endif %}
6
-<small><a class="text-info" href="https://web.archive.org/web/{{ result.pretty_url }}">{{ icon('link') }} {{ _('cached') }}</a></small>
5
+{% if result.publishedDate %}<time class="text-muted" datetime="{{ result.pubdate }}" >{{ result.publishedDate }}</time>{% endif %}
6
+<small><a class="text-info" href="https://web.archive.org/web/{{ result.url }}">{{ icon('link') }} {{ _('cached') }}</a></small>
7 7
 
8 8
 <p class="result-content">{{ icon('transfer') }} {{ _('Seeder') }} <span class="badge">{{ result.seed }}</span>, {{ _('Leecher') }} <span class="badge">{{ result.leech }}</span>
9 9
 <br/>

+ 4
- 4
searx/templates/oscar/result_templates/videos.html 查看文件

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

+ 6
- 8
searx/templates/oscar/results.html 查看文件

@@ -51,6 +51,11 @@
51 51
         </div><!-- /#main_results -->
52 52
 
53 53
         <div class="col-sm-4" id="sidebar_results">
54
+            {% if infoboxes %}
55
+                {% for infobox in infoboxes %}
56
+                    {% include 'oscar/infobox.html' %}
57
+                {% endfor %}
58
+            {% endif %} 
54 59
 
55 60
             {% if suggestions %}
56 61
             <div class="panel panel-default">
@@ -76,7 +81,7 @@
76 81
                     <form role="form">
77 82
                         <div class="form-group">
78 83
                             <label for="search_url">{{ _('Search URL') }}</label>
79
-                            <input type="url" class="form-control select-all-on-click cursor-text" name="search_url" value="{{ base_url }}?q={{ q|urlencode }}&pageno={{ pageno }}{% if selected_categories %}&category_{{ selected_categories|join("&category_") }}{% endif %}" readonly>
84
+                            <input id="search_url" type="url" class="form-control select-all-on-click cursor-text" name="search_url" value="{{ base_url }}?q={{ q|urlencode }}&amp;pageno={{ pageno }}{% if selected_categories %}&amp;category_{{ selected_categories|join("&category_")|replace(' ','+') }}{% endif %}" readonly>
80 85
                         </div>
81 86
                     </form>
82 87
                     
@@ -94,13 +99,6 @@
94 99
                     <div class="clearfix"></div>
95 100
                 </div>
96 101
             </div>
97
-        
98
-        {% if infoboxes %}
99
-            {% for infobox in infoboxes %}
100
-                {% include 'oscar/infobox.html' %}
101
-            {% endfor %}
102
-        {% endif %}    
103
-        
104 102
         </div><!-- /#sidebar_results -->
105 103
     </div>
106 104
 {% endblock %}

+ 3
- 6
searx/webapp.py 查看文件

@@ -294,10 +294,9 @@ def index():
294 294
 
295 295
         # TODO, check if timezone is calculated right
296 296
         if 'publishedDate' in result:
297
-            if result['publishedDate'].replace(tzinfo=None)\
298
-               >= datetime.now() - timedelta(days=1):
299
-                timedifference = datetime.now() - result['publishedDate']\
300
-                    .replace(tzinfo=None)
297
+            result['pubdate'] = result['publishedDate'].strftime('%Y-%m-%d %H:%M:%S%z')
298
+            if result['publishedDate'].replace(tzinfo=None) >= datetime.now() - timedelta(days=1):
299
+                timedifference = datetime.now() - result['publishedDate'].replace(tzinfo=None)
301 300
                 minutes = int((timedifference.seconds / 60) % 60)
302 301
                 hours = int(timedifference.seconds / 60 / 60)
303 302
                 if hours == 0:
@@ -305,8 +304,6 @@ def index():
305 304
                 else:
306 305
                     result['publishedDate'] = gettext(u'{hours} hour(s), {minutes} minute(s) ago').format(hours=hours, minutes=minutes)  # noqa
307 306
             else:
308
-                result['pubdate'] = result['publishedDate']\
309
-                    .strftime('%a, %d %b %Y %H:%M:%S %z')
310 307
                 result['publishedDate'] = format_date(result['publishedDate'])
311 308
 
312 309
     if search.request_data.get('format') == 'json':