Fixing styling/url/safe mode inconsistencies

pull/85/head
Ben Busby 4 years ago
parent 77c4920e83
commit 98d639883c

@ -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'

@ -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 = ''

@ -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 '')

@ -12,6 +12,9 @@
<div class="H0PQec" style="width: 100%;">
<div class="sbc esbc autocomplete">
<input id="search-bar" autocapitalize="none" autocomplete="off" class="noHIxc" name="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 '' }}"
spellcheck="false" type="text" value="{{ q }}">
<input name="tbm" value="{{ search_type }}" style="display: none">
<div class="sc"></div>
@ -34,7 +37,10 @@
<div class="autocomplete" style="width: 100%; flex: 1">
<div style="width: 100%; display: flex">
<input id="search-bar" autocapitalize="none" autocomplete="off" class="noHIxc" name="q"
spellcheck="false" type="text" value="{{ q }}">
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 '' }}">
<input name="tbm" value="{{ search_type }}" style="display: none">
<div class="sc"></div>
</div>

Loading…
Cancel
Save