From 8fe82573cc456fe1256989e0c3e524590a1a0acf Mon Sep 17 00:00:00 2001
From: Alex Yatskov <alex@foosoft.net>
Date: Fri, 13 Jan 2017 21:06:33 -0800
Subject: WIP

---
 ext/fg/js/driver.js | 16 ++++++++--------
 ext/fg/js/frame.js  |  4 ++--
 2 files changed, 10 insertions(+), 10 deletions(-)

(limited to 'ext/fg/js')

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();
         }
 
diff --git a/ext/fg/js/frame.js b/ext/fg/js/frame.js
index 4295dbb3..2443f85b 100644
--- a/ext/fg/js/frame.js
+++ b/ext/fg/js/frame.js
@@ -34,9 +34,9 @@ class Frame {
         const sequence = ++this.sequence;
         const context = {
             definitions,
-            grouped: options.groupTermResults,
+            grouped: options.general.groupResults,
             addable: options.ankiMethod !== 'disabled',
-            playback: options.enableAudioPlayback
+            playback: options.general.audioPlayback
         };
 
         this.definitions = definitions;
-- 
cgit v1.2.3