diff options
author | Adam Tauber <asciimoo@gmail.com> | 2014-12-08 23:48:01 +0100 |
---|---|---|
committer | Adam Tauber <asciimoo@gmail.com> | 2014-12-08 23:48:01 +0100 |
commit | 44409cb61f5677981feac10c344ea07fe20f718f (patch) | |
tree | d739241a041a8ce9989debc1b619889e2d584d81 | |
parent | 70981f8055ae636e577fa675e2c7d62af7103c09 (diff) | |
parent | 25c743f2afbf083d4ed715c7dc3f10d459b5205d (diff) | |
download | searxng-44409cb61f5677981feac10c344ea07fe20f718f.tar.gz searxng-44409cb61f5677981feac10c344ea07fe20f718f.zip |
Merge pull request #141 from Cqoicebordel/UX+Bugs+HTML
UX+bugs+html
-rw-r--r-- | searx/templates/oscar/infobox.html | 2 | ||||
-rw-r--r-- | searx/templates/oscar/result_templates/default.html | 6 | ||||
-rw-r--r-- | searx/templates/oscar/result_templates/images.html | 4 | ||||
-rw-r--r-- | searx/templates/oscar/result_templates/map.html | 4 | ||||
-rw-r--r-- | searx/templates/oscar/result_templates/torrent.html | 6 | ||||
-rw-r--r-- | searx/templates/oscar/result_templates/videos.html | 8 | ||||
-rw-r--r-- | searx/templates/oscar/results.html | 14 | ||||
-rw-r--r-- | searx/webapp.py | 9 |
8 files changed, 24 insertions, 29 deletions
diff --git a/searx/templates/oscar/infobox.html b/searx/templates/oscar/infobox.html index 541da8ba7..f352cd09d 100644 --- 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 index 3fe9b913c..0f090d862 100644 --- 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 index 91838cba0..7689f9f58 100644 --- 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">×</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 index 531146dc6..343e713c8 100644 --- 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 index a234a176a..1e133e3c4 100644 --- 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 index 0d6cf50aa..06275b86a 100644 --- 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 index deda276fa..69f8c9237 100644 --- 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 }}&pageno={{ pageno }}{% if selected_categories %}&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 index 57a16ff4f..9f09f51f5 100644 --- 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': |