Merge pull request #164 from dracarys18/main

fix: allow custom bangs without an argument
This commit is contained in:
Svilen Markov 2024-07-03 19:26:54 +01:00 committed by GitHub
commit 88ae2b8e83
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 7 additions and 5 deletions

View File

@ -40,7 +40,6 @@ pages:
columns:
- size: small
widgets:
- type: clock
- type: calendar
- type: rss

View File

@ -148,8 +148,7 @@ function setupSearchBoxes() {
query = input;
searchUrlTemplate = defaultSearchUrl;
}
if (query.length == 0) {
if (query.length == 0 && currentBang == null) {
return;
}
@ -171,9 +170,13 @@ function setupSearchBoxes() {
}
const handleInput = (event) => {
const value = event.target.value.trimStart();
const words = value.split(" ");
const value = event.target.value.trim();
if (value in bangsMap) {
changeCurrentBang(bangsMap[value]);
return;
}
const words = value.split(" ");
if (words.length >= 2 && words[0] in bangsMap) {
changeCurrentBang(bangsMap[words[0]]);
return;