From 98d639883c4c83288e1b762439c6b3604f713a15 Mon Sep 17 00:00:00 2001 From: Ben Busby <33362396+benbusby@users.noreply.github.com> Date: Tue, 26 May 2020 10:39:19 -0600 Subject: [PATCH] Fixing styling/url/safe mode inconsistencies --- app/filter.py | 7 +++++-- app/models/config.py | 2 +- app/routes.py | 1 + app/templates/header.html | 8 +++++++- 4 files changed, 14 insertions(+), 4 deletions(-) diff --git a/app/filter.py b/app/filter.py index 54029c5..0478889 100644 --- a/app/filter.py +++ b/app/filter.py @@ -12,6 +12,7 @@ LOGO_URL = GOOG_IMG + '_desk' BLANK_B64 = ''' data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAoAAAAKCAQAAAAnOwc2AAAAD0lEQVR42mNkwAIYh7IgAAVVAAuInjI5AAAAAElFTkSuQmCC ''' +GOOGLE_LINKS = ['/gmail', '/calendar', '/advanced_search'] def get_first_link(soup): @@ -174,8 +175,10 @@ class Filter: # Replace hrefs with only the intended destination (no "utm" type tags) for a in soup.find_all('a', href=True): href = a['href'].replace('https://www.google.com', '') - if '/advanced_search' in href: - a.decompose() + if href in GOOGLE_LINKS: + print(href) + if '/advanced_search' in href: + a.decompose() continue elif self.new_tab: a['target'] = '_blank' diff --git a/app/models/config.py b/app/models/config.py index 0976400..544d2d1 100644 --- a/app/models/config.py +++ b/app/models/config.py @@ -300,7 +300,7 @@ class Config: self.url = '' self.lang = 'lang_en' self.ctry = '' - self.safe = True + self.safe = False self.dark = False self.nojs = False self.near = '' diff --git a/app/routes.py b/app/routes.py index 3b99508..82b3147 100644 --- a/app/routes.py +++ b/app/routes.py @@ -144,6 +144,7 @@ def search(): response=formatted_results, search_header=render_template( 'header.html', + dark_mode=g.user_config.dark, q=urlparse.unquote(q), search_type=search_type, mobile=g.user_request.mobile) if 'isch' not in search_type else '') diff --git a/app/templates/header.html b/app/templates/header.html index 8db1459..5356ec2 100644 --- a/app/templates/header.html +++ b/app/templates/header.html @@ -12,6 +12,9 @@
@@ -34,7 +37,10 @@
+ spellcheck="false" type="text" value="{{ q }}" + style="background-color: {{ '#000' if dark_mode else '#fff' }}; + color: {{ '#685e79' if dark_mode else '#000' }}; + border: {{ '1px solid #685e79' if dark_mode else '' }}">