From 465a8e21c0a9d7b2d1e704ab9a42b5f662fd82d3 Mon Sep 17 00:00:00 2001 From: Alex Yatskov Date: Sat, 25 Feb 2017 19:14:44 -0800 Subject: usability improvements --- ext/fg/js/driver.js | 27 ++++++++------------------- ext/fg/js/util.js | 4 ---- 2 files changed, 8 insertions(+), 23 deletions(-) (limited to 'ext/fg/js') 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', {}); } -- cgit v1.2.3