aboutsummaryrefslogtreecommitdiff
path: root/ext/bg/js/search.js
diff options
context:
space:
mode:
authortoasted-nutbread <toasted-nutbread@users.noreply.github.com>2020-03-07 21:41:45 -0500
committerGitHub <noreply@github.com>2020-03-07 21:41:45 -0500
commitb8eb5e6016834cc751c973239e1e4604fe9799ee (patch)
tree34001835d0efa086a32e50fc8fb70fee4b7f4795 /ext/bg/js/search.js
parent4b0dfa92aaa9e088c2f59edb3adcb89f0b3c1053 (diff)
parentba64f34df19d446cbe5b8ec2e367d4f6a4d1061f (diff)
Merge pull request #397 from toasted-nutbread/clipboard-monitor-refactor2
Clipboard monitor refactor
Diffstat (limited to 'ext/bg/js/search.js')
-rw-r--r--ext/bg/js/search.js9
1 files changed, 4 insertions, 5 deletions
diff --git a/ext/bg/js/search.js b/ext/bg/js/search.js
index f3cba7ae..f9481ea2 100644
--- a/ext/bg/js/search.js
+++ b/ext/bg/js/search.js
@@ -16,7 +16,7 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
-/*global apiOptionsSet, apiTermsFind, Display, QueryParser, ClipboardMonitor*/
+/*global apiOptionsSet, apiTermsFind, apiClipboardGet, Display, QueryParser, ClipboardMonitor*/
class DisplaySearch extends Display {
constructor() {
@@ -38,7 +38,7 @@ class DisplaySearch extends Display {
this.introVisible = true;
this.introAnimationTimer = null;
- this.clipboardMonitor = new ClipboardMonitor();
+ this.clipboardMonitor = new ClipboardMonitor({getClipboard: apiClipboardGet});
this._onKeyDownIgnoreKeys = new Map([
['ANY_MOD', new Set([
@@ -102,8 +102,7 @@ class DisplaySearch extends Display {
this.wanakanaEnable.addEventListener('change', this.onWanakanaEnableChange.bind(this));
window.addEventListener('popstate', this.onPopState.bind(this));
window.addEventListener('copy', this.onCopy.bind(this));
-
- this.clipboardMonitor.onClipboardText = this.onExternalSearchUpdate.bind(this);
+ this.clipboardMonitor.on('change', this.onExternalSearchUpdate.bind(this));
this.updateSearchButton();
} catch (e) {
@@ -198,7 +197,7 @@ class DisplaySearch extends Display {
this.clipboardMonitor.setPreviousText(document.getSelection().toString().trim());
}
- onExternalSearchUpdate(text) {
+ onExternalSearchUpdate({text}) {
this.setQuery(text);
const url = new URL(window.location.href);
url.searchParams.set('query', text);