aboutsummaryrefslogtreecommitdiff
path: root/ext/fg/js
diff options
context:
space:
mode:
Diffstat (limited to 'ext/fg/js')
-rw-r--r--ext/fg/js/driver.js6
-rw-r--r--ext/fg/js/frame.js10
2 files changed, 14 insertions, 2 deletions
diff --git a/ext/fg/js/driver.js b/ext/fg/js/driver.js
index 7facda0a..cb7f2ea6 100644
--- a/ext/fg/js/driver.js
+++ b/ext/fg/js/driver.js
@@ -167,7 +167,11 @@ class Driver {
if (definitions.length === 0) {
return false;
} else {
- definitions.forEach(definition => definition.url = window.location.href);
+ const sentence = extractSentence(textSource, this.options.anki.sentenceExt);
+ definitions.forEach(definition => {
+ definition.url = window.location.href;
+ definition.sentence = sentence;
+ });
this.popup.showNextTo(textSource.getRect());
this.popup.showKanjiDefs(definitions, this.options);
diff --git a/ext/fg/js/frame.js b/ext/fg/js/frame.js
index dba59000..df8ca894 100644
--- a/ext/fg/js/frame.js
+++ b/ext/fg/js/frame.js
@@ -49,7 +49,15 @@ class Frame {
$('.kanji-link').click(e => {
e.preventDefault();
- findKanji($(e.target).text()).then(kdefs => this.api_showKanjiDefs({options, definitions: kdefs}));
+ const character = $(e.target).text();
+ findKanji(character).then(kdefs => {
+ kdefs.forEach(kdef => {
+ kdef.url = definitions[0].url;
+ kdef.sentence = definitions[0].sentence;
+ });
+
+ this.api_showKanjiDefs({options, definitions: kdefs});
+ });
});
$('.action-play-audio').click(e => {