From c2e88339f7bb84e719e943b427a9afcdd84981aa Mon Sep 17 00:00:00 2001 From: Cqoicebordel Date: Mon, 8 Dec 2014 00:51:46 +0100 Subject: [PATCH 1/9] Add pubdate Add pubdate with a good format, against publishedDate. --- searx/webapp.py | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) 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': From 34b5d9566988652063c27b48d45b1cd02ddb3be5 Mon Sep 17 00:00:00 2001 From: Cqoicebordel Date: Mon, 8 Dec 2014 01:01:33 +0100 Subject: [PATCH 2/9] UX and HTML corrections Put the infobox first. Result first is more useful for the user. Add id in form for "for". htmlentities in the URL. Take care of spaces in categories. --- searx/templates/oscar/results.html | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) 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 @@ - - {% if infoboxes %} - {% for infobox in infoboxes %} - {% include 'oscar/infobox.html' %} - {% endfor %} - {% endif %} - {% endblock %} From 42692aa2c505463c3a35456a247ff71c42061213 Mon Sep 17 00:00:00 2001 From: Cqoicebordel Date: Mon, 8 Dec 2014 01:03:28 +0100 Subject: [PATCH 3/9] Add alt for img Add alt in infobox image. --- searx/templates/oscar/infobox.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 @@

{{ infobox.infobox }}

- {% if infobox.img_src %}{% endif %} + {% if infobox.img_src %}{{ infobox.infobox }}{% endif %} {% if infobox.content %}

{{ infobox.content }}

{% endif %} {% if infobox.attributes %} From 0a2051ef3cdbefb6fafcca9e34f9fd89638be189 Mon Sep 17 00:00:00 2001 From: Cqoicebordel Date: Mon, 8 Dec 2014 01:09:16 +0100 Subject: [PATCH 4/9] Bug + HTML corrections Add alt for favicon Correct datetime format Remove pubdate (not in html5 spec) Don't use pretty_url for web.archive.org. --- searx/templates/oscar/result_templates/default.html | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) 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 %} -

{% if result['favicon'] %} {% endif %}{{ result.title|safe }}

+

{% if result['favicon'] %}{{ result['favicon'] }} {% endif %}{{ result.title|safe }}

-{% if result.publishedDate %}{% endif %} -{{ icon('link') }} {{ _('cached') }} +{% if result.publishedDate %}{% endif %} +{{ icon('link') }} {{ _('cached') }} {% if result.content %}

{{ result.content|safe }}

{% endif %} From 977972a8ec49cd067b4670c1acdc03b1642aefb3 Mon Sep 17 00:00:00 2001 From: Cqoicebordel Date: Mon, 8 Dec 2014 01:11:45 +0100 Subject: [PATCH 5/9] UX + HTML corrections Add title on image for hover Add alt on favicon --- searx/templates/oscar/result_templates/images.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/searx/templates/oscar/result_templates/images.html b/searx/templates/oscar/result_templates/images.html index 91838cba0..9dfe3d337 100644 --- a/searx/templates/oscar/result_templates/images.html +++ b/searx/templates/oscar/result_templates/images.html @@ -1,5 +1,5 @@ - {{ result.title|e }} + {{ result.title|e }}