adds theme to routes and Index.html
This commit is contained in:
parent
fbd14c0a55
commit
4d55a56189
|
@ -15,6 +15,7 @@ class Filter:
|
||||||
self.near = config['near'] if 'near' in config else ''
|
self.near = config['near'] if 'near' in config else ''
|
||||||
self.dark = config['dark'] if 'dark' in config else False
|
self.dark = config['dark'] if 'dark' in config else False
|
||||||
self.nojs = config['nojs'] if 'nojs' in config else False
|
self.nojs = config['nojs'] if 'nojs' in config else False
|
||||||
|
self.theme = config['theme'] if 'theme' in config else None
|
||||||
self.new_tab = config['new_tab'] if 'new_tab' in config else False
|
self.new_tab = config['new_tab'] if 'new_tab' in config else False
|
||||||
self.alt_redirect = config['alts'] if 'alts' in config else False
|
self.alt_redirect = config['alts'] if 'alts' in config else False
|
||||||
self.mobile = mobile
|
self.mobile = mobile
|
||||||
|
@ -35,7 +36,7 @@ class Filter:
|
||||||
pattern = re.compile('4285f4|ea4335|fbcc05|34a853|fbbc05', re.IGNORECASE)
|
pattern = re.compile('4285f4|ea4335|fbcc05|34a853|fbbc05', re.IGNORECASE)
|
||||||
page = pattern.sub('685e79', page)
|
page = pattern.sub('685e79', page)
|
||||||
if self.dark:
|
if self.dark:
|
||||||
page = page.replace('fff', '000').replace('202124', 'ddd').replace('1967D2', '3b85ea')
|
page = page.replace('fff', '2E3440').replace('202124', 'ddd').replace('1967D2', '3b85ea')
|
||||||
|
|
||||||
return page
|
return page
|
||||||
|
|
||||||
|
|
|
@ -312,7 +312,7 @@ class Config:
|
||||||
self.dark = False
|
self.dark = False
|
||||||
self.nojs = False
|
self.nojs = False
|
||||||
self.near = ''
|
self.near = ''
|
||||||
self.theme = None
|
self.theme = 'whoogle'
|
||||||
self.alts = False
|
self.alts = False
|
||||||
self.new_tab = False
|
self.new_tab = False
|
||||||
self.get_only = False
|
self.get_only = False
|
||||||
|
|
|
@ -59,7 +59,7 @@ def before_request_func():
|
||||||
|
|
||||||
if https_only and request.url.startswith('http://'):
|
if https_only and request.url.startswith('http://'):
|
||||||
return redirect(request.url.replace('http://', 'https://', 1), code=308)
|
return redirect(request.url.replace('http://', 'https://', 1), code=308)
|
||||||
|
|
||||||
g.user_config = Config(**session['config'])
|
g.user_config = Config(**session['config'])
|
||||||
|
|
||||||
if not g.user_config.url:
|
if not g.user_config.url:
|
||||||
|
@ -104,6 +104,7 @@ def index():
|
||||||
return render_template('index.html',
|
return render_template('index.html',
|
||||||
languages=Config.LANGUAGES,
|
languages=Config.LANGUAGES,
|
||||||
countries=Config.COUNTRIES,
|
countries=Config.COUNTRIES,
|
||||||
|
themes=Config.THEMES,
|
||||||
config=g.user_config,
|
config=g.user_config,
|
||||||
version_number=app.config['VERSION_NUMBER'])
|
version_number=app.config['VERSION_NUMBER'])
|
||||||
|
|
||||||
|
@ -160,11 +161,13 @@ def search():
|
||||||
query=urlparse.unquote(query),
|
query=urlparse.unquote(query),
|
||||||
search_type=search_util.search_type,
|
search_type=search_util.search_type,
|
||||||
dark_mode=g.user_config.dark,
|
dark_mode=g.user_config.dark,
|
||||||
|
theme=g.user_config.theme,
|
||||||
response=response,
|
response=response,
|
||||||
version_number=app.config['VERSION_NUMBER'],
|
version_number=app.config['VERSION_NUMBER'],
|
||||||
search_header=render_template(
|
search_header=render_template(
|
||||||
'header.html',
|
'header.html',
|
||||||
dark_mode=g.user_config.dark,
|
dark_mode=g.user_config.dark,
|
||||||
|
theme=g.user_config.theme,
|
||||||
query=urlparse.unquote(query),
|
query=urlparse.unquote(query),
|
||||||
search_type=search_util.search_type,
|
search_type=search_util.search_type,
|
||||||
mobile=g.user_request.mobile) if 'isch' not in search_util.search_type else '')
|
mobile=g.user_request.mobile) if 'isch' not in search_util.search_type else '')
|
||||||
|
|
|
@ -1,26 +1,33 @@
|
||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
<link rel="shortcut icon" href="/static/img/favicon.ico" type="image/x-icon">
|
<link rel="shortcut icon" href="/static/img/favicon.ico" type="image/x-icon">
|
||||||
<link rel="icon" href="/static/img/favicon.ico" type="image/x-icon">
|
<link rel="icon" href="/static/img/favicon.ico" type="image/x-icon">
|
||||||
<link rel="search" href="/opensearch.xml" type="application/opensearchdescription+xml" title="Whoogle Search">
|
<link rel="search" href="/opensearch.xml" type="application/opensearchdescription+xml" title="Whoogle Search">
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
<meta name="referrer" content="no-referrer">
|
<meta name="referrer" content="no-referrer">
|
||||||
<script type="text/javascript" src="/static/js/autocomplete.js"></script>
|
<script type="text/javascript" src="/static/js/autocomplete.js"></script>
|
||||||
<link rel="stylesheet" href="/static/css/{{ 'search-dark' if dark_mode else 'search' }}.css">
|
{% if theme %}
|
||||||
<link rel="stylesheet" href="/static/css/header.css">
|
<link rel="stylesheet" href="/static/css/{{'theme/' if theme else ''}}{{ 'search-dark' if dark_mode else 'search' }}.css" />
|
||||||
{% if dark_mode %}
|
{% else %}
|
||||||
<link rel="stylesheet" href="/static/css/dark-theme.css"/>
|
<link rel="stylesheet" href="/static/css/{{ 'dark-' if dark_mode else '' }}theme.css" />
|
||||||
{% endif %}
|
{% endif %}
|
||||||
<title>{{ query }} - Whoogle Search</title>
|
<link rel="stylesheet" href="/static/css/{{ 'search-dark' if dark_mode else 'search' }}.css">
|
||||||
</head>
|
<link rel="stylesheet" href="/static/css/header.css">
|
||||||
<body>
|
{% if theme %}
|
||||||
|
<link rel="stylesheet" href="/static/css/themes/{{theme}}{{ '-dark' if dark_mode else '' }}.css" />
|
||||||
|
{% else %}
|
||||||
|
<link rel="stylesheet" href="/static/css/{{ 'dark-' if dark_mode else '' }}theme.css" />
|
||||||
|
{% endif %}
|
||||||
|
<title>{{ query }} - Whoogle Search</title>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
{{ search_header|safe }}
|
{{ search_header|safe }}
|
||||||
{{ response|safe }}
|
{{ response|safe }}
|
||||||
</body>
|
</body>
|
||||||
<footer>
|
<footer>
|
||||||
<p style="color: {{ '#fff' if dark_mode else '#000' }};">
|
<p style=" color: {{ '#ECEFF4' if dark_mode else '#000' }};">
|
||||||
Whoogle Search v{{ version_number }} ||
|
Whoogle Search v{{ version_number }} ||
|
||||||
<a style="color: #685e79" href="https://github.com/benbusby/whoogle-search">View on GitHub</a>
|
<a style="color: #685e79" href="https://github.com/benbusby/whoogle-search">View on GitHub</a>
|
||||||
</p>
|
</p>
|
||||||
</footer>
|
</footer>
|
||||||
</html>
|
</html>
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
<div class="sbc esbc autocomplete">
|
<div class="sbc esbc autocomplete">
|
||||||
<input id="search-bar" autocapitalize="none" autocomplete="off" class="noHIxc" name="q"
|
<input id="search-bar" autocapitalize="none" autocomplete="off" class="noHIxc" name="q"
|
||||||
style="background-color: {{ '#000' if dark_mode else '#fff' }};
|
style="background-color: {{ '#000' if dark_mode else '#fff' }};
|
||||||
color: {{ '#685e79' if dark_mode else '#000' }};
|
color: {{ '#292E39' if dark_mode else '#000' }};
|
||||||
border: {{ '1px solid #685e79' if dark_mode else '' }}"
|
border: {{ '1px solid #685e79' if dark_mode else '' }}"
|
||||||
spellcheck="false" type="text" value="{{ query }}">
|
spellcheck="false" type="text" value="{{ query }}">
|
||||||
<input name="tbm" value="{{ search_type }}" style="display: none">
|
<input name="tbm" value="{{ search_type }}" style="display: none">
|
||||||
|
|
|
@ -22,13 +22,21 @@
|
||||||
<script type="text/javascript" src="/static/js/controller.js"></script>
|
<script type="text/javascript" src="/static/js/controller.js"></script>
|
||||||
<link rel="search" href="/opensearch.xml" type="application/opensearchdescription+xml" title="Whoogle Search">
|
<link rel="search" href="/opensearch.xml" type="application/opensearchdescription+xml" title="Whoogle Search">
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
<link rel="stylesheet" href="/static/css/{{ 'search-dark' if config.dark else 'search' }}.css">
|
|
||||||
<link rel="stylesheet" href="/static/css/main.css">
|
<link rel="stylesheet" href="/static/css/main.css">
|
||||||
{% if config.dark %}
|
{% if config['theme'] %}
|
||||||
<link rel="stylesheet" href="/static/css/dark-theme.css"/>
|
<link rel="stylesheet"
|
||||||
|
href="/static/css/themes/{{config['theme']}}{{ '-search-dark' if config['dark'] else '-search' }}.css" />
|
||||||
|
{% else %}
|
||||||
|
<link rel="stylesheet" href="/static/css/{{ 'dark-' if config['dark'] else '' }}theme.css" />
|
||||||
|
{% endif %}
|
||||||
|
{% if config['theme'] %}
|
||||||
|
<link rel="stylesheet" href="/static/css/themes/{{config['theme']}}{{ '-dark' if config['dark'] else '' }}.css" />
|
||||||
|
{% else %}
|
||||||
|
<link rel="stylesheet" href="/static/css/{{ 'dark-' if config['dark'] else '' }}theme.css" />
|
||||||
{% endif %}
|
{% endif %}
|
||||||
<title>Whoogle Search</title>
|
<title>Whoogle Search</title>
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body id="main" style="display: none; background-color: {{ '#ECEFF4' if config.dark else '#fff' }}">
|
<body id="main" style="display: none; background-color: {{ '#ECEFF4' if config.dark else '#fff' }}">
|
||||||
<div class="search-container">
|
<div class="search-container">
|
||||||
<img class="logo" src="/static/img/logo.png">
|
<img class="logo" src="/static/img/logo.png">
|
||||||
|
|
Loading…
Reference in New Issue
Block a user