diff options
author | toasted-nutbread <toasted-nutbread@users.noreply.github.com> | 2019-09-15 11:37:36 -0400 |
---|---|---|
committer | toasted-nutbread <toasted-nutbread@users.noreply.github.com> | 2019-09-27 21:16:10 -0400 |
commit | 476a5e873a3825d760110a09c6e9b01ec34b4104 (patch) | |
tree | 7c881c1eb540633d1fa3fd5563b939e11215271a /ext/fg/js | |
parent | 8195e5109b97c284fc1d6c8559de6e5f5941c911 (diff) |
Remove jQuery usage from float.js
Diffstat (limited to 'ext/fg/js')
-rw-r--r-- | ext/fg/js/float.js | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/ext/fg/js/float.js b/ext/fg/js/float.js index fd7986b8..f75b35b8 100644 --- a/ext/fg/js/float.js +++ b/ext/fg/js/float.js @@ -30,7 +30,7 @@ class DisplayFloat extends Display { this.dependencies = Object.assign({}, this.dependencies, {docRangeFromPoint, docSentenceExtract}); - $(window).on('message', utilAsync(this.onMessage.bind(this))); + window.addEventListener('message', (e) => this.onMessage(e), false); } onError(error) { @@ -42,8 +42,16 @@ class DisplayFloat extends Display { } onOrphaned() { - $('#definitions').hide(); - $('#error-orphaned').show(); + const definitions = document.querySelector('#definitions'); + const errorOrphaned = document.querySelector('#error-orphaned'); + + if (definitions !== null) { + definitions.style.setProperty('display', 'none', 'important'); + } + + if (errorOrphaned !== null) { + errorOrphaned.style.setProperty('display', 'block', 'important'); + } } onSearchClear() { @@ -86,7 +94,7 @@ class DisplayFloat extends Display { } }; - const {action, params} = e.originalEvent.data; + const {action, params} = e.data; const handler = handlers[action]; if (handler) { handler(params); |