Hotfix: check for site filters before modifying query

The previous method of removing all site filters from the search query
removed the last letter of the search. This only applies the substring
filter if any site filters are present in the query.

Fixes #306
main
Ben Busby 2021-05-10 12:07:55 -04:00
parent c8da53d4b0
commit 05995649f3
No known key found for this signature in database
GPG Key ID: 3B08611DF6E62ED2
1 changed files with 2 additions and 2 deletions

View File

@ -22,7 +22,7 @@
style="background-color: {{ 'var(--whoogle-dark-result-bg)' if config.dark else 'var(--whoogle-result-bg)' }} !important; style="background-color: {{ 'var(--whoogle-dark-result-bg)' if config.dark else 'var(--whoogle-result-bg)' }} !important;
color: {{ 'var(--whoogle-dark-text)' if config.dark else 'var(--whoogle-text)' }}; color: {{ 'var(--whoogle-dark-text)' if config.dark else 'var(--whoogle-text)' }};
type="text" type="text"
value="{{ query[:query.find('-site:')] }}"> value="{{ query[:query.find('-site:')] if '-site:' in query else query }}">
<input style="color: {{ 'var(--whoogle-dark-text)' if config.dark else 'var(--whoogle-text)' }}" id="search-reset" type="reset" value="x"> <input style="color: {{ 'var(--whoogle-dark-text)' if config.dark else 'var(--whoogle-text)' }}" id="search-reset" type="reset" value="x">
<input name="tbm" value="{{ search_type }}" style="display: none"> <input name="tbm" value="{{ search_type }}" style="display: none">
<input type="submit" style="display: none;"> <input type="submit" style="display: none;">
@ -54,7 +54,7 @@
name="q" name="q"
spellcheck="false" spellcheck="false"
type="text" type="text"
value="{{ query[:query.find('-site:')] }}" value="{{ query[:query.find('-site:')] if '-site:' in query else query }}"
style="background-color: {{ 'var(--whoogle-dark-result-bg)' if config.dark else 'var(--whoogle-result-bg)' }} !important; style="background-color: {{ 'var(--whoogle-dark-result-bg)' if config.dark else 'var(--whoogle-result-bg)' }} !important;
color: {{ 'var(--whoogle-dark-text)' if config.dark else 'var(--whoogle-text)' }}; color: {{ 'var(--whoogle-dark-text)' if config.dark else 'var(--whoogle-text)' }};
border-bottom: {{ '2px solid var(--whoogle-dark-element-bg)' if config.dark else '0px' }};"> border-bottom: {{ '2px solid var(--whoogle-dark-element-bg)' if config.dark else '0px' }};">