aboutsummaryrefslogtreecommitdiff
path: root/ext/mixed/js
diff options
context:
space:
mode:
authortoasted-nutbread <toasted-nutbread@users.noreply.github.com>2021-01-25 22:05:06 -0500
committerGitHub <noreply@github.com>2021-01-25 22:05:06 -0500
commit981f73b5623249b4c4cead0261eab0e70f620d90 (patch)
treec03dcd0545462da99d168f30dfe6691b41519d73 /ext/mixed/js
parentea1d40f94b2e3d43cc73805018cc5d2ba24a6822 (diff)
Clipboard lookup skip option (#1314)
* Add autoSearchClipboardContent option * Hide header if there is any search text * Add setting for autoSearchClipboardContent * Add support for autoSearchClipboardContent
Diffstat (limited to 'ext/mixed/js')
-rw-r--r--ext/mixed/js/display.js9
1 files changed, 5 insertions, 4 deletions
diff --git a/ext/mixed/js/display.js b/ext/mixed/js/display.js
index 6c97cb84..fdb0af39 100644
--- a/ext/mixed/js/display.js
+++ b/ext/mixed/js/display.js
@@ -558,7 +558,8 @@ class Display extends EventDispatcher {
let queryFull = urlSearchParams.get('full');
queryFull = (queryFull !== null ? this.postProcessQuery(queryFull) : query);
const wildcardsEnabled = (urlSearchParams.get('wildcards') !== 'off');
- await this._setContentTermsOrKanji(token, isTerms, query, queryFull, wildcardsEnabled, eventArgs);
+ const lookup = (urlSearchParams.get('lookup') !== 'false');
+ await this._setContentTermsOrKanji(token, isTerms, query, queryFull, lookup, wildcardsEnabled, eventArgs);
}
break;
case 'unloaded':
@@ -844,7 +845,7 @@ class Display extends EventDispatcher {
}
}
- async _setContentTermsOrKanji(token, isTerms, query, queryFull, wildcardsEnabled, eventArgs) {
+ async _setContentTermsOrKanji(token, isTerms, query, queryFull, lookup, wildcardsEnabled, eventArgs) {
let {state, content} = this._history;
let changeHistory = false;
if (!isObject(content)) {
@@ -874,7 +875,7 @@ class Display extends EventDispatcher {
let {definitions} = content;
if (!Array.isArray(definitions)) {
- definitions = await this._findDefinitions(isTerms, query, wildcardsEnabled, optionsContext);
+ definitions = lookup ? await this._findDefinitions(isTerms, query, wildcardsEnabled, optionsContext) : [];
if (this._setContentToken !== token) { return; }
content.definitions = definitions;
changeHistory = true;
@@ -899,7 +900,7 @@ class Display extends EventDispatcher {
this._definitions = definitions;
this._updateNavigation(this._history.hasPrevious(), this._history.hasNext());
- this._setNoContentVisible(definitions.length === 0);
+ this._setNoContentVisible(definitions.length === 0 && lookup);
const container = this._container;
container.textContent = '';