mirror of
https://github.com/xvvvyz/tilde.git
synced 2026-03-11 14:44:24 +00:00
move attachSearchPrefix inline
This commit is contained in:
parent
ced7722c5f
commit
1ec4cfa957
1 changed files with 6 additions and 7 deletions
13
index.html
13
index.html
|
|
@ -335,11 +335,6 @@
|
|||
this.shadowRoot.append(clone);
|
||||
}
|
||||
|
||||
static #attachSearchPrefix(array, { key, splitBy }) {
|
||||
if (!splitBy) return array;
|
||||
return array.map((search) => `${key}${splitBy}${search}`);
|
||||
}
|
||||
|
||||
static #escapeRegexCharacters(s) {
|
||||
return s.replace(/[-\/\\^$*+?.()|[\]{}]/g, '\\$&');
|
||||
}
|
||||
|
|
@ -468,8 +463,12 @@
|
|||
|
||||
if (oq.search && suggestions.length < CONFIG.suggestionLimit) {
|
||||
const res = await Search.#fetchDuckDuckGoSuggestions(oq.search);
|
||||
const formatted = Search.#attachSearchPrefix(res, oq);
|
||||
suggestions = suggestions.concat(formatted);
|
||||
|
||||
suggestions = suggestions.concat(
|
||||
oq.splitBy
|
||||
? res.map((search) => `${oq.key}${oq.splitBy}${search}`)
|
||||
: res
|
||||
);
|
||||
}
|
||||
|
||||
const nq = Search.#parseQuery(this.#input.value);
|
||||
|
|
|
|||
Loading…
Reference in a new issue