on master help sign in
Merge pull request #141 from Cqoicebordel/UX+Bugs+HTML
44409cbAdam Tauber
searx/templates/oscar/infobox.html+1−1
@@ -3,7 +3,7 @@
3 <h4 class="panel-title">{{ infobox.infobox }}</h4>
3 <h4 class="panel-title">{{ infobox.infobox }}</h4>
4 </div>
4 </div>
5 <div class="panel-body">
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 {% if infobox.content %}<p class="infobox_part">{{ infobox.content }}</p>{% endif %}
7 {% if infobox.content %}<p class="infobox_part">{{ infobox.content }}</p>{% endif %}
8
8
9 {% if infobox.attributes %}
9 {% if infobox.attributes %}
searx/templates/oscar/result_templates/default.html+3−3
@@ -1,9 +1,9 @@
1{% from 'oscar/macros.html' import icon %}
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−<small><a class="text-info" href="https://web.archive.org/web/{{ result.pretty_url }}">{{ icon('link') }} {{ _('cached') }}</a></small>
6+<small><a class="text-info" href="https://web.archive.org/web/{{ result.url }}">{{ icon('link') }} {{ _('cached') }}</a></small>
7
7
8{% if result.content %}<p class="result-content">{{ result.content|safe }}</p>{% endif %}
8{% if result.content %}<p class="result-content">{{ result.content|safe }}</p>{% endif %}
9
9
searx/templates/oscar/result_templates/images.html+2−2
@@ -1,5 +1,5 @@
1<a href="{{ result.img_src }}" data-toggle="modal" data-target="#modal-{{ index }}">
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</a>
3</a>
4
4
5<div class="modal fade" id="modal-{{ index }}" tabindex="-1" role="dialog" aria-hidden="true">
5<div class="modal fade" id="modal-{{ index }}" tabindex="-1" role="dialog" aria-hidden="true">
@@ -7,7 +7,7 @@
7 <div class="modal-content">
7 <div class="modal-content">
8 <div class="modal-header">
8 <div class="modal-header">
9 <button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">&times;</span><span class="sr-only">Close</span></button>
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 </div>
11 </div>
12 <div class="modal-body">
12 <div class="modal-body">
13 <img class="img-responsive center-block" src="{{ result.img_src }}" alt="{{ result.title }}">
13 <img class="img-responsive center-block" src="{{ result.img_src }}" alt="{{ result.title }}">
searx/templates/oscar/result_templates/map.html+2−2
@@ -1,8 +1,8 @@
1{% from 'oscar/macros.html' import icon %}
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<small><a class="text-info" href="https://web.archive.org/web/{{ result.pretty_url }}">{{ icon('link') }} {{ _('cached') }}</a></small>
7<small><a class="text-info" href="https://web.archive.org/web/{{ result.pretty_url }}">{{ icon('link') }} {{ _('cached') }}</a></small>
8
8
searx/templates/oscar/result_templates/torrent.html+3−3
@@ -1,9 +1,9 @@
1{% from 'oscar/macros.html' import icon %}
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−<small><a class="text-info" href="https://web.archive.org/web/{{ result.pretty_url }}">{{ icon('link') }} {{ _('cached') }}</a></small>
6+<small><a class="text-info" href="https://web.archive.org/web/{{ result.url }}">{{ icon('link') }} {{ _('cached') }}</a></small>
7
7
8<p class="result-content">{{ icon('transfer') }} {{ _('Seeder') }} <span class="badge">{{ result.seed }}</span>, {{ _('Leecher') }} <span class="badge">{{ result.leech }}</span>
8<p class="result-content">{{ icon('transfer') }} {{ _('Seeder') }} <span class="badge">{{ result.seed }}</span>, {{ _('Leecher') }} <span class="badge">{{ result.leech }}</span>
9<br/>
9<br/>
searx/templates/oscar/result_templates/videos.html+4−4
@@ -1,13 +1,13 @@
1{% from 'oscar/macros.html' import icon %}
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−<small><a class="text-info" href="https://web.archive.org/web/{{ result.pretty_url }}">{{ icon('link') }} {{ _('cached') }}</a></small>
6+<small><a class="text-info" href="https://web.archive.org/web/{{ result.url }}">{{ icon('link') }} {{ _('cached') }}</a></small>
7
7
8<div class="container-fluid">
8<div class="container-fluid">
9 <div class="row">
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 {% if result.content %}<p class="col-xs-12 col-sm-8 col-md-8 result-content">{{ result.content|safe }}</p>{% endif %}
11 {% if result.content %}<p class="col-xs-12 col-sm-8 col-md-8 result-content">{{ result.content|safe }}</p>{% endif %}
12 </div>
12 </div>
13</div>
13</div>
searx/templates/oscar/results.html+6−8
@@ -51,6 +51,11 @@
51 </div><!-- /#main_results -->
51 </div><!-- /#main_results -->
52
52
53 <div class="col-sm-4" id="sidebar_results">
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 {% if suggestions %}
60 {% if suggestions %}
56 <div class="panel panel-default">
61 <div class="panel panel-default">
@@ -76,7 +81,7 @@
76 <form role="form">
81 <form role="form">
77 <div class="form-group">
82 <div class="form-group">
78 <label for="search_url">{{ _('Search URL') }}</label>
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 </div>
85 </div>
81 </form>
86 </form>
82
87
@@ -94,13 +99,6 @@
94 <div class="clearfix"></div>
99 <div class="clearfix"></div>
95 </div>
100 </div>
96 </div>
101 </div>
97−
98− {% if infoboxes %}
99− {% for infobox in infoboxes %}
100− {% include 'oscar/infobox.html' %}
101− {% endfor %}
102− {% endif %}
103−
104 </div><!-- /#sidebar_results -->
102 </div><!-- /#sidebar_results -->
105 </div>
103 </div>
106{% endblock %}
104{% endblock %}
searx/webapp.py+3−6
@@ -294,10 +294,9 @@ def index():
294
294
295 # TODO, check if timezone is calculated right
295 # TODO, check if timezone is calculated right
296 if 'publishedDate' in result:
296 if 'publishedDate' in result:
297+ result['pubdate'] = result['publishedDate'].strftime('%Y-%m-%d %H:%M:%S%z')
297− if result['publishedDate'].replace(tzinfo=None)\
298+ if result['publishedDate'].replace(tzinfo=None) >= datetime.now() - timedelta(days=1):
298− >= datetime.now() - timedelta(days=1):
299− timedifference = datetime.now() - result['publishedDate']\
299+ timedifference = datetime.now() - result['publishedDate'].replace(tzinfo=None)
300− .replace(tzinfo=None)
301 minutes = int((timedifference.seconds / 60) % 60)
300 minutes = int((timedifference.seconds / 60) % 60)
302 hours = int(timedifference.seconds / 60 / 60)
301 hours = int(timedifference.seconds / 60 / 60)
303 if hours == 0:
302 if hours == 0:
@@ -305,8 +304,6 @@ def index():
305 else:
304 else:
306 result['publishedDate'] = gettext(u'{hours} hour(s), {minutes} minute(s) ago').format(hours=hours, minutes=minutes) # noqa
305 result['publishedDate'] = gettext(u'{hours} hour(s), {minutes} minute(s) ago').format(hours=hours, minutes=minutes) # noqa
307 else:
306 else:
308− result['pubdate'] = result['publishedDate']\
309− .strftime('%a, %d %b %Y %H:%M:%S %z')
310 result['publishedDate'] = format_date(result['publishedDate'])
307 result['publishedDate'] = format_date(result['publishedDate'])
311
308
312 if search.request_data.get('format') == 'json':
309 if search.request_data.get('format') == 'json':