summaryrefslogtreecommitdiff
path: root/ext/bg/js/search.js
diff options
context:
space:
mode:
authortoasted-nutbread <toasted-nutbread@users.noreply.github.com>2019-11-04 20:52:08 -0500
committertoasted-nutbread <toasted-nutbread@users.noreply.github.com>2019-11-10 14:02:43 -0500
commit7333873244ccaeeefe01bd3a63447f39dd4f3bbe (patch)
tree96c75fbc5ddad4850132dfd6f59f47cb6925dac0 /ext/bg/js/search.js
parent3a225c3f916d435e04fb30afa731c30c4309fc7f (diff)
Add support for wildcards
Diffstat (limited to 'ext/bg/js/search.js')
-rw-r--r--ext/bg/js/search.js9
1 files changed, 8 insertions, 1 deletions
diff --git a/ext/bg/js/search.js b/ext/bg/js/search.js
index abd40640..aa56d1a6 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,