wip
This commit is contained in:
parent
90eaae1725
commit
b8d0788144
@ -49,6 +49,10 @@ window.displayWindow = new class extends Display {
|
||||
window.alert(`Error: ${error}`);
|
||||
}
|
||||
|
||||
clearSearch() {
|
||||
$('#query').focus().select();
|
||||
}
|
||||
|
||||
onSearch(e) {
|
||||
e.preventDefault();
|
||||
$('#intro').slideUp();
|
||||
|
@ -47,6 +47,10 @@ window.displayFrame = new class extends Display {
|
||||
}
|
||||
}
|
||||
|
||||
clearSearch() {
|
||||
window.parent.postMessage('popupClose', '*');
|
||||
}
|
||||
|
||||
showOrphaned() {
|
||||
$('#content').hide();
|
||||
$('#orphan').show();
|
||||
|
@ -46,14 +46,14 @@ window.driver = new class {
|
||||
}
|
||||
|
||||
popupTimerClear() {
|
||||
if (this.popupTimer !== null) {
|
||||
if (this.popupTimer) {
|
||||
window.clearTimeout(this.popupTimer);
|
||||
this.popupTimer = null;
|
||||
}
|
||||
}
|
||||
|
||||
onMouseOver(e) {
|
||||
if (e.target === this.popup.container && this.popuptimer !== null) {
|
||||
if (e.target === this.popup.container && this.popupTimer) {
|
||||
this.popupTimerClear();
|
||||
}
|
||||
}
|
||||
@ -106,14 +106,6 @@ window.driver = new class {
|
||||
const handlers = {
|
||||
popupClose: () => {
|
||||
this.searchClear();
|
||||
},
|
||||
|
||||
scanLeft: () => {
|
||||
|
||||
},
|
||||
|
||||
scanRight: () => {
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
@ -147,11 +139,11 @@ window.driver = new class {
|
||||
}
|
||||
|
||||
const textSource = docRangeFromPoint(point, this.options.scanning.imposter);
|
||||
if (textSource === null || !textSource.containsPoint(point)) {
|
||||
if (!textSource || !textSource.containsPoint(point)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (this.lastTextSource !== null && this.lastTextSource.equals(textSource)) {
|
||||
if (this.lastTextSource && this.lastTextSource.equals(textSource)) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -225,7 +217,7 @@ window.driver = new class {
|
||||
docImposterDestroy();
|
||||
this.popup.hide();
|
||||
|
||||
if (this.options.scanning.selectText && this.lastTextSource !== null) {
|
||||
if (this.options.scanning.selectText && this.lastTextSource) {
|
||||
this.lastTextSource.deselect();
|
||||
}
|
||||
|
||||
|
@ -50,6 +50,10 @@ class Display {
|
||||
throw 'override me';
|
||||
}
|
||||
|
||||
clearSearch() {
|
||||
throw 'override me';
|
||||
}
|
||||
|
||||
showTermDefs(definitions, options, context) {
|
||||
window.focus();
|
||||
|
||||
@ -207,17 +211,13 @@ class Display {
|
||||
}
|
||||
|
||||
onKeyDown(e) {
|
||||
const notifyParent = action => {
|
||||
window.parent.postMessage(action, '*');
|
||||
};
|
||||
|
||||
const handlers = {
|
||||
36: /* home */ () => {
|
||||
this.entryScroll(0, true);
|
||||
8: /* backspace */ () => {
|
||||
|
||||
},
|
||||
|
||||
35: /* end */ () => {
|
||||
this.entryScroll(this.definitions.length - 1, true);
|
||||
27: /* escape */ () => {
|
||||
this.clearSearch();
|
||||
},
|
||||
|
||||
33: /* page up */ () => {
|
||||
@ -228,6 +228,14 @@ class Display {
|
||||
this.entryScroll(this.index + 3, true);
|
||||
},
|
||||
|
||||
35: /* end */ () => {
|
||||
this.entryScroll(this.definitions.length - 1, true);
|
||||
},
|
||||
|
||||
36: /* home */ () => {
|
||||
this.entryScroll(0, true);
|
||||
},
|
||||
|
||||
38: /* up */ () => {
|
||||
this.entryScroll(this.index - 1, true);
|
||||
},
|
||||
@ -240,28 +248,12 @@ class Display {
|
||||
|
||||
},
|
||||
|
||||
221: /* ] */ () => {
|
||||
|
||||
},
|
||||
|
||||
220: /* \ */ () => {
|
||||
this.audioPlay(this.definitions[this.index]);
|
||||
},
|
||||
|
||||
8: /* backspace */ () => {
|
||||
221: /* ] */ () => {
|
||||
|
||||
},
|
||||
|
||||
27: /* escape */ () => {
|
||||
notifyParent('popupClose');
|
||||
},
|
||||
|
||||
37: /* left */ () => {
|
||||
notifyParent('scanLeft');
|
||||
},
|
||||
|
||||
39: /* right */ () => {
|
||||
notifyParent('scanRight');
|
||||
}
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user