diff options
author | Alex Yatskov <FooSoft@users.noreply.github.com> | 2019-11-13 18:51:50 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-11-13 18:51:50 -0800 |
commit | b1659522b30cecc0583745da5a44fdd75660274a (patch) | |
tree | 89c17fa51f91ee43b1a206a9ae2d7b5721892ae9 /ext/bg/js/search.js | |
parent | 7d9d45ae10302582ce7431bd72ec4f8604dc5e65 (diff) | |
parent | 7333873244ccaeeefe01bd3a63447f39dd4f3bbe (diff) |
Merge pull request #274 from toasted-nutbread/lookup-wildcards
Lookup wildcards
Diffstat (limited to 'ext/bg/js/search.js')
-rw-r--r-- | ext/bg/js/search.js | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/ext/bg/js/search.js b/ext/bg/js/search.js index dccc7da7..56316217 100644 --- a/ext/bg/js/search.js +++ b/ext/bg/js/search.js @@ -203,11 +203,18 @@ class DisplaySearch extends Display { async onSearchQueryUpdated(query, animate) { try { + const details = {}; + const match = /[\*\uff0a]+$/.exec(query); + if (match !== null) { + details.wildcard = true; + query = query.substr(0, query.length - match[0].length); + } + const valid = (query.length > 0); this.setIntroVisible(!valid, animate); this.updateSearchButton(); if (valid) { - const {definitions} = await apiTermsFind(query, this.optionsContext); + const {definitions} = await apiTermsFind(query, details, this.optionsContext); this.setContentTerms(definitions, { focus: false, sentence: null, |