diff options
Diffstat (limited to 'ext/fg/js')
-rw-r--r-- | ext/fg/js/driver.js | 27 | ||||
-rw-r--r-- | ext/fg/js/util.js | 4 |
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', {}); } |