Added enter key submit on results page

Added results type carryover for subsequent searches on results page

Removed redundant header on image search results
pull/85/head
Ben Busby 4 years ago
parent d1f38cf924
commit 9212f9921a

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

@ -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>
Loading…
Cancel
Save