From c4b1a4a5b4811d7aaa70b3b83f740c9e3d2b86be Mon Sep 17 00:00:00 2001 From: Alex Yatskov Date: Fri, 7 Apr 2017 21:17:13 -0700 Subject: wip --- ext/mixed/js/display.js | 8 ++++---- ext/mixed/js/util.js | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) (limited to 'ext/mixed/js') diff --git a/ext/mixed/js/display.js b/ext/mixed/js/display.js index e77ca7da..973b7749 100644 --- a/ext/mixed/js/display.js +++ b/ext/mixed/js/display.js @@ -74,7 +74,7 @@ class Display { if (context) { for (const definition of definitions) { - definition.cloze = clozeBuild(context.cloze); + definition.cloze = clozeBuild(context.sentence, definition.source); definition.url = context.url; } } @@ -108,7 +108,7 @@ class Display { if (context) { for (const definition of definitions) { - definition.cloze = clozeBuild(context.cloze); + definition.cloze = clozeBuild(context.sentence, definition.source); definition.url = context.url; } } @@ -181,7 +181,7 @@ class Display { }; if (this.context) { - context.cloze = this.context.cloze; + context.sentence = this.context.sentence; context.url = this.context.url; } @@ -308,7 +308,7 @@ class Display { if (this.context && this.context.source) { const context = { url: this.context.source.url, - cloze: this.context.source.cloze, + sentence: this.context.source.sentence, index: this.context.source.index }; diff --git a/ext/mixed/js/util.js b/ext/mixed/js/util.js index aeeb830e..eae54f49 100644 --- a/ext/mixed/js/util.js +++ b/ext/mixed/js/util.js @@ -21,12 +21,12 @@ * Cloze */ -function clozeBuild(sentence, offset, source) { +function clozeBuild(sentence, source) { return { - sentence: sentence.trim(), - prefix: sentence.substring(0, offset).trim(), + sentence: sentence.text.trim(), + prefix: sentence.text.substring(0, sentence.offset).trim(), body: source.trim(), - suffix: sentence.substring(offset + source.length).trim() + suffix: sentence.text.substring(sentence.offset + source.length).trim() }; } -- cgit v1.2.3