aboutsummaryrefslogtreecommitdiff
path: root/ext/fg/js
diff options
context:
space:
mode:
Diffstat (limited to 'ext/fg/js')
-rw-r--r--ext/fg/js/driver.js16
-rw-r--r--ext/fg/js/popup.js2
2 files changed, 10 insertions, 8 deletions
diff --git a/ext/fg/js/driver.js b/ext/fg/js/driver.js
index 93f46622..1be69f11 100644
--- a/ext/fg/js/driver.js
+++ b/ext/fg/js/driver.js
@@ -37,7 +37,6 @@ class Driver {
window.addEventListener('mousedown', this.onMouseDown.bind(this));
window.addEventListener('mousemove', this.onMouseMove.bind(this));
window.addEventListener('keydown', this.onKeyDown.bind(this));
- window.addEventListener('scroll', e => this.hidePopup());
window.addEventListener('resize', e => this.hidePopup());
getOptions().then(opts => {
@@ -65,7 +64,7 @@ class Driver {
if (this.enabled && this.lastMousePos !== null && e.keyCode === 16 /* shift */) {
this.searchAt(this.lastMousePos, true);
- } else if (e.keyCode === 27) {
+ } else if (e.keyCode === 27 /* esc */) {
this.hidePopup();
}
}
@@ -77,13 +76,17 @@ class Driver {
}
onMouseMove(e) {
+ this.lastMousePos = {x: e.clientX, y: e.clientY};
this.popupTimerClear();
- this.lastMousePos = {x: e.clientX, y: e.clientY};
if (!this.enabled) {
return;
}
+ if (e.which === 1 /* lmb */) {
+ return;
+ }
+
if (this.options.holdShiftToScan && !e.shiftKey) {
return;
}
@@ -98,11 +101,8 @@ class Driver {
onMouseDown(e) {
this.lastMousePos = {x: e.clientX, y: e.clientY};
- if (this.enabled && (e.shiftKey || !this.options.holdShiftToScan || e.which === 2 /* mmb */)) {
- this.searchAt(this.lastMousePos, true);
- } else {
- this.hidePopup();
- }
+ this.popupTimerClear();
+ this.hidePopup();
}
onBgMessage({action, params}, sender, callback) {
diff --git a/ext/fg/js/popup.js b/ext/fg/js/popup.js
index 83da3fe1..2a2f7c54 100644
--- a/ext/fg/js/popup.js
+++ b/ext/fg/js/popup.js
@@ -66,6 +66,8 @@ class Popup {
return;
}
+ this.container.contentWindow.scrollTo(0, 0);
+
const doc = this.container.contentDocument;
doc.open();
doc.write(content);