summaryrefslogtreecommitdiff
path: root/ext/fg/js
diff options
context:
space:
mode:
authorAlex Yatskov <FooSoft@users.noreply.github.com>2019-09-28 09:12:23 -0700
committerGitHub <noreply@github.com>2019-09-28 09:12:23 -0700
commit64eed33e8890df33e3c4acb47c96f0e3c674bd3b (patch)
tree04b346150f8e4973a06bf7e0c8f3ec42f69502a8 /ext/fg/js
parent8195e5109b97c284fc1d6c8559de6e5f5941c911 (diff)
parente358c94882ba4fea134ca0a21824055d09719143 (diff)
Merge pull request #224 from toasted-nutbread/display-jquery-optimizations
Remove jQuery usage from Display.js
Diffstat (limited to 'ext/fg/js')
-rw-r--r--ext/fg/js/float.js18
1 files changed, 13 insertions, 5 deletions
diff --git a/ext/fg/js/float.js b/ext/fg/js/float.js
index fd7986b8..2e952efb 100644
--- a/ext/fg/js/float.js
+++ b/ext/fg/js/float.js
@@ -19,7 +19,7 @@
class DisplayFloat extends Display {
constructor() {
- super($('#spinner'), $('#definitions'));
+ super(document.querySelector('#spinner'), document.querySelector('#definitions'));
this.autoPlayAudioTimer = null;
this.styleNode = null;
@@ -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);