Remove jQuery usage from float.js

This commit is contained in:
toasted-nutbread 2019-09-15 11:37:36 -04:00
parent 8195e5109b
commit 476a5e873a

View File

@ -30,7 +30,7 @@ class DisplayFloat extends Display {
this.dependencies = Object.assign({}, this.dependencies, {docRangeFromPoint, docSentenceExtract}); 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) { onError(error) {
@ -42,8 +42,16 @@ class DisplayFloat extends Display {
} }
onOrphaned() { onOrphaned() {
$('#definitions').hide(); const definitions = document.querySelector('#definitions');
$('#error-orphaned').show(); 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() { onSearchClear() {
@ -86,7 +94,7 @@ class DisplayFloat extends Display {
} }
}; };
const {action, params} = e.originalEvent.data; const {action, params} = e.data;
const handler = handlers[action]; const handler = handlers[action];
if (handler) { if (handler) {
handler(params); handler(params);