From d1f38cf9242e163febd0907c2080752459b7618a Mon Sep 17 00:00:00 2001 From: Ben Busby <33362396+benbusby@users.noreply.github.com> Date: Mon, 25 May 2020 10:33:24 -0600 Subject: [PATCH 1/2] Fixed styling of footer in dark mode --- app/routes.py | 3 +-- app/templates/index.html | 7 +++++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/app/routes.py b/app/routes.py index 7a4f4d2..c4f184f 100644 --- a/app/routes.py +++ b/app/routes.py @@ -61,9 +61,8 @@ def unknown_page(e): @app.route('/', methods=['GET']) @auth_required def index(): - bg = '#000' if g.user_config.dark else '#fff' return render_template('index.html', - bg=bg, + dark_mode=g.user_config.dark, ua=g.user_request.modified_user_agent, languages=Config.LANGUAGES, countries=Config.COUNTRIES, diff --git a/app/templates/index.html b/app/templates/index.html index ab46526..b4edf12 100644 --- a/app/templates/index.html +++ b/app/templates/index.html @@ -25,7 +25,7 @@ Whoogle Search - +
@@ -107,7 +107,10 @@
From 9212f9921aea09ea4d744a3e935676e52d4a72ef Mon Sep 17 00:00:00 2001 From: Ben Busby <33362396+benbusby@users.noreply.github.com> Date: Mon, 25 May 2020 10:53:15 -0600 Subject: [PATCH 2/2] Fixed #76 Added enter key submit on results page Added results type carryover for subsequent searches on results page Removed redundant header on image search results --- app/routes.py | 8 +++++++- app/templates/header.html | 4 ++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/app/routes.py b/app/routes.py index c4f184f..3b99508 100644 --- a/app/routes.py +++ b/app/routes.py @@ -133,14 +133,20 @@ def search(): else: formatted_results = content_filter.clean(dirty_soup) + # Set search type to be used in the header template to allow for repeated searches + # in the same category + search_type = request_params.get('tbm') if 'tbm' in request_params else '' + return render_template( 'display.html', query=urlparse.unquote(q), + search_type=search_type, response=formatted_results, search_header=render_template( 'header.html', q=urlparse.unquote(q), - mobile=g.user_request.mobile)) + search_type=search_type, + mobile=g.user_request.mobile) if 'isch' not in search_type else '') @app.route('/config', methods=['GET', 'POST']) diff --git a/app/templates/header.html b/app/templates/header.html index e106ffe..8db1459 100644 --- a/app/templates/header.html +++ b/app/templates/header.html @@ -13,6 +13,7 @@
+
@@ -34,6 +35,7 @@
+
@@ -48,6 +50,8 @@ searchBar.addEventListener("keyup", function (event) { if (event.keyCode !== 13) { handleUserInput(searchBar); + } else { + document.getElementById("search-form").submit(); } }); \ No newline at end of file