aboutsummaryrefslogtreecommitdiff
path: root/ext/fg/js
diff options
context:
space:
mode:
authorAlex Yatskov <alex@foosoft.net>2017-02-25 19:14:44 -0800
committerAlex Yatskov <alex@foosoft.net>2017-02-25 19:14:44 -0800
commit465a8e21c0a9d7b2d1e704ab9a42b5f662fd82d3 (patch)
tree79329108eed02c8bfce937dd2f839bc9e35bcf80 /ext/fg/js
parente2d49a975b33b6c19d33016a460764949d5f3734 (diff)
usability improvements
Diffstat (limited to 'ext/fg/js')
-rw-r--r--ext/fg/js/driver.js27
-rw-r--r--ext/fg/js/util.js4
2 files changed, 8 insertions, 23 deletions
diff --git a/ext/fg/js/driver.js b/ext/fg/js/driver.js
index 421c3591..3b4c0c76 100644
--- a/ext/fg/js/driver.js
+++ b/ext/fg/js/driver.js
@@ -24,21 +24,16 @@ class Driver {
this.lastMousePos = null;
this.lastTextSource = null;
this.pendingLookup = false;
- this.enabled = false;
this.options = null;
- chrome.runtime.onMessage.addListener(this.onBgMessage.bind(this));
- window.addEventListener('mouseover', this.onMouseOver.bind(this));
- window.addEventListener('mousedown', this.onMouseDown.bind(this));
- window.addEventListener('mousemove', this.onMouseMove.bind(this));
- window.addEventListener('resize', e => this.searchClear());
-
- Promise.all([getOptions(), isEnabled()]).then(([options, enabled]) => {
+ getOptions().then(options => {
this.options = options;
- this.enabled = enabled;
- }).catch(error => {
- this.handleError(error);
- });
+ window.addEventListener('mouseover', this.onMouseOver.bind(this));
+ window.addEventListener('mousedown', this.onMouseDown.bind(this));
+ window.addEventListener('mousemove', this.onMouseMove.bind(this));
+ window.addEventListener('resize', e => this.searchClear());
+ chrome.runtime.onMessage.addListener(this.onBgMessage.bind(this));
+ }).catch(this.handleError.bind(this));
}
popupTimerSet(callback) {
@@ -63,7 +58,7 @@ class Driver {
this.lastMousePos = {x: e.clientX, y: e.clientY};
this.popupTimerClear();
- if (!this.enabled) {
+ if (!this.options.general.enable) {
return;
}
@@ -198,12 +193,6 @@ class Driver {
api_setOptions(options) {
this.options = options;
}
-
- api_setEnabled(enabled) {
- if (!(this.enabled = enabled)) {
- this.searchClear();
- }
- }
}
window.driver = new Driver();
diff --git a/ext/fg/js/util.js b/ext/fg/js/util.js
index c9ee4ed7..99da6381 100644
--- a/ext/fg/js/util.js
+++ b/ext/fg/js/util.js
@@ -38,10 +38,6 @@ function showError(error) {
window.alert(`Error: ${error}`);
}
-function isEnabled() {
- return invokeBgApi('getEnabled', {});
-}
-
function getOptions() {
return invokeBgApi('getOptions', {});
}