summaryrefslogtreecommitdiff
path: root/ext/fg/js/driver.js
diff options
context:
space:
mode:
authorAlex Yatskov <alex@foosoft.net>2017-01-13 21:06:33 -0800
committerAlex Yatskov <alex@foosoft.net>2017-01-13 21:06:33 -0800
commit8fe82573cc456fe1256989e0c3e524590a1a0acf (patch)
tree08fd34b9a68c26fce82fb0d84c4f00bd3be2ba0d /ext/fg/js/driver.js
parent11fcc465ac151af7f417acc602b58a04bf019d80 (diff)
WIP
Diffstat (limited to 'ext/fg/js/driver.js')
-rw-r--r--ext/fg/js/driver.js16
1 files changed, 8 insertions, 8 deletions
diff --git a/ext/fg/js/driver.js b/ext/fg/js/driver.js
index ef7db481..25e1c57f 100644
--- a/ext/fg/js/driver.js
+++ b/ext/fg/js/driver.js
@@ -44,7 +44,7 @@ class Driver {
popupTimerSet(callback) {
this.popupTimerClear();
- this.popupTimer = window.setTimeout(callback, this.options.scanDelay);
+ this.popupTimer = window.setTimeout(callback, this.options.scanning.delay);
}
popupTimerClear() {
@@ -82,7 +82,7 @@ class Driver {
return;
}
- if (this.options.holdShiftToScan && !e.shiftKey) {
+ if (this.options.scanning.requireShift && !e.shiftKey) {
return;
}
@@ -144,16 +144,16 @@ class Driver {
}
searchTerms(textSource) {
- textSource.setEndOffset(this.options.scanLength);
+ textSource.setEndOffset(this.options.scanning.length);
- const findFunc = this.options.groupTermResults ? findTermGrouped : findTerm;
+ const findFunc = this.options.general.groupResults ? findTermGrouped : findTerm;
return findFunc(textSource.text()).then(({definitions, length}) => {
if (definitions.length === 0) {
return false;
} else {
textSource.setEndOffset(length);
- const sentence = extractSentence(textSource, this.options.sentenceExtent);
+ const sentence = extractSentence(textSource, this.options.anki.sentenceExt);
definitions.forEach(definition => {
definition.url = window.location.href;
definition.sentence = sentence;
@@ -162,7 +162,7 @@ class Driver {
this.popup.showNextTo(textSource.getRect());
this.popup.showTermDefs(definitions, this.options);
this.lastTextSource = textSource;
- if (this.options.selectMatchedText) {
+ if (this.options.scanning.selectText) {
textSource.select();
}
@@ -186,7 +186,7 @@ class Driver {
this.popup.showNextTo(textSource.getRect());
this.popup.showKanjiDefs(definitions, this.options);
this.lastTextSource = textSource;
- if (this.options.selectMatchedText) {
+ if (this.options.scanning.selectText) {
textSource.select();
}
@@ -201,7 +201,7 @@ class Driver {
searchClear() {
this.popup.hide();
- if (this.options.selectMatchedText && this.lastTextSource !== null) {
+ if (this.options.scanning.selectText && this.lastTextSource !== null) {
this.lastTextSource.deselect();
}