Merge remote-tracking branch 'origin/master' into heroku-app
This commit is contained in:
commit
176c96374c
|
@ -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,
|
||||
|
@ -137,14 +136,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'])
|
||||
|
|
|
@ -13,6 +13,7 @@
|
|||
<div class="sbc esbc autocomplete">
|
||||
<input id="search-bar" autocapitalize="none" autocomplete="off" class="noHIxc" name="q"
|
||||
spellcheck="false" type="text" value="{{ q }}">
|
||||
<input name="tbm" value="{{ search_type }}" style="display: none">
|
||||
<div class="sc"></div>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -34,6 +35,7 @@
|
|||
<div style="width: 100%; display: flex">
|
||||
<input id="search-bar" autocapitalize="none" autocomplete="off" class="noHIxc" name="q"
|
||||
spellcheck="false" type="text" value="{{ q }}">
|
||||
<input name="tbm" value="{{ search_type }}" style="display: none">
|
||||
<div class="sc"></div>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -48,6 +50,8 @@
|
|||
searchBar.addEventListener("keyup", function (event) {
|
||||
if (event.keyCode !== 13) {
|
||||
handleUserInput(searchBar);
|
||||
} else {
|
||||
document.getElementById("search-form").submit();
|
||||
}
|
||||
});
|
||||
</script>
|
|
@ -25,7 +25,7 @@
|
|||
<link rel="stylesheet" href="/static/css/main.css">
|
||||
<title>Whoogle Search</title>
|
||||
</head>
|
||||
<body id="main" style="display: none; background-color: {{ bg }}">
|
||||
<body id="main" style="display: none; background-color: {{ '#000' if dark_mode else '#fff' }}">
|
||||
<div class="search-container">
|
||||
<img class="logo" src="/static/img/logo.png">
|
||||
<form id="search-form" action="/search" method="{{ request_type }}">
|
||||
|
@ -107,7 +107,10 @@
|
|||
</div>
|
||||
</div>
|
||||
<footer>
|
||||
<p>Whoogle Search v{{ version_number }} || <a href="https://github.com/benbusby/whoogle-search">View on GitHub</a></p>
|
||||
<p style="color: {{ '#fff' if dark_mode else '#000' }};">
|
||||
Whoogle Search v{{ version_number }} ||
|
||||
<a style="color: #685e79" href="https://github.com/benbusby/whoogle-search">View on GitHub</a>
|
||||
</p>
|
||||
</footer>
|
||||
</body>
|
||||
</html>
|
||||
|
|
Loading…
Reference in New Issue
Block a user