logo

searx

My custom branche(s) on searx, a meta-search engine
commit: 44409cb61f5677981feac10c344ea07fe20f718f
parent: 70981f8055ae636e577fa675e2c7d62af7103c09
Author: Adam Tauber <asciimoo@gmail.com>
Date:   Mon,  8 Dec 2014 23:48:01 +0100

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

UX+bugs+html

Diffstat:

Msearx/templates/oscar/infobox.html2+-
Msearx/templates/oscar/result_templates/default.html6+++---
Msearx/templates/oscar/result_templates/images.html4++--
Msearx/templates/oscar/result_templates/map.html4++--
Msearx/templates/oscar/result_templates/torrent.html6+++---
Msearx/templates/oscar/result_templates/videos.html8++++----
Msearx/templates/oscar/results.html14++++++--------
Msearx/webapp.py9+++------
8 files changed, 24 insertions(+), 29 deletions(-)

diff --git a/searx/templates/oscar/infobox.html b/searx/templates/oscar/infobox.html @@ -3,7 +3,7 @@ <h4 class="panel-title">{{ infobox.infobox }}</h4> </div> <div class="panel-body"> - {% if infobox.img_src %}<img class="img-responsive center-block infobox_part" src="{{ infobox.img_src }}" />{% endif %} + {% if infobox.img_src %}<img class="img-responsive center-block infobox_part" src="{{ infobox.img_src }}" alt="{{ infobox.infobox }}" />{% endif %} {% if infobox.content %}<p class="infobox_part">{{ infobox.content }}</p>{% endif %} {% if infobox.attributes %} diff --git a/searx/templates/oscar/result_templates/default.html b/searx/templates/oscar/result_templates/default.html @@ -1,9 +1,9 @@ {% from 'oscar/macros.html' import icon %} -<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> +<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> -{% if result.publishedDate %}<time class="text-muted" datetime="{{ result.publishedDate }}" pubdate>{{ result.publishedDate }}</time>{% endif %} -<small><a class="text-info" href="https://web.archive.org/web/{{ result.pretty_url }}">{{ icon('link') }} {{ _('cached') }}</a></small> +{% if result.publishedDate %}<time class="text-muted" datetime="{{ result.pubdate }}" >{{ result.publishedDate }}</time>{% endif %} +<small><a class="text-info" href="https://web.archive.org/web/{{ result.url }}">{{ icon('link') }} {{ _('cached') }}</a></small> {% if result.content %}<p class="result-content">{{ result.content|safe }}</p>{% endif %} diff --git a/searx/templates/oscar/result_templates/images.html b/searx/templates/oscar/result_templates/images.html @@ -1,5 +1,5 @@ <a href="{{ result.img_src }}" data-toggle="modal" data-target="#modal-{{ index }}"> - <img src="{{ result.img_src }}" alt="{{ result.title|e }}" class="img-thumbnail"> + <img src="{{ result.img_src }}" alt="{{ result.title|striptags }}" title="{{ result.title|striptags }}" class="img-thumbnail"> </a> <div class="modal fade" id="modal-{{ index }}" tabindex="-1" role="dialog" aria-hidden="true"> @@ -7,7 +7,7 @@ <div class="modal-content"> <div class="modal-header"> <button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">&times;</span><span class="sr-only">Close</span></button> - <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> + <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> </div> <div class="modal-body"> <img class="img-responsive center-block" src="{{ result.img_src }}" alt="{{ result.title }}"> diff --git a/searx/templates/oscar/result_templates/map.html b/searx/templates/oscar/result_templates/map.html @@ -1,8 +1,8 @@ {% from 'oscar/macros.html' import icon %} -<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> +<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> -{% if result.publishedDate %}<time class="text-muted" datetime="{{ result.publishedDate }}" pubdate>{{ result.publishedDate }}</time>{% endif %} +{% if result.publishedDate %}<time class="text-muted" datetime="{{ result.pubdate }}" >{{ result.publishedDate }}</time>{% endif %} <small><a class="text-info" href="https://web.archive.org/web/{{ result.pretty_url }}">{{ icon('link') }} {{ _('cached') }}</a></small> diff --git a/searx/templates/oscar/result_templates/torrent.html b/searx/templates/oscar/result_templates/torrent.html @@ -1,9 +1,9 @@ {% from 'oscar/macros.html' import icon %} -<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> +<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> -{% if result.publishedDate %}<time class="text-muted" datetime="{{ result.publishedDate }}" pubdate>{{ result.publishedDate }}</time>{% endif %} -<small><a class="text-info" href="https://web.archive.org/web/{{ result.pretty_url }}">{{ icon('link') }} {{ _('cached') }}</a></small> +{% if result.publishedDate %}<time class="text-muted" datetime="{{ result.pubdate }}" >{{ result.publishedDate }}</time>{% endif %} +<small><a class="text-info" href="https://web.archive.org/web/{{ result.url }}">{{ icon('link') }} {{ _('cached') }}</a></small> <p class="result-content">{{ icon('transfer') }} {{ _('Seeder') }} <span class="badge">{{ result.seed }}</span>, {{ _('Leecher') }} <span class="badge">{{ result.leech }}</span> <br/> diff --git a/searx/templates/oscar/result_templates/videos.html b/searx/templates/oscar/result_templates/videos.html @@ -1,13 +1,13 @@ {% from 'oscar/macros.html' import icon %} -<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> +<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> -{% if result.publishedDate %}<time class="text-muted" datetime="{{ result.publishedDate }}" pubdate>{{ result.publishedDate }}</time>{% endif %} -<small><a class="text-info" href="https://web.archive.org/web/{{ result.pretty_url }}">{{ icon('link') }} {{ _('cached') }}</a></small> +{% if result.publishedDate %}<time class="text-muted" datetime="{{ result.pubdate }}" >{{ result.publishedDate }}</time>{% endif %} +<small><a class="text-info" href="https://web.archive.org/web/{{ result.url }}">{{ icon('link') }} {{ _('cached') }}</a></small> <div class="container-fluid"> <div class="row"> - <img class="thumbnail col-xs-6 col-sm-4 col-md-4 result-content" src="{{ result.thumbnail|safe }}" /> + <img class="thumbnail col-xs-6 col-sm-4 col-md-4 result-content" src="{{ result.thumbnail|safe }}" alt="{{ result.title|urlencode }} {{ result['favicon'] }}" /> {% if result.content %}<p class="col-xs-12 col-sm-8 col-md-8 result-content">{{ result.content|safe }}</p>{% endif %} </div> </div> diff --git a/searx/templates/oscar/results.html b/searx/templates/oscar/results.html @@ -51,6 +51,11 @@ </div><!-- /#main_results --> <div class="col-sm-4" id="sidebar_results"> + {% if infoboxes %} + {% for infobox in infoboxes %} + {% include 'oscar/infobox.html' %} + {% endfor %} + {% endif %} {% if suggestions %} <div class="panel panel-default"> @@ -76,7 +81,7 @@ <form role="form"> <div class="form-group"> <label for="search_url">{{ _('Search URL') }}</label> - <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> + <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> </div> </form> @@ -94,13 +99,6 @@ <div class="clearfix"></div> </div> </div> - - {% if infoboxes %} - {% for infobox in infoboxes %} - {% include 'oscar/infobox.html' %} - {% endfor %} - {% endif %} - </div><!-- /#sidebar_results --> </div> {% endblock %} diff --git a/searx/webapp.py b/searx/webapp.py @@ -294,10 +294,9 @@ def index(): # TODO, check if timezone is calculated right if 'publishedDate' in result: - if result['publishedDate'].replace(tzinfo=None)\ - >= datetime.now() - timedelta(days=1): - timedifference = datetime.now() - result['publishedDate']\ - .replace(tzinfo=None) + result['pubdate'] = result['publishedDate'].strftime('%Y-%m-%d %H:%M:%S%z') + if result['publishedDate'].replace(tzinfo=None) >= datetime.now() - timedelta(days=1): + timedifference = datetime.now() - result['publishedDate'].replace(tzinfo=None) minutes = int((timedifference.seconds / 60) % 60) hours = int(timedifference.seconds / 60 / 60) if hours == 0: @@ -305,8 +304,6 @@ def index(): else: result['publishedDate'] = gettext(u'{hours} hour(s), {minutes} minute(s) ago').format(hours=hours, minutes=minutes) # noqa else: - result['pubdate'] = result['publishedDate']\ - .strftime('%a, %d %b %Y %H:%M:%S %z') result['publishedDate'] = format_date(result['publishedDate']) if search.request_data.get('format') == 'json':