From c514bbc4fbe39f611d7d9cfd3a48681bacbaf559 Mon Sep 17 00:00:00 2001 From: toasted-nutbread Date: Sat, 1 May 2021 15:54:31 -0400 Subject: Flags profile conditions (#1647) * Generalize modifier keys * Optimize bindings * Add support for flags * Add clipboard flag * Update tests * Add tests --- ext/js/display/search-display-controller.js | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) (limited to 'ext/js/display') diff --git a/ext/js/display/search-display-controller.js b/ext/js/display/search-display-controller.js index f672909e..e60de796 100644 --- a/ext/js/display/search-display-controller.js +++ b/ext/js/display/search-display-controller.js @@ -179,12 +179,12 @@ class SearchDisplayController { e.preventDefault(); e.stopImmediatePropagation(); this._display.blurElement(e.currentTarget); - this._search(true, true, true); + this._search(true, true, true, null); } _onSearch(e) { e.preventDefault(); - this._search(true, true, true); + this._search(true, true, true, null); } _onCopy() { @@ -199,7 +199,7 @@ class SearchDisplayController { } this._queryInput.value = text; this._updateSearchHeight(true); - this._search(animate, false, autoSearchContent); + this._search(animate, false, autoSearchContent, ['clipboard']); } _onWanakanaEnableChange(e) { @@ -342,11 +342,15 @@ class SearchDisplayController { }); } - _search(animate, history, lookup) { + _search(animate, history, lookup, flags) { const query = this._queryInput.value; const depth = this._display.depth; const url = window.location.href; const documentTitle = document.title; + const optionsContext = {depth, url}; + if (flags !== null) { + optionsContext.flags = flags; + } const details = { focus: false, history, @@ -355,7 +359,7 @@ class SearchDisplayController { }, state: { focusEntry: 0, - optionsContext: {depth, url}, + optionsContext, url, sentence: {text: query, offset: 0}, documentTitle -- cgit v1.2.3